Android9.0 SystemUI网络信号栏定制修改的流程解析

  

  

Android 8.1平台SystemUI导航栏加载流程解析

  

  

1,新增StatusBarMobileView替代SignalClusterView,用以控制信号栏显示

  

同时增加的还有StatusBarIconView, StatusBarWifiView

  

2,整体流程和8.1类似

  

效果图   

 Android9.0 SystemUI网络信号栏定制修改的流程解析

  

整体流程图

  

 Android9.0 SystemUI网络信号栏定制修改的流程解析“> <br/>
  </p>
  </p> <p>上代码
  <p> <img src=

  

先来看初始赋值的地方MobileSignalController。java在notifyListeners()方法中进行我们对应的定制,

  

最后通过callback.setMobileDataIndicators()将状态值传递到StatusBarSignalPolicy。java解析显示

  

供应商\程序\ \联发科\专有\包SystemUI android \ src \ com \ \ SystemUI \状态栏\ \政策MobileSignalController.java

        @Override   公共空间notifyListeners (SignalCallback回调){=getIcons MobileIconGroup图标();   字符串contentDescription=getStringIfExists (getContentDescription ());   字符串dataContentDescription=getStringIfExists (icons.mDataContentDescription);   如果(mCurrentState。inetCondition==0) {   dataContentDescription=mContext.getString (R.string.data_connection_no_internet);   }   最后布尔dataDisabled=mCurrentState。iconGroup==TelephonyIcons.DATA_DISABLED   ,,mCurrentState.userSetup;///M:自定义信号强度图标id。@ {   int iconId=getCurrentIconId ();   iconId=mStatusBarExt.getCustomizeSignalStrengthIcon (   mSubscriptionInfo.getSubscriptionId (),   iconId,   mSignalStrength,   mDataNetType,   mServiceState);///@}   如果(mSignalStrength !=null) {/* int dbm=mSignalStrength.getDbm ();   int asu=mSignalStrength.getAsuLevel ();   日志。我(“ccz”、“dbm=" + dbm + " asu=" + asu); */日志。e (“ccz”、“isGSM==" + mSignalStrength.isGsm ()   + "连接==" + mCurrentState。连接+“dataConnected==" + mCurrentState.dataConnected);   }   如果(mCurrentState.connected) {//cczheng添加得到信号图标[S]//通过getSignalStrengthIcon方法,根据自定义规则,返回要显示对应资源id   iconId=TelephonyIcons。getSignalStrengthIcon (mSignalStrength !=null & # 63;mSignalStrength.getDbm(): -120年,   mSignalStrength !=null & # 63;mSignalStrength.getAsuLevel (): 0);//iconId=TelephonyIcons.getSignalStrengthIcon (mCurrentState.level);//cczheng添加得到信号图标[E]   其他}{//未连接成功时显示X   iconId=R.drawable.stat_sys_signal_disable;   }//显示图标QS当我们连接或数据是禁用的。   布尔showDataIcon=mCurrentState。dataConnected | | dataDisabled;   日志。我(“ccz”、“dataDisabled=" + dataDisabled + " showDataIcon=" + showDataIcon);   IconState statusIcon=new IconState (mCurrentState。使,,! mCurrentState.airplaneMode,   iconId contentDescription);   int qsTypeIcon=0;   IconState qsIcon=零;   字符串描述=零;//ccz”、“积极性showDataIcon=" + showDataIcon + "=" +积极性   + " activityOut=" + activityOut);   日志。我(“ccz”、“networkName=" + mCurrentState.networkName + "描述=" +描述);   回调。setMobileDataIndicators (statusIcon、qsIcon typeIcon、networkIcon volteIcon,   qsTypeIcon,积极性,activityOut dataContentDescription、描述   图标。mCurrentState.roaming mIsWide mSubscriptionInfo.getSubscriptionId (),   mCurrentState。isDefaultData mCurrentState.customizedState);///M:更新plmn标签@ {   mNetworkController.refreshPlmnCarrierLabel ();///@}   }   私人最终无效updateTelephony () {   …///M:网络类型大图标。   mCurrentState.networkIcon=NetworkTypeUtils。getNetworkTypeIcon (mServiceState mConfig hasService ());///M:回类型图标。   mCurrentState。volteIcon=getVolteIcon ();//cczheng qsdatetype添加   mCurrentState。.mQsDataType mQsDataType=((MobileIconGroup) mCurrentState.iconGroup);//cczheng添加操作员   mCurrentState。运算符=getOperatorType ();   notifyListenersIfNecessary ();   }   私人字符串getOperatorType () {   如果(! hasService ()) {//服务,并不显示运营商   返回“0”;   }   int operatorType=NetworkTypeUtils.getOperatorType (mPhone);   如果(operatorType==0)   返回“0”;   其他的   返回mContext.getResources () .getString (operatorType);   }

Android9.0 SystemUI网络信号栏定制修改的流程解析