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

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

你可能感兴趣的:(Android,android)