Skip to content

Commit fc8afad

Browse files
committed
Upload file
1 parent 71bfc7d commit fc8afad

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

krscript/src/main/java/com/omarea/krscript/model/ShellHandlerBase.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
*/
1919

2020
public abstract class ShellHandlerBase extends Handler {
21-
22-
protected final Context context;
23-
24-
protected ShellHandlerBase(Context context) {
25-
this.context = context.getApplicationContext();
26-
}
27-
2821
/**
2922
* 处理启动信息
3023
*/
@@ -153,6 +146,13 @@ protected void onError(Object msg) {
153146

154147
protected void onAm(String type, String args) {
155148
try {
149+
// Lấy Application Context nội bộ (KHÔNG cần truyền)
150+
Context context = android.app.ActivityThread
151+
.currentApplication()
152+
.getApplicationContext();
153+
154+
if (context == null) return;
155+
156156
Intent intent = parseIntentArgs(args);
157157

158158
switch (type) {
@@ -173,7 +173,7 @@ protected void onAm(String type, String args) {
173173
}
174174
break;
175175
}
176-
} catch (Exception e) {
176+
} catch (Throwable e) {
177177
e.printStackTrace();
178178
}
179179
}

0 commit comments

Comments
 (0)