我是靠谱客的博主 强健口红,这篇文章主要介绍System UI 调试方法,现在分享给大家,希望可以做个参考。

工作需要想了解下SystemUi的启动流程,所以需要调试下SystemUI,这样比较高效:

1、SyStemUI是随系统启动的,所以我们先要在系统启动的时候把SystemUI的启动关掉,这个在SystemServer里面,可以如下注释:

复制代码
1
2
3
4
5
6
7
8
static final void startSystemUi(Context context) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); //Slog.d(TAG, "Starting service: " + intent); // context.startServiceAsUser(intent, UserHandle.OWNER); }

这样,系统起来或就看不到systemUI了,如果系统起来后没有systemUI进程,我们最好自己做一个应用,与systemUi在同一进程,这样方便调试onCreate等

2、现在SystemUi没有起来了,我们自己做一个测试例子,在里面启动SystemService,如下:

复制代码
1
2
3
4
5
6
7
Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); // Slog.d(TAG, "Starting service: " + intent); context.startService(intent);

这样,我们就可以调试SystemUI这个APK了

调试过程中,发现这样调试还有一个问题,就是调试不到10s左右,adb调试跟eclipse自动断开了,这个是由于startService的超时导致ANR,我们可以针对这个调试把相应的ANR注释掉,在ActivityManagerService.java的appNotResponding方法中添加如下代码:

复制代码
1
2
3
if(app.processName.equalsIgnoreCase("com.example.adbtool")) return ;

到这里,我们就可以正常的调试SystemUI了。

最后

以上就是强健口红最近收集整理的关于System UI 调试方法的全部内容,更多相关System UI 调试方法内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(67)

评论列表共有 0 条评论

立即
投稿
返回
顶部