Merge "Remove developer option to disable device ID access restrictions" into qt-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e0a4907..e359fed 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6079,10 +6079,6 @@
<string name="sms_access_restriction_enabled">Restrict SMS & call log access</string>
<!-- Summary for whether to enable SMS access restriction [CHAR LIMIT=NONE]-->
<string name="sms_access_restriction_enabled_summary">Only default phone and messaging apps have SMS & call log permissions</string>
- <!-- Title for the new device identifier access restrictions [CHAR LIMIT=50]-->
- <string name="device_identifier_access_restrictions_title">Disable device identifier restrictions</string>
- <!-- Summary for the new device identifier access restrictions [CHAR LIMIT=NONE]-->
- <string name="device_identifier_access_restrictions_summary">Disable the new access restrictions for device identifiers</string>
<!-- Message when there are no available trust agents to display -->
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 5a7d194..d1eff34 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -562,11 +562,6 @@
android:summary="@string/sms_access_restriction_enabled_summary" />
<SwitchPreference
- android:key="device_identifier_access_restrictions"
- android:title="@string/device_identifier_access_restrictions_title"
- android:summary="@string/device_identifier_access_restrictions_summary" />
-
- <SwitchPreference
android:key="notification_bubbles"
android:title="@string/notification_bubbles_title"
android:summary="@string/notification_bubbles_developer_setting_summary"/>
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 8e0db2f..aba95c8 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -480,7 +480,6 @@
controllers.add(new ResizableActivityPreferenceController(context));
controllers.add(new FreeformWindowsPreferenceController(context));
controllers.add(new DesktopModePreferenceController(context));
- controllers.add(new DeviceIdentifierAccessRestrictionsPreferenceController(context));
controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
controllers.add(new BubbleGlobalPreferenceController(context));
controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));
diff --git a/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java b/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java
deleted file mode 100644
index f4e5953..0000000
--- a/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.development;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.provider.DeviceConfig;
-import android.provider.Settings;
-
-import androidx.preference.Preference;
-import androidx.preference.SwitchPreference;
-
-import com.android.settings.Utils;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-public class DeviceIdentifierAccessRestrictionsPreferenceController
- extends DeveloperOptionsPreferenceController
- implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
-
- private static final String DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY =
- "device_identifier_access_restrictions";
-
- // The settings that should be set when the new device identifier access restrictions are
- // disabled.
- private static final String[] RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS = {
- Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_3P_CHECK_RELAXED,
- Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_NON_PRIV_CHECK_RELAXED,
- Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_PRIV_CHECK_RELAXED
- };
-
- private ContentResolver mContentResolver;
-
- public DeviceIdentifierAccessRestrictionsPreferenceController(Context context) {
- super(context);
- mContentResolver = context.getContentResolver();
- }
-
- @Override
- public boolean isAvailable() {
- // If the new access restrictions have been disabled from the server side then do not
- // display the option.
- boolean disabledFromServerSide = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
- Utils.PROPERTY_DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_DISABLED, false);
- return !disabledFromServerSide;
- }
-
- @Override
- public String getPreferenceKey() {
- return DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY;
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- writeSetting((boolean) newValue);
- return true;
- }
-
- private void writeSetting(boolean isEnabled) {
- for (String relaxCheckSetting : RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS) {
- Settings.Global.putInt(mContentResolver, relaxCheckSetting, isEnabled ? 1 : 0);
- }
- }
-
- @Override
- public void updateState(Preference preference) {
- boolean isEnabled = true;
- for (String relaxCheckSetting : RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS) {
- if (Settings.Global.getInt(mContentResolver, relaxCheckSetting, 0) == 0) {
- isEnabled = false;
- break;
- }
- }
- ((SwitchPreference) mPreference).setChecked(isEnabled);
- }
-
- @Override
- protected void onDeveloperOptionsSwitchDisabled() {
- super.onDeveloperOptionsSwitchDisabled();
- writeSetting(false);
- ((SwitchPreference) mPreference).setChecked(false);
- }
-}