Implement development UI for background check.

Allows you to toggle off full background access for
whatever apps you want.

Change-Id: I8542ecac1449ccd65dc18af3c0ca1fc18443f89c
This commit is contained in:
Dianne Hackborn
2015-12-07 16:36:09 -08:00
parent 70b49b1b70
commit f467c0acac
11 changed files with 253 additions and 16 deletions

View File

@@ -76,6 +76,7 @@ import android.widget.Switch;
import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.applications.BackgroundCheckSummary;
import com.android.settings.fuelgauge.InactiveApps;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
@@ -170,6 +171,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
= "immediately_destroy_activities";
private static final String APP_PROCESS_LIMIT_KEY = "app_process_limit";
private static final String BACKGROUND_CHECK_KEY = "background_check";
private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
@@ -1718,6 +1721,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
writeForceResizableOptions();
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
startInactiveAppsFragment();
} else if (BACKGROUND_CHECK_KEY.equals(preference.getKey())) {
startBackgroundCheckFragment();
} else {
return super.onPreferenceTreeClick(preference);
}
@@ -1731,6 +1736,12 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
null, R.string.inactive_apps_title, null, null, 0);
}
private void startBackgroundCheckFragment() {
((SettingsActivity) getActivity()).startPreferencePanel(
BackgroundCheckSummary.class.getName(),
null, R.string.background_check_title, null, null, 0);
}
private boolean showKeyguardConfirmation(Resources resources, int requestCode) {
return new ChooseLockSettingsHelper(getActivity(), this).launchConfirmationActivity(
requestCode, resources.getString(R.string.oem_unlock_enable));