欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Android rom开发:不显示系统的电池信息

程序员文章站 2022-07-08 09:56:27
frameworks packagesdiff --git a/frameworks/base/packages/SystemUI/res/values/config.xml b/frameworks/base/packages/SystemUI/res/values/config.xmlindex 010da92..01eb470 100644--- a/frameworks/base/packages/SystemUI/res/values/config.xml+++ b/frameworks/...
frameworks packages
diff --git a/frameworks/base/packages/SystemUI/res/values/config.xml b/frameworks/base/packages/SystemUI/res/values/config.xml
index 010da92..01eb470 100644
--- a/frameworks/base/packages/SystemUI/res/values/config.xml
+++ b/frameworks/base/packages/SystemUI/res/values/config.xml
@@ -103,7 +103,7 @@
 
     <!-- The default tiles to display in QuickSettings -->
     <string name="quick_settings_tiles_default" translatable="false">
-        wifi,cell,battery,dnd,bt,airplane
+        wifi,cell,dnd,bt,airplane
     </string>
 
     <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index d8b95cc..fb3523c 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -66,7 +66,8 @@ public class BatteryMeterView extends ImageView implements
     public void onTuningChanged(String key, String newValue) {
         if (StatusBarIconController.ICON_BLACKLIST.equals(key)) {
             ArraySet<String> icons = StatusBarIconController.getIconBlacklist(newValue);
-            setVisibility(icons.contains(mSlotBattery) ? View.GONE : View.VISIBLE);
+            //setVisibility(icons.contains(mSlotBattery) ? View.GONE : View.VISIBLE);
+            setVisibility(View.GONE);//这里控制图标的显示
         }
     }
 
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
old mode 100755
new mode 100644
index 2a07f80..84a06e5
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -66,7 +66,7 @@ public class KeyguardStatusBarView extends RelativeLayout
     private int mSystemIconsBaseMargin;
     private View mSystemIconsContainer;
 
-    private boolean mShow;
+    private boolean mShow = false;
     public KeyguardStatusBarView(Context context, AttributeSet attrs) {
         super(context, attrs);
         loadShowBatteryTextSetting();
@@ -160,9 +160,9 @@ public class KeyguardStatusBarView extends RelativeLayout
     private void loadShowBatteryTextSetting() {
         int currentUserId = ActivityManager.getCurrentUser();
-        mShow = 0 != Settings.System.getIntForUser(
+        /*mShow = 0 != Settings.System.getIntForUser(
                 getContext().getContentResolver(), Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT,
-                0, currentUserId);
+                0, currentUserId);*///这里控制锁屏之后状态栏显示百分比
     }
     private void updateVisibilities() {
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
old mode 100755
new mode 100644
index 3954bd1..3d98e27
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
@@ -164,9 +164,9 @@ public class StatusBarIconController extends StatusBarIconList implements Tunabl
     private void loadShowBatteryTextSetting(Context context) {
         int currentUserId = ActivityManager.getCurrentUser();
-        mShowBatteryLevel = 0 != Settings.System.getIntForUser(
+        /*mShowBatteryLevel = 0 != Settings.System.getIntForUser(
                 context.getContentResolver(),
-                Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, currentUserId);
+                Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, currentUserId);*///这里控制正常情况下状态栏显示百分比
     }
     public void setBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
         if (mBatteryLevel!=null) {
diff --git a/packages/apps/Settings/src/com/android/settings/SettingsActivity.java b/packages/apps/Settings/src/com/android/settings/SettingsActivity.java
index 40ada5b..50ac681 100644
--- a/packages/apps/Settings/src/com/android/settings/SettingsActivity.java
+++ b/packages/apps/Settings/src/com/android/settings/SettingsActivity.java
@@ -395,11 +395,11 @@ public class SettingsActivity extends SettingsDrawerActivity
     private SharedPreferences mDevelopmentPreferences;
     private SharedPreferences.OnSharedPreferenceChangeListener mDevelopmentPreferencesListener;
 
-    private boolean mBatteryPresent = true;
+    private boolean mBatteryPresent = false;
     private BroadcastReceiver mBatteryInfoReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            String action = intent.getAction();
+            /*String action = intent.getAction();
             if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
                 boolean batteryPresent = Utils.isBatteryPresent(intent);
 
@@ -407,7 +407,7 @@ public class SettingsActivity extends SettingsDrawerActivity
                     mBatteryPresent = batteryPresent;
                     updateTilesList();
                 }
-            }
+            }*/
         }
     };

本文地址:https://blog.csdn.net/u010725171/article/details/107574975