当前位置: 首页 > 工具软件 > Info Bar > 使用案例 >

StatusBar状态栏某个日志含义解释

凌和颂
2023-12-01

1. 如何看 StatusBar: disable disable2 日志

disable状态的值,大写表示disable,小写表示enable,“!”表示该flag的状态是否有变化;

// 第一个e表示当前状态栏enable
StatusBar: disable<e i a s B H R c s > disable2<q i n > 

// 第一个E表示当前状态栏disable且发生变化了,例如无法下拉通知栏
StatusBar: disable<E!i a s b h r c s > disable2<Q!i n > 

每个字母的含义可以对照 StatusBar.java 的方法

2. 日志中状态码相关的源码

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java

          /**
1758       * State is one or more of the DISABLE constants from StatusBarManager.
1759       */
1760      @Override
1761      public void disable(int displayId, int state1, int state2, boolean animate) {
1762          if (displayId != mDisplayId) {
1763              return;
1764          }
1765          state2 = mRemoteInputQuickSettingsDisabler.adjustDisableFlags(state2);
1766  
1767          animate &= mStatusBarWindowState != WINDOW_STATE_HIDDEN;
1768          final int old1 = mDisabled1;
1769          final int diff1 = state1 ^ old1;
1770          mDisabled1 = state1;
1771  
1772          final int old2 = mDisabled2;
1773          final int diff2 = state2 ^ old2;
1774          mDisabled2 = state2;
1775  
1776          if (DEBUG) {
1777              Log.d(TAG, String.format("disable1: 0x%08x -> 0x%08x (diff1: 0x%08x)",
1778                  old1, state1, diff1));
1779              Log.d(TAG, String.format("disable2: 0x%08x -> 0x%08x (diff2: 0x%08x)",
1780                  old2, state2, diff2));
1781          }
1782  
1783          StringBuilder flagdbg = new StringBuilder();
1784          flagdbg.append("disable<");
1785          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_EXPAND))                ? 'E' : 'e');
1786          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_EXPAND))                ? '!' : ' ');
1787          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_NOTIFICATION_ICONS))    ? 'I' : 'i');
1788          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_NOTIFICATION_ICONS))    ? '!' : ' ');
1789          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_NOTIFICATION_ALERTS))   ? 'A' : 'a');
1790          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_NOTIFICATION_ALERTS))   ? '!' : ' ');
1791          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_SYSTEM_INFO))           ? 'S' : 's');
1792          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_SYSTEM_INFO))           ? '!' : ' ');
1793          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_BACK))                  ? 'B' : 'b');
1794          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_BACK))                  ? '!' : ' ');
1795          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_HOME))                  ? 'H' : 'h');
1796          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_HOME))                  ? '!' : ' ');
1797          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_RECENT))                ? 'R' : 'r');
1798          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_RECENT))                ? '!' : ' ');
1799          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_CLOCK))                 ? 'C' : 'c');
1800          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_CLOCK))                 ? '!' : ' ');
1801          flagdbg.append(0 != ((state1 & StatusBarManager.DISABLE_SEARCH))                ? 'S' : 's');
1802          flagdbg.append(0 != ((diff1  & StatusBarManager.DISABLE_SEARCH))                ? '!' : ' ');
1803          flagdbg.append("> disable2<");
1804          flagdbg.append(0 != ((state2 & StatusBarManager.DISABLE2_QUICK_SETTINGS))       ? 'Q' : 'q');
1805          flagdbg.append(0 != ((diff2  & StatusBarManager.DISABLE2_QUICK_SETTINGS))       ? '!' : ' ');
1806          flagdbg.append(0 != ((state2 & StatusBarManager.DISABLE2_SYSTEM_ICONS))         ? 'I' : 'i');
1807          flagdbg.append(0 != ((diff2  & StatusBarManager.DISABLE2_SYSTEM_ICONS))         ? '!' : ' ');
1808          flagdbg.append(0 != ((state2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE))   ? 'N' : 'n');
1809          flagdbg.append(0 != ((diff2  & StatusBarManager.DISABLE2_NOTIFICATION_SHADE))   ? '!' : ' ');
1810          flagdbg.append('>');
1811          Log.d(TAG, flagdbg.toString());
1812  
1813          if ((diff1 & StatusBarManager.DISABLE_EXPAND) != 0) {
1814              if ((state1 & StatusBarManager.DISABLE_EXPAND) != 0) {
1815                  mShadeController.animateCollapsePanels();
1816              }
1817          }
1818  
1819          if ((diff1 & StatusBarManager.DISABLE_RECENT) != 0) {
1820              if ((state1 & StatusBarManager.DISABLE_RECENT) != 0) {
1821                  // close recents if it's visible
1822                  mHandler.removeMessages(MSG_HIDE_RECENT_APPS);
1823                  mHandler.sendEmptyMessage(MSG_HIDE_RECENT_APPS);
1824              }
1825          }
1826  
1827          if ((diff1 & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) {
1828              if (areNotificationAlertsDisabled()) {
1829                  mHeadsUpManager.releaseAllImmediately();
1830              }
1831          }
1832  
1833          if ((diff2 & StatusBarManager.DISABLE2_QUICK_SETTINGS) != 0) {
1834              updateQsExpansionEnabled();
1835          }
1836  
1837          if ((diff2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) != 0) {
1838              updateQsExpansionEnabled();
1839              if ((state2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) != 0) {
1840                  mShadeController.animateCollapsePanels();
1841              }
1842          }
1843      }
 类似资料: