Remove developer option to disable device ID access restrictions

Bug: 123937881
Test: Manually verified developer option is no longer available.
Change-Id: I00e8db23d88a5c84e273dfa4b8f797fa2a995de0
This commit is contained in:
Michael Groover
2019-06-04 17:32:59 -07:00
parent 3d9c7cb356
commit 2123e3543c
4 changed files with 0 additions and 107 deletions

View File

@@ -6079,10 +6079,6 @@
<string name="sms_access_restriction_enabled">Restrict SMS &amp; call log access</string> <string name="sms_access_restriction_enabled">Restrict SMS &amp; call log access</string>
<!-- Summary for whether to enable SMS access restriction [CHAR LIMIT=NONE]--> <!-- 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 &amp; call log permissions</string> <string name="sms_access_restriction_enabled_summary">Only default phone and messaging apps have SMS &amp; 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 --> <!-- Message when there are no available trust agents to display -->

View File

@@ -561,11 +561,6 @@
android:title="@string/sms_access_restriction_enabled" android:title="@string/sms_access_restriction_enabled"
android:summary="@string/sms_access_restriction_enabled_summary" /> 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 <SwitchPreference
android:key="notification_bubbles" android:key="notification_bubbles"
android:title="@string/notification_bubbles_title" android:title="@string/notification_bubbles_title"

View File

@@ -480,7 +480,6 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
controllers.add(new ResizableActivityPreferenceController(context)); controllers.add(new ResizableActivityPreferenceController(context));
controllers.add(new FreeformWindowsPreferenceController(context)); controllers.add(new FreeformWindowsPreferenceController(context));
controllers.add(new DesktopModePreferenceController(context)); controllers.add(new DesktopModePreferenceController(context));
controllers.add(new DeviceIdentifierAccessRestrictionsPreferenceController(context));
controllers.add(new ShortcutManagerThrottlingPreferenceController(context)); controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
controllers.add(new BubbleGlobalPreferenceController(context)); controllers.add(new BubbleGlobalPreferenceController(context));
controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context)); controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));

View File

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