Update language to comply with Android's inclusive language guidance

Refactor PowerWhitelistBackend to PowerAllowlistBackend
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: I3d56e6dac1515b49a89f59c34edf403ecb891420
This commit is contained in:
Edgar Wang
2020-08-03 14:02:24 +08:00
parent 867e9db69d
commit f480c1c3fc
16 changed files with 159 additions and 207 deletions

View File

@@ -21,20 +21,20 @@ import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.applications.ApplicationsState.AppFilter;
import com.android.settingslib.applications.ApplicationsState.CompoundFilter;
import com.android.settingslib.fuelgauge.PowerWhitelistBackend;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
import java.util.ArrayList;
/**
* Connects data from the PowerWhitelistBackend to ApplicationsState.
* Connects data from the PowerAllowlistBackend to ApplicationsState.
*/
public class AppStatePowerBridge extends AppStateBaseBridge {
private final PowerWhitelistBackend mBackend;
private final PowerAllowlistBackend mBackend;
public AppStatePowerBridge(Context context, ApplicationsState appState, Callback callback) {
super(appState, callback);
mBackend = PowerWhitelistBackend.getInstance(context);
mBackend = PowerAllowlistBackend.getInstance(context);
}
@Override
@@ -43,17 +43,17 @@ public class AppStatePowerBridge extends AppStateBaseBridge {
final int N = apps.size();
for (int i = 0; i < N; i++) {
AppEntry app = apps.get(i);
app.extraInfo = mBackend.isWhitelisted(app.info.packageName)
app.extraInfo = mBackend.isAllowlisted(app.info.packageName)
? Boolean.TRUE : Boolean.FALSE;
}
}
@Override
protected void updateExtraInfo(AppEntry app, String pkg, int uid) {
app.extraInfo = mBackend.isWhitelisted(pkg) ? Boolean.TRUE : Boolean.FALSE;
app.extraInfo = mBackend.isAllowlisted(pkg) ? Boolean.TRUE : Boolean.FALSE;
}
public static final AppFilter FILTER_POWER_WHITELISTED = new CompoundFilter(
public static final AppFilter FILTER_POWER_ALLOWLISTED = new CompoundFilter(
ApplicationsState.FILTER_WITHOUT_DISABLED_UNTIL_USED, new AppFilter() {
@Override
public void init() {

View File

@@ -35,8 +35,8 @@ import com.android.settingslib.applications.ApplicationsState;
public class AppFilterRegistry {
@IntDef(value = {
FILTER_APPS_POWER_WHITELIST,
FILTER_APPS_POWER_WHITELIST_ALL,
FILTER_APPS_POWER_ALLOWLIST,
FILTER_APPS_POWER_ALLOWLIST_ALL,
FILTER_APPS_ALL,
FILTER_APPS_ENABLED,
FILTER_APPS_INSTANT,
@@ -56,8 +56,8 @@ public class AppFilterRegistry {
// Filter options used for displayed list of applications
// Filters will appear sorted based on their value defined here.
public static final int FILTER_APPS_POWER_WHITELIST = 0;
public static final int FILTER_APPS_POWER_WHITELIST_ALL = 1;
public static final int FILTER_APPS_POWER_ALLOWLIST = 0;
public static final int FILTER_APPS_POWER_ALLOWLIST_ALL = 1;
public static final int FILTER_APPS_RECENT = 2;
public static final int FILTER_APPS_FREQUENT = 3;
public static final int FILTER_APPS_ALL = 4;
@@ -82,20 +82,20 @@ public class AppFilterRegistry {
private AppFilterRegistry() {
mFilters = new AppFilterItem[18];
// High power whitelist, on
mFilters[FILTER_APPS_POWER_WHITELIST] = new AppFilterItem(
// High power allowlist, on
mFilters[FILTER_APPS_POWER_ALLOWLIST] = new AppFilterItem(
new ApplicationsState.CompoundFilter(
AppStatePowerBridge.FILTER_POWER_WHITELISTED,
AppStatePowerBridge.FILTER_POWER_ALLOWLISTED,
ApplicationsState.FILTER_ALL_ENABLED),
FILTER_APPS_POWER_WHITELIST,
FILTER_APPS_POWER_ALLOWLIST,
R.string.high_power_filter_on);
// Without disabled until used
mFilters[FILTER_APPS_POWER_WHITELIST_ALL] = new AppFilterItem(
mFilters[FILTER_APPS_POWER_ALLOWLIST_ALL] = new AppFilterItem(
new ApplicationsState.CompoundFilter(
ApplicationsState.FILTER_WITHOUT_DISABLED_UNTIL_USED,
ApplicationsState.FILTER_ALL_ENABLED),
FILTER_APPS_POWER_WHITELIST_ALL,
FILTER_APPS_POWER_ALLOWLIST_ALL,
R.string.filter_all_apps);
// All apps
@@ -200,7 +200,7 @@ public class AppFilterRegistry {
case ManageApplications.LIST_TYPE_USAGE_ACCESS:
return FILTER_APPS_USAGE_ACCESS;
case ManageApplications.LIST_TYPE_HIGH_POWER:
return FILTER_APPS_POWER_WHITELIST;
return FILTER_APPS_POWER_ALLOWLIST;
case ManageApplications.LIST_TYPE_OVERLAY:
return FILTER_APPS_WITH_OVERLAY;
case ManageApplications.LIST_TYPE_WRITE_SETTINGS:

View File

@@ -25,8 +25,8 @@ import static com.android.settings.applications.manageapplications.AppFilterRegi
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_FREQUENT;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_INSTANT;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_PERSONAL;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_POWER_WHITELIST;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_POWER_WHITELIST_ALL;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_POWER_ALLOWLIST;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_POWER_ALLOWLIST_ALL;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_RECENT;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_WORK;
import static com.android.settings.search.actionbar.SearchMenuController.MENU_SEARCH;
@@ -125,7 +125,7 @@ import com.android.settingslib.applications.ApplicationsState.AppFilter;
import com.android.settingslib.applications.ApplicationsState.CompoundFilter;
import com.android.settingslib.applications.ApplicationsState.VolumeFilter;
import com.android.settingslib.applications.StorageStatsSource;
import com.android.settingslib.fuelgauge.PowerWhitelistBackend;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
import com.android.settingslib.utils.ThreadUtils;
import com.android.settingslib.widget.settingsspinner.SettingsSpinnerAdapter;
@@ -479,7 +479,7 @@ public class ManageApplications extends InstrumentedFragment
mFilterAdapter.enableFilter(FILTER_APPS_ALL);
}
if (mListType == LIST_TYPE_HIGH_POWER) {
mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL);
mFilterAdapter.enableFilter(FILTER_APPS_POWER_ALLOWLIST_ALL);
}
setCompositeFilter();
@@ -1011,7 +1011,7 @@ public class ManageApplications extends InstrumentedFragment
private boolean mHasReceivedBridgeCallback;
private FileViewHolderController mExtraViewController;
private SearchFilter mSearchFilter;
private PowerWhitelistBackend mBackend;
private PowerAllowlistBackend mBackend;
// This is to remember and restore the last scroll position when this
// fragment is paused. We need this special handling because app entries are added gradually
@@ -1036,7 +1036,7 @@ public class ManageApplications extends InstrumentedFragment
mContext = manageApplications.getActivity();
mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
mAppFilter = appFilter;
mBackend = PowerWhitelistBackend.getInstance(mContext);
mBackend = PowerAllowlistBackend.getInstance(mContext);
if (mManageApplications.mListType == LIST_TYPE_NOTIFICATION) {
mExtraInfoBridge = new AppStateNotificationBridge(mContext, mState, this,
manageApplications.mUsageStatsManager,
@@ -1292,8 +1292,8 @@ public class ManageApplications extends InstrumentedFragment
Log.d(TAG, "onRebuildComplete size=" + entries.size());
}
final int filterType = mAppFilter.getFilterType();
if (filterType == FILTER_APPS_POWER_WHITELIST ||
filterType == FILTER_APPS_POWER_WHITELIST_ALL) {
if (filterType == FILTER_APPS_POWER_ALLOWLIST
|| filterType == FILTER_APPS_POWER_ALLOWLIST_ALL) {
entries = removeDuplicateIgnoringUser(entries);
}
mEntries = entries;
@@ -1451,7 +1451,7 @@ public class ManageApplications extends InstrumentedFragment
}
ApplicationsState.AppEntry entry = mEntries.get(position);
return !mBackend.isSysWhitelisted(entry.info.packageName)
return !mBackend.isSysAllowlisted(entry.info.packageName)
&& !mBackend.isDefaultActiveApp(entry.info.packageName);
}

View File

@@ -33,7 +33,7 @@ import com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip;
import com.android.settings.fuelgauge.batterytip.tips.UnrestrictAppTip;
import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.fuelgauge.PowerWhitelistBackend;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
/**
* Controller to control whether an app can run in the background
@@ -54,18 +54,18 @@ public class BackgroundActivityPreferenceController extends AbstractPreferenceCo
BatteryUtils mBatteryUtils;
private InstrumentedPreferenceFragment mFragment;
private String mTargetPackage;
private PowerWhitelistBackend mPowerWhitelistBackend;
private PowerAllowlistBackend mPowerAllowlistBackend;
public BackgroundActivityPreferenceController(Context context,
InstrumentedPreferenceFragment fragment, int uid, String packageName) {
this(context, fragment, uid, packageName, PowerWhitelistBackend.getInstance(context));
this(context, fragment, uid, packageName, PowerAllowlistBackend.getInstance(context));
}
@VisibleForTesting
BackgroundActivityPreferenceController(Context context, InstrumentedPreferenceFragment fragment,
int uid, String packageName, PowerWhitelistBackend backend) {
int uid, String packageName, PowerAllowlistBackend backend) {
super(context);
mPowerWhitelistBackend = backend;
mPowerAllowlistBackend = backend;
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
mDpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
@@ -84,8 +84,8 @@ public class BackgroundActivityPreferenceController extends AbstractPreferenceCo
}
final int mode = mAppOpsManager
.checkOpNoThrow(AppOpsManager.OP_RUN_ANY_IN_BACKGROUND, mUid, mTargetPackage);
final boolean whitelisted = mPowerWhitelistBackend.isWhitelisted(mTargetPackage);
if (whitelisted || mode == AppOpsManager.MODE_ERRORED
final boolean allowlisted = mPowerAllowlistBackend.isAllowlisted(mTargetPackage);
if (allowlisted || mode == AppOpsManager.MODE_ERRORED
|| Utils.isProfileOrDeviceOwner(mUserManager, mDpm, mTargetPackage)) {
preference.setEnabled(false);
} else {
@@ -117,7 +117,7 @@ public class BackgroundActivityPreferenceController extends AbstractPreferenceCo
}
public void updateSummary(Preference preference) {
if (mPowerWhitelistBackend.isWhitelisted(mTargetPackage)) {
if (mPowerAllowlistBackend.isAllowlisted(mTargetPackage)) {
preference.setSummary(R.string.background_activity_summary_whitelisted);
return;
}

View File

@@ -27,7 +27,7 @@ import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.fuelgauge.PowerWhitelistBackend;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
/**
* Controller that jumps to high power optimization fragment
@@ -38,7 +38,7 @@ public class BatteryOptimizationPreferenceController extends AbstractPreferenceC
private static final String KEY_BACKGROUND_ACTIVITY = "battery_optimization";
private PowerWhitelistBackend mBackend;
private PowerAllowlistBackend mBackend;
private DashboardFragment mFragment;
private SettingsActivity mSettingsActivity;
private String mPackageName;
@@ -49,12 +49,12 @@ public class BatteryOptimizationPreferenceController extends AbstractPreferenceC
mFragment = fragment;
mSettingsActivity = settingsActivity;
mPackageName = packageName;
mBackend = PowerWhitelistBackend.getInstance(mSettingsActivity);
mBackend = PowerAllowlistBackend.getInstance(mSettingsActivity);
}
@VisibleForTesting
BatteryOptimizationPreferenceController(SettingsActivity settingsActivity,
DashboardFragment fragment, String packageName, PowerWhitelistBackend backend) {
DashboardFragment fragment, String packageName, PowerAllowlistBackend backend) {
super(settingsActivity);
mFragment = fragment;
mSettingsActivity = settingsActivity;
@@ -69,8 +69,8 @@ public class BatteryOptimizationPreferenceController extends AbstractPreferenceC
@Override
public void updateState(Preference preference) {
final boolean isWhitelisted = mBackend.isWhitelisted(mPackageName);
preference.setSummary(isWhitelisted ? R.string.high_power_on : R.string.high_power_off);
final boolean isAllowlisted = mBackend.isAllowlisted(mPackageName);
preference.setSummary(isAllowlisted ? R.string.high_power_on : R.string.high_power_off);
}
@Override

View File

@@ -50,7 +50,7 @@ import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.fuelgauge.Estimate;
import com.android.settingslib.fuelgauge.EstimateKt;
import com.android.settingslib.fuelgauge.PowerWhitelistBackend;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
import com.android.settingslib.utils.PowerUtil;
import com.android.settingslib.utils.ThreadUtils;
@@ -578,7 +578,7 @@ public class BatteryUtils {
/**
* Return {@code true} if we should hide anomaly app represented by {@code uid}
*/
public boolean shouldHideAnomaly(PowerWhitelistBackend powerWhitelistBackend, int uid,
public boolean shouldHideAnomaly(PowerAllowlistBackend powerAllowlistBackend, int uid,
AnomalyInfo anomalyInfo) {
final String[] packageNames = mPackageManager.getPackagesForUid(uid);
if (ArrayUtils.isEmpty(packageNames)) {
@@ -586,7 +586,7 @@ public class BatteryUtils {
return true;
}
return isSystemUid(uid) || powerWhitelistBackend.isWhitelisted(packageNames)
return isSystemUid(uid) || powerAllowlistBackend.isAllowlisted(packageNames)
|| (isSystemApp(mPackageManager, packageNames) && !hasLauncherEntry(packageNames))
|| (isExcessiveBackgroundAnomaly(anomalyInfo) && !isPreOApp(packageNames));
}

View File

@@ -38,7 +38,7 @@ import com.android.settings.applications.AppInfoBase;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.fuelgauge.PowerWhitelistBackend;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
public class HighPowerDetail extends InstrumentedDialogFragment implements OnClickListener,
View.OnClickListener {
@@ -46,7 +46,7 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
private static final String ARG_DEFAULT_ON = "default_on";
@VisibleForTesting
PowerWhitelistBackend mBackend;
PowerAllowlistBackend mBackend;
@VisibleForTesting
BatteryUtils mBatteryUtils;
@VisibleForTesting
@@ -70,7 +70,7 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
super.onCreate(savedInstanceState);
final Context context = getContext();
mBatteryUtils = BatteryUtils.getInstance(context);
mBackend = PowerWhitelistBackend.getInstance(context);
mBackend = PowerAllowlistBackend.getInstance(context);
mPackageName = getArguments().getString(AppInfoBase.ARG_PACKAGE_NAME);
mPackageUid = getArguments().getInt(AppInfoBase.ARG_PACKAGE_UID);
@@ -81,7 +81,7 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
mLabel = mPackageName;
}
mDefaultOn = getArguments().getBoolean(ARG_DEFAULT_ON);
mIsEnabled = mDefaultOn || mBackend.isWhitelisted(mPackageName);
mIsEnabled = mDefaultOn || mBackend.isAllowlisted(mPackageName);
}
public Checkable setup(View view, boolean on) {
@@ -91,7 +91,7 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
? R.string.ignore_optimizations_on_desc : R.string.ignore_optimizations_off_desc);
view.setClickable(true);
view.setOnClickListener(this);
if (!on && mBackend.isSysWhitelisted(mPackageName)) {
if (!on && mBackend.isSysAllowlisted(mPackageName)) {
view.setEnabled(false);
}
return (Checkable) view;
@@ -103,7 +103,7 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
.setTitle(mLabel)
.setNegativeButton(R.string.cancel, null)
.setView(R.layout.ignore_optimizations_content);
if (!mBackend.isSysWhitelisted(mPackageName)) {
if (!mBackend.isSysAllowlisted(mPackageName)) {
b.setPositiveButton(R.string.done, this);
}
return b.create();
@@ -137,7 +137,7 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
boolean newValue = mIsEnabled;
boolean oldValue = mBackend.isWhitelisted(mPackageName);
boolean oldValue = mBackend.isAllowlisted(mPackageName);
if (newValue != oldValue) {
logSpecialPermissionChange(newValue, mPackageName, getContext());
if (newValue) {
@@ -152,8 +152,8 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
}
@VisibleForTesting
static void logSpecialPermissionChange(boolean whitelist, String packageName, Context context) {
int logCategory = whitelist ? SettingsEnums.APP_SPECIAL_PERMISSION_BATTERY_DENY
static void logSpecialPermissionChange(boolean allowlist, String packageName, Context context) {
int logCategory = allowlist ? SettingsEnums.APP_SPECIAL_PERMISSION_BATTERY_DENY
: SettingsEnums.APP_SPECIAL_PERMISSION_BATTERY_ALLOW;
FeatureFactory.getFactory(context).getMetricsFeatureProvider().action(context, logCategory,
packageName);
@@ -173,16 +173,16 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
}
public static CharSequence getSummary(Context context, String pkg) {
return getSummary(context, PowerWhitelistBackend.getInstance(context), pkg);
return getSummary(context, PowerAllowlistBackend.getInstance(context), pkg);
}
@VisibleForTesting
static CharSequence getSummary(Context context, PowerWhitelistBackend powerWhitelist,
static CharSequence getSummary(Context context, PowerAllowlistBackend powerAllowlist,
String pkg) {
return context.getString(
powerWhitelist.isSysWhitelisted(pkg) || powerWhitelist.isDefaultActiveApp(pkg)
powerAllowlist.isSysAllowlisted(pkg) || powerAllowlist.isDefaultActiveApp(pkg)
? R.string.high_power_system
: powerWhitelist.isWhitelisted(pkg)
: powerAllowlist.isAllowlisted(pkg)
? R.string.high_power_on
: R.string.high_power_off);
}

View File

@@ -46,7 +46,7 @@ import com.android.settings.fuelgauge.BatteryUtils;
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.fuelgauge.PowerWhitelistBackend;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
import com.android.settingslib.utils.ThreadUtils;
import java.util.ArrayList;
@@ -96,8 +96,8 @@ public class AnomalyDetectionJobService extends JobService {
final BatteryUtils batteryUtils = BatteryUtils.getInstance(this);
final ContentResolver contentResolver = getContentResolver();
final UserManager userManager = getSystemService(UserManager.class);
final PowerWhitelistBackend powerWhitelistBackend =
PowerWhitelistBackend.getInstance(context);
final PowerAllowlistBackend powerAllowlistBackend =
PowerAllowlistBackend.getInstance(context);
final PowerUsageFeatureProvider powerUsageFeatureProvider = FeatureFactory
.getFactory(this).getPowerUsageFeatureProvider(this);
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory
@@ -105,7 +105,7 @@ public class AnomalyDetectionJobService extends JobService {
for (JobWorkItem item = dequeueWork(params); item != null; item = dequeueWork(params)) {
saveAnomalyToDatabase(context, userManager,
batteryDatabaseManager, batteryUtils, policy, powerWhitelistBackend,
batteryDatabaseManager, batteryUtils, policy, powerAllowlistBackend,
contentResolver, powerUsageFeatureProvider, metricsFeatureProvider,
item.getIntent().getExtras());
@@ -127,7 +127,7 @@ public class AnomalyDetectionJobService extends JobService {
@VisibleForTesting
void saveAnomalyToDatabase(Context context, UserManager userManager,
BatteryDatabaseManager databaseManager, BatteryUtils batteryUtils,
BatteryTipPolicy policy, PowerWhitelistBackend powerWhitelistBackend,
BatteryTipPolicy policy, PowerAllowlistBackend powerAllowlistBackend,
ContentResolver contentResolver, PowerUsageFeatureProvider powerUsageFeatureProvider,
MetricsFeatureProvider metricsFeatureProvider, Bundle bundle) {
// The Example of intentDimsValue is: 35:{1:{1:{1:10013|}|}|}
@@ -151,7 +151,7 @@ public class AnomalyDetectionJobService extends JobService {
final String packageName = batteryUtils.getPackageName(uid);
final long versionCode = batteryUtils.getAppLongVersionCode(packageName);
final String versionedPackage = packageName + "/" + versionCode;
if (batteryUtils.shouldHideAnomaly(powerWhitelistBackend, uid, anomalyInfo)) {
if (batteryUtils.shouldHideAnomaly(powerAllowlistBackend, uid, anomalyInfo)) {
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN,
SettingsEnums.ACTION_ANOMALY_IGNORED,
SettingsEnums.PAGE_UNKNOWN,

View File

@@ -393,7 +393,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
p.setChecked(false);
p.setTitle(app.activityName);
p.setKey(getKeyForPackage(packageName));
p.setSettingsEnabled(hasSettings && app.masterEntry == null);
p.setSettingsEnabled(hasSettings && app.primaryEntry == null);
p.setPersistent(false);
p.setOnPreferenceChangeListener(this);
p.setOnPreferenceClickListener(this);
@@ -407,13 +407,13 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
// able to toggle this app ON (it's ON by default and immutable).
// Only do this for restricted profiles, not single-user restrictions
// Also don't do this for secondary icons
if (app.masterEntry == null) {
if (app.primaryEntry == null) {
requestRestrictionsForApp(packageName, p, false);
}
} else if (!mNewUser && isAppEnabledForUser(pi)) {
p.setChecked(true);
}
if (app.masterEntry != null) {
if (app.primaryEntry != null) {
p.setImmutable(true);
p.setChecked(mHelper.isPackageSelected(packageName));
}
@@ -436,13 +436,13 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
// - Secondary entry that cannot see primary user accounts
// - Primary entry that can see primary user accounts
// Otherwise no summary is returned
if (app.masterEntry != null) {
if (app.primaryEntry != null) {
if (mRestrictedProfile && pi.restrictedAccountType != null) {
return getString(R.string.app_sees_restricted_accounts_and_controlled_by,
app.masterEntry.activityName);
app.primaryEntry.activityName);
}
return getString(R.string.user_restrictions_controlled_by,
app.masterEntry.activityName);
app.primaryEntry.activityName);
} else if (pi.restrictedAccountType != null) {
return getString(R.string.app_sees_restricted_accounts);
}