Android 8.1 设备删除蓝牙功能

Android 8.1 设备删除蓝牙功能

最近接到项目反馈,要求删除设备的蓝牙功能,具体修改参照如下:

/project/ProjectConfig.mk:

+MTK_BT_SUPPORT = no

/vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml

+    <bool name="def_bluetooth_on">false</bool>

/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml

    <string name="quick_settings_tiles_default" translatable="false">
-        wifi,cell,battery,dnd,rotation,bt,airplane,location
+        wifi,cell,battery,dnd,rotation,airplane,location
    </string>

    <string name="quick_settings_tiles_stock" translatable="false">
-        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,inversion,saver,work,cast,night
+        wifi,cell,battery,dnd,flashlight,rotation,airplane,location,inversion,saver,work,cast,night
    </string>

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values/strings.xml

-    <string name="connected_devices_dashboard_summary">Bluetooth, Cast, NFC</string>
+    <string name="connected_devices_dashboard_summary">Cast, NFC</string>

-    <string name="connected_devices_dashboard_no_nfc_summary">Bluetooth, Cast</string>
+    <string name="connected_devices_dashboard_no_nfc_summary">Cast</string>

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values-zh-rCN/strings.xml

-    <string name="connected_devices_dashboard_summary" msgid="2390582103384791904">"蓝牙、投射、NFC"</string>
+    <string name="connected_devices_dashboard_summary" msgid="2390582103384791904">"投射、NFC"</string>

-    <string name="connected_devices_dashboard_no_nfc_summary" msgid="9106040742715366495">"蓝牙、投射"</string>
+    <string name="connected_devices_dashboard_no_nfc_summary" msgid="9106040742715366495">"投射"</string>

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/connected_devices.xml

-    <com.android.settings.widget.MasterSwitchPreference
-      android:key="toggle_bluetooth"
-      android:title="@string/bluetooth_settings_title"
-      android:icon="@drawable/ic_settings_bluetooth"
-      android:order="-7"/>

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/device_info_status.xml

-    <Preference
-        android:key="bt_address"
-        android:enabled="false"
-        android:shouldDisableView="false"
-        android:title="@string/status_bt_address"
-        android:summary="@string/summary_placeholder"
-        android:persistent="false" />

/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/location_scanning.xml

-        <SwitchPreference
-            android:title="@string/location_scanning_bluetooth_always_scanning_title"
-            android:summary="@string/location_scanning_bluetooth_always_scanning_description"
-            android:defaultValue="true"
-            android:key="bluetooth_always_scanning" />

/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/SettingsActivity.java

        somethingChanged = setTileEnabled(new ComponentName(packageName,
                        Settings.BluetoothSettingsActivity.class.getName()),
-                pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH), isAdmin)
+                false/*pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)*/, isAdmin)
                || somethingChanged;

/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java

-        final BluetoothMasterSwitchPreferenceController bluetoothPreferenceController =
-                new BluetoothMasterSwitchPreferenceController(
-                        context, Utils.getLocalBtManager(context), this,
-                        (SettingsActivity) getActivity());
-        lifecycle.addObserver(bluetoothPreferenceController);
-        controllers.add(bluetoothPreferenceController);

                public List<String> getNonIndexableKeys(Context context) {
                    final List<String> keys = super.getNonIndexableKeys(context);
                    PackageManager pm = context.getPackageManager();
                    if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
                        keys.add(NfcPreferenceController.KEY_TOGGLE_NFC);
                        keys.add(NfcPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
                    }
-                    keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);

                    SmsMirroringFeatureProvider smsMirroringFeatureProvider =
                            FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
                    SmsMirroringPreferenceController smsMirroringController =
                            smsMirroringFeatureProvider.getController(context);
                    smsMirroringController.updateNonIndexableKeys(keys);

重新编译验证,修改生效,设备已删除蓝牙功能

相关推荐
数据猎手小k2 小时前
AndroidLab:一个系统化的Android代理框架,包含操作环境和可复现的基准测试,支持大型语言模型和多模态模型。
android·人工智能·机器学习·语言模型
你的小102 小时前
JavaWeb项目-----博客系统
android
风和先行3 小时前
adb 命令查看设备存储占用情况
android·adb
AaVictory.4 小时前
Android 开发 Java中 list实现 按照时间格式 yyyy-MM-dd HH:mm 顺序
android·java·list
似霰5 小时前
安卓智能指针sp、wp、RefBase浅析
android·c++·binder
大风起兮云飞扬丶5 小时前
Android——网络请求
android
干一行,爱一行5 小时前
android camera data -> surface 显示
android
断墨先生5 小时前
uniapp—android原生插件开发(3Android真机调试)
android·uni-app
无极程序员7 小时前
PHP常量
android·ide·android studio
萌面小侠Plus8 小时前
Android笔记(三十三):封装设备性能级别判断工具——低端机还是高端机
android·性能优化·kotlin·工具类·低端机