Anroid R上开启蓝牙后,状态栏上并不会直接显示蓝牙图标的。只有在蓝牙连接传输的时候才会有蓝牙图标显示。
原生实现是在PhoneStatusBarPolicy.java中:
private final void updateBluetooth() {
......
if (mBluetooth != null) {
if (mBluetooth.isBluetoothConnected()
&& (mBluetooth.isBluetoothAudioActive()
|| !mBluetooth.isBluetoothAudioProfileOnly())) {
contentDescription = mResources.getString(
R.string.accessibility_bluetooth_connected);
bluetoothVisible = mBluetooth.isBluetoothEnabled();
}
}
......
}
复制代码
解决方案:
将bluetoothVisible赋值的条件设置为bluetooth enable。
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();
+ //bluetoothVisible = mBluetooth.isBluetoothEnabled();
}
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END


















![[02/27][官改] Simplicity@MIX2 ROM更新-一一网](https://www.proyy.com/wp-content/uploads/2020/02/3168457341.jpg)



![[桜井宁宁]COS和泉纱雾超可爱写真福利集-一一网](https://www.proyy.com/skycj/data/images/2020-12-13/4d3cf227a85d7e79f5d6b4efb6bde3e8.jpg)

![[桜井宁宁] 爆乳奶牛少女cos写真-一一网](https://www.proyy.com/skycj/data/images/2020-12-13/d40483e126fcf567894e89c65eaca655.jpg)