Android16 蓝牙打开时,状态栏显示蓝牙图标
说明本修改主要针对 Android 16API 36AOSP 源码中的 SystemUI 模块。项目内容适用版本Android 16API 36涉及模块frameworks/base/packages/SystemUI修改类PhoneStatusBarPolicy修改方法updateBluetooth()在 Android 16 原生 SystemUI 中PhoneStatusBarPolicy.updateBluetooth()默认仅在蓝牙已连接且满足音频 Profile 条件时才显示状态栏图标。用户仅打开蓝牙开关、尚未连接设备时状态栏不会出现蓝牙图标与快捷设置中蓝牙已开启的状态不一致。本次修改在 Android 16 上实现蓝牙开启即显示stat_sys_data_bluetooth图标新增资源蓝牙已连接时切换为stat_sys_data_bluetooth_connected图标蓝牙关闭时隐藏图标若移植到其他 Android 版本需确认对应分支中PhoneStatusBarPolicy.java路径及updateBluetooth()实现是否一致资源命名是否相同。修改文件frameworks/base/packages/SystemUI/res/drawable/stat_sys_data_bluetooth.xml (新增) frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java (修改)1. 新增stat_sys_data_bluetooth.xml路径frameworks/base/packages/SystemUI/res/drawable/stat_sys_data_bluetooth.xml!-- Copyright (C) 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --vectorxmlns:androidhttp://schemas.android.com/apk/res/androidandroid:width17dpandroid:height17dpandroid:viewportWidth17.0android:viewportHeight17.0groupandroid:translateY0.5android:translateX0.5pathandroid:pathDataM8.84,8l2.62,-2.62c0.29,-0.29 0.29,-0.75 0,-1.04L8.33,1.22L8.31,1.2c-0.3,-0.28 -0.76,-0.26 -1.03,0.04c-0.13,0.13 -0.2,0.31 -0.2,0.5v4.51L4.24,3.4c-0.29,-0.29 -0.74,-0.29 -1.03,0s-0.29,0.74 0,1.03L6.78,8l-3.56,3.56c-0.29,0.29 -0.29,0.74 0,1.03s0.74,0.29 1.03,0l2.83,-2.83v4.51c0,0.4 0.33,0.73 0.73,0.73c0.18,0 0.36,-0.07 0.5,-0.2l0.03,-0.03l3.12,-3.12c0.29,-0.29 0.29,-0.75 0,-1.04L8.84,8zM8.47,6.37V3.36l1.5,1.5L8.47,6.37zM8.47,12.63V9.62l1.5,1.5L8.47,12.63zandroid:fillColor#FFFFFF//group/vector2. 修改PhoneStatusBarPolicy.java路径frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java方法updateBluetooth()修改前privatefinalvoidupdateBluetooth(){inticonIdR.drawable.stat_sys_data_bluetooth_connected;StringcontentDescriptionmResources.getString(R.string.accessibility_quick_settings_bluetooth_on);booleanbluetoothVisiblefalse;if(mBluetooth!null){// Bug 2687381, The Bluetooth icon is not displayed normally.Log.d(TAG,updateBluetooth(), mIsActive:mBluetooth.isBluetoothAudioActive());if(mBluetooth.isBluetoothConnected()(mBluetooth.isBluetoothAudioActive()||!mBluetooth.isBluetoothAudioProfileOnly())){contentDescriptionmResources.getString(R.string.accessibility_bluetooth_connected);bluetoothVisiblemBluetooth.isBluetoothEnabled();}}// ...}修改后privatefinalvoidupdateBluetooth(){// Create by yeruilai 2026-6-6 19:54:14 Display Bluetooth icon when open// int iconId R.drawable.stat_sys_data_bluetooth_connected;inticonIdR.drawable.stat_sys_data_bluetooth;StringcontentDescriptionmResources.getString(R.string.accessibility_quick_settings_bluetooth_on);booleanbluetoothVisiblefalse;if(mBluetooth!null){// Bug 2687381, The Bluetooth icon is not displayed normally.Log.d(TAG,updateBluetooth(), mIsActive:mBluetooth.isBluetoothAudioActive());// Create by yeruilai 2026-6-6 19:54:14 Display Bluetooth icon when openbluetoothVisiblemBluetooth.isBluetoothEnabled();if(mBluetooth.isBluetoothConnected()(mBluetooth.isBluetoothAudioActive()||!mBluetooth.isBluetoothAudioProfileOnly())){contentDescriptionmResources.getString(R.string.accessibility_bluetooth_connected);bluetoothVisiblemBluetooth.isBluetoothEnabled();// Create by yeruilai 2026-6-6 19:54:14 Display Bluetooth icon when openiconIdR.drawable.stat_sys_data_bluetooth_connected;}}// ...}修改点private final void updateBluetooth() { - int iconId R.drawable.stat_sys_data_bluetooth_connected; // Create by yeruilai 2026-6-6 19:54:14 Display Bluetooth icon when open // int iconId R.drawable.stat_sys_data_bluetooth_connected; int iconId R.drawable.stat_sys_data_bluetooth; String contentDescription mResources.getString(R.string.accessibility_quick_settings_bluetooth_on); boolean bluetoothVisible false; if (mBluetooth ! null) { // Bug 2687381, The Bluetooth icon is not displayed normally. Log.d(TAG, updateBluetooth(), mIsActive: mBluetooth.isBluetoothAudioActive()); // Create by yeruilai 2026-6-6 19:54:14 Display Bluetooth icon when open bluetoothVisible mBluetooth.isBluetoothEnabled(); if (mBluetooth.isBluetoothConnected() (mBluetooth.isBluetoothAudioActive() || !mBluetooth.isBluetoothAudioProfileOnly())) { contentDescription mResources.getString( R.string.accessibility_bluetooth_connected); bluetoothVisible mBluetooth.isBluetoothEnabled(); // Create by yeruilai 2026-6-6 19:54:14 Display Bluetooth icon when open iconId R.drawable.stat_sys_data_bluetooth_connected; } }附图

