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

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

相关推荐
洞见不一样的自己1 小时前
android 常用方法
android
暗碳1 小时前
华为麦芒5(安卓6)termux记录 使用ddns-go,alist
android·linux
seven27291 小时前
Android MQTT关于断开连接disconnect报错原因
android·mqtt·disconnect报错
Maplee5 小时前
Compose 转场动画之 Transition
android·前端
weixin_482565536 小时前
Android IC读写器安卓小程序 3
android·小程序
hvinsion7 小时前
Python PDF批量加密工具
android·python·pdf
m0_748230447 小时前
【MySQL】数据库开发技术:内外连接与表的索引穿透深度解析
android·mysql·数据库开发
marui19827 小时前
hadoop sql 执行log
android·ide·android studio
liangmou21219 小时前
解释小部分分WPI函数(由贪吃蛇游戏拓展)
android·游戏·c#
你听得到119 小时前
《Flutter性能优化全攻略:从首屏渲染到性能监测,附案例代码详解》
android·flutter