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

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

相关推荐
爱装代码的小瓶子7 分钟前
字符操作函数续上
android·c语言·开发语言·数据结构·算法
用户2018792831678 分钟前
故事:你的“老式弹簧售货机”(Stack<E>)
android
用户20187928316723 分钟前
环形快递传送带大冒险:ArrayDeque 的奇幻之旅
android
用户20187928316730 分钟前
故事:你的“急急急快递站”(PriorityQueue<E>)
android
烈焰晴天1 小时前
新发布的一款使用ReactNative新架构加载Svga动画的开源插件[android/ios]
android·react native·ios
道之所在3 小时前
UE5.6源码安卓打包报错
android·ue5
用户2018792831673 小时前
贪心算法故事:拖延症小明的作业危机
android
人帅是非多3 小时前
Spanny-使用DSL优雅构建Android富文本库
android·github
liang_jy3 小时前
Activity 启动流程(六)—— Activity 窗口显示
android·面试·源码
RichardLai884 小时前
[Flutter 进阶] - 掌握StatefulWidget的艺术
android·前端·flutter