相关新闻

LangGraph原理逻辑-多智能体架构(一)

LangGraph原理逻辑-多智能体架构(一)

LangGraph的底层原理一、速了解LangGraph二、 LangGraph到底是干什么的?三、快速体验LangChain与LangGraph3.1. 代码对比 (基础)3.2. 代码对比 (添加工具)总结一、速了解LangGraph LangGraph是一个功能非常强大的大语言模型本地…

2026/7/21 8:37:02 阅读更多 →
TFRS工业级推荐系统实战:从双塔模型到业务可解释性

TFRS工业级推荐系统实战:从双塔模型到业务可解释性

1. 项目概述:这不是“调个库就完事”的推荐系统,而是用TFRS把业务逻辑焊进模型里的实战 如果你在搜索“TFRS 推荐系统”时,看到的全是几行代码跑通MovieLens数据集的教程,然后戛然而止——那你不是没找到答案,而是还没…

2026/7/21 8:37:02 阅读更多 →
间隙衰败引起的问题(F-Tile PMA/FEV Direct PHY IP 或Ultrascale FPGAs Transeivers Wizard(1.7))

间隙衰败引起的问题(F-Tile PMA/FEV Direct PHY IP 或Ultrascale FPGAs Transeivers Wizard(1.7))

间隙衰败引起的问题(BIT 或FEC ERR) 数据传输过程中出现bit err(quartusII)Auto Mode(自动模式)Manual Mode(手动模式)Native Mode(原生模式) 数据传输过程中出现FEC误报&#xff08…

2026/7/21 8:37:02 阅读更多 →

最新新闻

OpenClaw与RAG技术构建企业智能助手实践

OpenClaw与RAG技术构建企业智能助手实践

1. 项目概述:OpenClaw与RAG的化学反应去年第一次看到OpenClaw时,我就被它的设计理念击中了——这可能是目前最接近"数字员工"形态的开源AI助手。不同于常见的聊天机器人,OpenClaw更像是一个坐在你电脑里的虚拟同事,它能…

2026/7/23 15:24:17 阅读更多 →
深入解析bq24745:SMBus通信、寄存器配置与硬件设计实战

深入解析bq24745:SMBus通信、寄存器配置与硬件设计实战

1. 项目概述:深入理解bq24745的智能充电管理在笔记本电脑、工业手持终端这类需要内置电池的便携设备里,如何安全、高效、智能地给电池充电,一直是个既基础又核心的难题。你肯定不希望设备充电时过热,也不希望因为过充过放而让电池…

2026/7/23 15:24:17 阅读更多 →
Python基础之函数调用

Python基础之函数调用

题目 1:函数定义与调用定义一个函数 calculate,它接受两个整数参数 a 和 b,返回这两个数的商和余数,并调用该函数计算 15和4的商和余数。如果b为0,则商和余数为None。def calculate(a:int, b:int):if b 0:return None…

2026/7/23 15:24:17 阅读更多 →
收藏!小白程序员必看:AI落地避坑指南,轻松抓住大模型红利!

