Android12---下拉状态栏添加网速显示(MTK平台)

问题

客户反馈下拉状态栏后没有网速显示了

分析

状态栏是在SystemUI里面的主要去看这里面的代码就行了

代码位置

        修改:     vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/quick_qs_status_icons.xml
        修改:     vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java

具体代码

xw-server3@xw-server3:/code2/lyz/7701_6113/mt6877_S0_V12/alps$ git diff vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/quick_qs_status_icons.xml
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/quick_qs_status_icons.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/quick_qs_status_icons.xml
old mode 100644
new mode 100755
index 5b9ca1b2615..f1958e036eb
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/quick_qs_status_icons.xml
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/quick_qs_status_icons.xml
@@ -84,6 +84,15 @@
             systemui:textAppearance="@style/TextAppearance.QS.Status"
             android:paddingEnd="2dp" />

+         
+
+
     
     

xw-server3@xw-server3:/code2/lyz/7701_6113/mt6877_S0_V12/alps$ git diff vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
old mode 100644
new mode 100755
index 77906abce62..9a35357cf7e
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -45,6 +45,12 @@ import com.android.systemui.statusbar.policy.Clock;

 import java.util.List;

+//lyz add Dropdown status bar NetSpeedShow
+import com.android.systemui.Dependency;
+import com.android.systemui.plugins.DarkIconDispatcher;
+import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
+
+
 /**
  * View that contains the top-most bits of the QS panel (primarily the status bar with date, time,
  * battery, carrier info and privacy icons) and also contains the {@link QuickQSPanel}.
@@ -98,6 +104,10 @@ public class QuickStatusBarHeader extends FrameLayout {
     private boolean mHasCenterCutout;
     private boolean mConfigShowBatteryEstimate;

+       //lyz add Dropdown status bar NetSpeedShow
+       private DarkReceiver mNetSpeedShow;
+
+
     public QuickStatusBarHeader(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
@@ -134,6 +144,9 @@ public class QuickStatusBarHeader extends FrameLayout {
         // Tint for the battery icons are handled in setupHost()
         mBatteryRemainingIcon = findViewById(R.id.batteryRemainingIcon);

+               //lyz add Dropdown status bar NetSpeedShow
+               mNetSpeedShow = findViewById(R.id.net_show_text);
+
         updateResources();

         // Don't need to worry about tuner settings for this icon
@@ -159,6 +172,9 @@ public class QuickStatusBarHeader extends FrameLayout {
         // Set the correct tint for the status icons so they contrast
         iconManager.setTint(fillColor);

+               //lyz add Dropdown status bar NetSpeedShow
+               Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNetSpeedShow);
+
         mQSExpansionPathInterpolator = qsExpansionPathInterpolator;
         updateAnimators();
     }

状态栏解析:
SystemUI状态栏形式及流程
https://blog.csdn.net/xxdw1992/article/details/121676333
Android SystemUI之启动流程(一)
https://blog.csdn.net/Bill_xiao/article/details/107225145

代码分析

下拉状态栏跟桌面状态栏并不是一个界面。下拉状态栏在quick_qs_status_icons.xml布局

桌面的是S:\lyz\7701_6113\mt6877_S0_V12\alps\vendor\mediatek\proprietary\packages\apps\SystemUI\res\layout\system_icons.xml

查询记录看桌面如何加的,模仿一下。下拉状态栏的布局控制是在QuickStatusBarHeader.java里,在这里初始化一下就可以啦

xw-server3@xw-server3:/code2/lyz/7701_6113/mt6877_S0_V12/alps/vendor/mediatek/proprietary/packages/apps/SystemUI$ grep "mNetSpeedShow" * -rn
src/com/android/systemui/qs/QuickStatusBarHeader.java:108:      private DarkReceiver mNetSpeedShow;
src/com/android/systemui/qs/QuickStatusBarHeader.java:148:              mNetSpeedShow = findViewById(R.id.net_show_text);
src/com/android/systemui/qs/QuickStatusBarHeader.java:176:              Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNetSpeedShow);
src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java:79:    private DarkReceiver mNetSpeedShow;
src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java:126:        mNetSpeedShow = findViewById(R.id.net_show_text);
src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java:141:        Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNetSpeedShow);
xw-server3@xw-server3:/code2/lyz/7701_6113/mt6877_S0_V12/alps/vendor/mediatek/proprietary/packages/apps/SystemUI$

你可能感兴趣的:(Android12,android,java,git)