File tree Expand file tree Collapse file tree
krscript/src/main/java/com/omarea/krscript/model Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 */
1919
2020public 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 }
You can’t perform that action at this time.
0 commit comments