收藏!小白程序员必看:AI落地避坑指南,轻松抓住大模型红利!

本文揭示了企业AI转型中70%项目失败的真相——忽视业务问题,盲目追求技术。文章聚焦企业关心的核心问题,分析AI改造的“冰火两重天”现状,提供选对AI改造场景的“黄金法则”,并深度剖析落地时需避开的四个致命坑(战略、…

2026/7/23 15:24:17 阅读更多 →
自动隐藏侧边栏:实现方案与性能优化

自动隐藏侧边栏:实现方案与性能优化

1. 项目概述:为什么需要自动隐藏侧边栏? 在网页设计和应用开发中,侧边栏是个让人又爱又恨的存在。作为从业十年的前端开发者,我见过太多因为侧边栏设计不当而毁掉的用户体验。传统固定侧边栏会占用宝贵的屏幕空间,特别…

2026/7/23 15:24:16 阅读更多 →
Unity AI开发工具对比:官方助手与开源MCP协议方案深度解析

Unity AI开发工具对比:官方助手与开源MCP协议方案深度解析

1. 项目概述:当开源工具集遇上官方AI产品最近Unity社区里关于AI辅助开发工具的讨论越来越热,尤其是两个名字频繁被提及:一个是开源的Funplay Unity MCP,另一个是Unity官方推出的Unity AI Assistant。很多开发者都在问,…

2026/7/23 15:23:16 阅读更多 →

日新闻

从单点好评到指数级传播:AI副业主理人必须掌握的4层口碑渗透模型(含ROI测算表)

从单点好评到指数级传播:AI副业主理人必须掌握的4层口碑渗透模型(含ROI测算表)

更多请点击: https://intelliparadigm.com 第一章:从单点好评到指数级传播:AI副业主理人必须掌握的4层口碑渗透模型(含ROI测算表) 当AI副业主理人不再仅满足于单次服务交付,而是主动构建可复用、可裂变、可…

2026/7/23 0:00:25 阅读更多 →
AI写作开头钩子设计:为什么你的AI文案完读率不足18%?——基于2,346篇A/B测试报告的归因分析

AI写作开头钩子设计:为什么你的AI文案完读率不足18%?——基于2,346篇A/B测试报告的归因分析

更多请点击: https://codechina.net 第一章:AI写作开头钩子设计:为什么你的AI文案完读率不足18%?——基于2,346篇A/B测试报告的归因分析 在对2,346篇跨行业AI生成文案的A/B测试数据进行聚类分析后,我们发现&#xff1…

2026/7/23 0:01:26 阅读更多 →
Chitchatter完整指南:免费开源的终极点对点安全聊天工具

Chitchatter完整指南:免费开源的终极点对点安全聊天工具

Chitchatter完整指南:免费开源的终极点对点安全聊天工具 【免费下载链接】chitchatter Secure peer-to-peer chat that is serverless, decentralized, and ephemeral 项目地址: https://gitcode.com/gh_mirrors/ch/chitchatter Chitchatter是一款革命性的安…

2026/7/23 0:01:26 阅读更多 →

周新闻

Go语言静态资源打包方案对比与实践指南

Go语言静态资源打包方案对比与实践指南

1. 项目背景与核心需求在Go语言开发中,我们经常需要处理静态资源文件的打包问题。无论是Web应用的模板文件、前端资源,还是配置文件、证书等,都需要随程序一起分发。传统做法是将这些文件与编译后的二进制文件放在同一目录下,但这…

2026/7/22 8:58:19 阅读更多 →
Go语言实现高性能LDAP认证服务的架构与实践

Go语言实现高性能LDAP认证服务的架构与实践

1. 项目背景与核心价值LDAP(轻量级目录访问协议)作为企业级身份认证的黄金标准,已经服务了超过80%的财富500强公司。我在金融科技领域实施统一认证体系时,发现传统Java方案存在启动慢、内存占用高等痛点。而Go语言凭借其协程并发模…

2026/7/22 19:43:43 阅读更多 →
【AI面试官实战指南】:用ChatGPT模拟10类高频技术岗面试,3天提升应答精准度92%

【AI面试官实战指南】:用ChatGPT模拟10类高频技术岗面试,3天提升应答精准度92%

更多请点击: https://intelliparadigm.com 第一章:AI面试官实战指南的核心价值与适用场景 AI面试官并非替代人类HR的“黑箱工具”,而是以可解释、可审计、可迭代的方式,赋能招聘全链路的关键基础设施。其核心价值在于将主观经验沉…

2026/7/22 12:54:44 阅读更多 →

月新闻