Android 打开蓝牙状态栏显示蓝牙图标 2020-12-03

系统默认是蓝牙链接后才在状态栏显示蓝牙图标

现在修改为打开蓝牙就在状态栏显示蓝牙图标

 

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

 

     private final void updateBluetooth() {
         int iconId = R.drawable.stat_sys_data_bluetooth_connected;
         String contentDescription =
                 mResources.getString(R.string.accessibility_quick_settings_bluetooth_on);
         boolean bluetoothVisible = false;
         if (mBluetooth != null) {
+            if(mBluetooth.isBluetoothEnabled()) {
+                bluetoothVisible = mBluetooth.isBluetoothEnabled();
+            }
             if (mBluetooth.isBluetoothConnected()
                     && (mBluetooth.isBluetoothAudioActive()
                     || !mBluetooth.isBluetoothAudioProfileOnly())) {
                 contentDescription = mResources.getString(
                         R.string.accessibility_bluetooth_connected);
                 bluetoothVisible = mBluetooth.isBluetoothEnabled();
             }
         }
 
         mIconController.setIcon(mSlotBluetooth, iconId, contentDescription);
         mIconController.setIconVisibility(mSlotBluetooth, bluetoothVisible);
     }

 


版权声明:本文为hmily0917原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。