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

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

相关推荐
赏金术士35 分钟前
Compose 教学项目
android·kotlin·compose
晓梦林41 分钟前
ximai靶场学习笔记
android·笔记·学习
十六年开源服务商5 小时前
2026服务器配置优化与WordPress运维实战指南
android·运维·服务器
音视频牛哥7 小时前
大牛直播SDK(SmartMediaKit)Android平台Unity3D RTSP/RTMP播放器集成实践
android·unity3d·rtsp播放器·rtmp播放器·unity3d rtmp播放器·安卓unity rtsp播放器·安卓unity rtmp播放器
w1wi7 小时前
安卓抓包完全指南(一):从入门到 SSL Pinning 绕过
android·网络协议·ssl
aqi009 小时前
一文理清 HarmonyOS 6.0.2 涵盖的十个升级点
android·华为·harmonyos·鸿蒙·harmony
赏金术士10 小时前
Jetpack Compose 状态提升(State Hoisting)完全指南
android·kotlin·compose
BoomHe10 小时前
git Rebase 为任意一笔提交补上 Change-Id
android·git·android studio
TDengine (老段)10 小时前
TDengine 超级表/子表/普通表 — 设计理念与内部表示
android·大数据·数据库·物联网·时序数据库·tdengine·涛思数据