Disable managed services special access screens...

... on low ram devices.

- Remove them from the 'Special app access' screen
- Display an error message if an app intents directly to
them

Bug: 35219985
Test: visual, and runtest --path ManagedAccessSettingsLowRamTest.java,
when the device is in low ram mode and when it's not.
Change-Id: Ied919cb248ae56683a00e3492c4737dfd00449ac
This commit is contained in:
Julia Reynolds
2017-06-21 14:19:46 -04:00
parent 49b5de942e
commit 559bd3651e
10 changed files with 178 additions and 17 deletions

View File

@@ -14,8 +14,11 @@
package com.android.settings.applications;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.support.v7.preference.Preference;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
@@ -31,6 +34,9 @@ public class SpecialAccessSettings extends DashboardFragment {
private static final String TAG = "SpecialAccessSettings";
private static final String[] DISABLED_FEATURES_LOW_RAM =
new String[] {"notification_access", "zen_access", "enabled_vr_listeners"};
@Override
protected String getLogTag() {
return TAG;
@@ -41,6 +47,20 @@ public class SpecialAccessSettings extends DashboardFragment {
return R.xml.special_access;
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
if (ActivityManager.isLowRamDeviceStatic()) {
for (String disabledFeature : DISABLED_FEATURES_LOW_RAM) {
Preference pref = findPreference(disabledFeature);
if (pref != null) {
removePreference(disabledFeature);
}
}
}
}
@Override
protected List<PreferenceController> getPreferenceControllers(Context context) {
return null;