Android 8.1 隐藏设置中定位功能

Android 8.1 隐藏设置中定位功能

最近接到客户反馈,需要隐藏设备设置中的定位功能,具体修改参照如下:

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

复制代码
        mLocationcontroller.displayPreference(root);
        mManageDeviceAdminPreferenceController.updateState(
                root.findPreference(KEY_MANAGE_DEVICE_ADMIN));
        mEnterprisePrivacyPreferenceController.displayPreference(root);
        mEnterprisePrivacyPreferenceController.onResume();
        /// M: Add plugin items
        PreferenceGroup deviceAdminCategory = (PreferenceGroup) root
                .findPreference(KEY_DEVICE_ADMIN_CATEGORY);
        addPluginEntrance(deviceAdminCategory);
+        root.findPreference(KEY_LOCATION).setVisible(false);
        return root;

到这里,在设置的搜索框中输入定位关键字仍能搜索到相关功能选项,想要屏蔽掉的话具体修改参照如下:

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

复制代码
        addIndex(LanguageAndInputSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_language);
-        addIndex(LocationSettings.class, R.xml.location_settings, R.drawable.ic_settings_location);
-        addIndex(ScanningSettings.class, R.xml.location_scanning, R.drawable.ic_settings_location);
        addIndex(SecuritySettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_security);
        addIndex(EncryptionAndCredential.class, NO_DATA_RES_ID, R.drawable.ic_settings_security);

重新编译验证,修改生效,设置中的定位功能已屏蔽

相关推荐
.豆鲨包24 分钟前
【Android】Binder机制浅析
android·binder
Nerve2 小时前
GooglePay: API 文档
android·google
Nerve2 小时前
GooglePay: 订阅商品购买流程
android·google
summerkissyou19872 小时前
Audio-触摸音-播放流程
android
Nerve3 小时前
GooglePay: 消耗商品购买流程
android·google
LiteHeaven3 小时前
Android 8.1 Unable to create application data 问题分析
android
Nerve3 小时前
GooglePay: 一个基于 Google Play Billing Library 封装的 Android 支付库
android·google
Nerve3 小时前
Google Play 结算系统入门指南
android·google
青莲8434 小时前
Android Jetpack - 2 ViewModel
android·前端