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

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

相关推荐
代码飞天1 分钟前
wireshark的高级使用
android·java·wireshark
2501_915918411 小时前
苹果App Store上架审核卡住原因分析与解决方案指南
android·ios·小程序·https·uni-app·iphone·webview
skiy1 小时前
MySQL Workbench菜单汉化为中文
android·数据库·mysql
小小小点2 小时前
Android四大常用布局详解与实战
android
MinQ3 小时前
binder和socket区别及原理
android
Ehtan_Zheng3 小时前
Jetpack Compose 中绘制发光边框的多种方式
android
智塑未来3 小时前
像素蛋糕安卓版 AI 专业修图全场景输出高清成片
android·人工智能
陆业聪5 小时前
让 Android 里的 AI 真正「干活」:Function Calling 工程实现全解
android·ai·kotlin
毕设源码-赖学姐5 小时前
【开题答辩全过程】以 基于Android的服装搭配APP为例,包含答辩的问题和答案
android
qq_717410015 小时前
Add Baidu NLP for projects without GMS packages
android