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);

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

相关推荐
找藉口是失败者的习惯2 小时前
Jetpack Compose 如何布局解析
android·xml·ui
Estar.Lee7 小时前
查手机号归属地免费API接口教程
android·网络·后端·网络协议·tcp/ip·oneapi
温辉_xh7 小时前
uiautomator案例
android
工业甲酰苯胺8 小时前
MySQL 主从复制之多线程复制
android·mysql·adb
少说多做3438 小时前
Android 不同情况下使用 runOnUiThread
android·java
Estar.Lee10 小时前
时间操作[计算时间差]免费API接口教程
android·网络·后端·网络协议·tcp/ip
找藉口是失败者的习惯10 小时前
从传统到未来:Android XML布局 与 Jetpack Compose的全面对比
android·xml
Jinkey12 小时前
FlutterBasic - GetBuilder、Obx、GetX<Controller>、GetxController 有啥区别
android·flutter·ios
大白要努力!13 小时前
Android opencv使用Core.hconcat 进行图像拼接
android·opencv
天空中的野鸟14 小时前
Android音频采集
android·音视频