如何分析是那个应用导致状态栏消失

本文介绍了一种通过在状态栏管理类中增加日志来定位导致状态栏消失的应用的方法。具体步骤包括修改StatusBarManager和StatusBarManagerService两个核心类,记录调用堆栈信息并根据进程ID(PID)追踪到具体的触发应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如何分析是那个应用导致状态栏消失
状态栏主要的几个控制类中需要增加log如下,再根据pid去查是那个进程.
StatusBarManager.java
  1. public void disable(int what) {
  2. try {
  3. final IStatusBarService svc = getService();
  4. if (svc != null) {
  5. if ( (what & DISABLE_EXPAND) != 0 ) {
  6. Slog.d("StatusBarManager", "disable status bar , call from" , new RuntimeException("disable"));
  7. }
  8. svc.disable(what, mToken, mContext.getPackageName());
  9. }
  10. } catch (RemoteException ex) {
  11. // system process is dead anyway.
  12. throw new RuntimeException(ex);
  13. }
  14. }

StatusBarManagerService.java
  1. private void disableLocked(int userId, int what, IBinder token, String pkg) {
  2. // It's important that the the callback and the call to mBar get done
  3. // in the same order when multiple threads are calling this function
  4. // so they are paired correctly. The messages on the handler will be
  5. // handled in the order they were enqueued, but will be outside the lock.
  6. manageDisableListLocked(userId, what, token, pkg);
  7. // Ensure state for the current user is applied, even if passed a non-current user.
  8. final int net = gatherDisableActionsLocked(mCurrentUserId);
  9. if (net != mDisabled) {
  10. mDisabled = net;
  11. mHandler.post(new Runnable() {
  12. public void run() {
  13. mNotificationDelegate.onSetDisabled(net);
  14. }
  15. });
  16. if (mBar != null) {
  17. try {
  18. /// M:[ALPS01673960] Fix User cannot drag down the notification bar.
  19. Slog.d(TAG, "disable statusbar calling PID = " + Binder.getCallingPid());
  20. mBar.disable(net);
  21. } catch (RemoteException ex) {
  22. }
  23. }
  24. }
  25. }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值