Update language to comply with Android's inclusive language guidance

See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: Ia8625091a107fc3fb652d3ba3f75ea3cc1a8d9f5
This commit is contained in:
Edgar Wang
2020-08-06 21:13:41 +08:00
parent 232aaec569
commit a8742aa7ab
30 changed files with 95 additions and 96 deletions

View File

@@ -159,7 +159,7 @@ public class ApplicationFeatureProviderImpl implements ApplicationFeatureProvide
keepEnabledPackages.add(euicc.packageName);
}
keepEnabledPackages.addAll(getEnabledPackageWhitelist());
keepEnabledPackages.addAll(getEnabledPackageAllowlist());
final LocationManager locationManager =
(LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
@@ -170,7 +170,7 @@ public class ApplicationFeatureProviderImpl implements ApplicationFeatureProvide
return keepEnabledPackages;
}
private Set<String> getEnabledPackageWhitelist() {
private Set<String> getEnabledPackageAllowlist() {
final Set<String> keepEnabledPackages = new ArraySet<>();
// Keep Settings intelligence enabled, otherwise search feature will be disabled.

View File

@@ -142,7 +142,7 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
}
private void logNonConfigurableAppMetrics() {
if (!isCrossProfilePackageWhitelisted(mPackageName)) {
if (!isCrossProfilePackageAllowlisted(mPackageName)) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_ADMIN_RESTRICTED);
return;
}
@@ -382,7 +382,7 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
private boolean refreshUiForNonConfigurableApps() {
mSwitchPref.setChecked(false);
mSwitchPref.setTitle(R.string.interact_across_profiles_switch_disabled);
if (!isCrossProfilePackageWhitelisted(mPackageName)) {
if (!isCrossProfilePackageAllowlisted(mPackageName)) {
mInstallBanner.setVisible(false);
mSwitchPref.setDisabledByAdmin(RestrictedLockUtils.getProfileOrDeviceOwner(
mContext, mWorkProfile));
@@ -417,7 +417,7 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
return false;
}
private boolean isCrossProfilePackageWhitelisted(String packageName) {
private boolean isCrossProfilePackageAllowlisted(String packageName) {
return mContext.getSystemService(DevicePolicyManager.class)
.getAllCrossProfilePackages().contains(packageName);
}

View File

@@ -76,14 +76,14 @@ public class BugReportHandlerUtil {
int handlerUser = getCustomBugReportHandlerUser(context);
boolean needToResetOutdatedSettings = false;
if (!isBugreportWhitelistedApp(handlerApp)) {
if (!isBugreportAllowlistedApp(handlerApp)) {
handlerApp = getDefaultBugReportHandlerApp(context);
handlerUser = UserHandle.USER_SYSTEM;
} else if (getBugReportHandlerAppReceivers(context, handlerApp, handlerUser).isEmpty()) {
// It looks like the settings are outdated, need to reset outdated settings.
//
// i.e.
// If user chooses which profile and which bugreport-whitelisted app in that
// If user chooses which profile and which bugreport-allowlisted app in that
// profile to handle a bugreport, then user remove the profile.
// === RESULT ===
// The chosen bugreport handler app is outdated because the profile is removed,
@@ -93,7 +93,7 @@ public class BugReportHandlerUtil {
needToResetOutdatedSettings = true;
}
if (!isBugreportWhitelistedApp(handlerApp)
if (!isBugreportAllowlistedApp(handlerApp)
|| getBugReportHandlerAppReceivers(context, handlerApp, handlerUser).isEmpty()) {
// It looks like current handler app may be too old and doesn't support to handle a
// bugreport, so change to let shell to handle a bugreport and need to reset
@@ -136,7 +136,7 @@ public class BugReportHandlerUtil {
*/
public boolean setCurrentBugReportHandlerAppAndUser(Context context, String handlerApp,
int handlerUser) {
if (!isBugreportWhitelistedApp(handlerApp)) {
if (!isBugreportAllowlistedApp(handlerApp)) {
return false;
} else if (getBugReportHandlerAppReceivers(context, handlerApp, handlerUser).isEmpty()) {
return false;
@@ -155,17 +155,17 @@ public class BugReportHandlerUtil {
public List<Pair<ApplicationInfo, Integer>> getValidBugReportHandlerInfos(Context context) {
final List<Pair<ApplicationInfo, Integer>> validBugReportHandlerApplicationInfos =
new ArrayList<>();
List<String> bugreportWhitelistedPackages;
List<String> bugreportAllowlistedPackages;
try {
bugreportWhitelistedPackages =
bugreportAllowlistedPackages =
ActivityManager.getService().getBugreportWhitelistedPackages();
} catch (RemoteException e) {
Log.e(TAG, "Failed to get bugreportWhitelistedPackages:", e);
Log.e(TAG, "Failed to get bugreportAllowlistedPackages:", e);
return validBugReportHandlerApplicationInfos;
}
// Add "Shell with system user" as System default preference on top of screen
if (bugreportWhitelistedPackages.contains(SHELL_APP_PACKAGE)
if (bugreportAllowlistedPackages.contains(SHELL_APP_PACKAGE)
&& !getBugReportHandlerAppReceivers(context, SHELL_APP_PACKAGE,
UserHandle.USER_SYSTEM).isEmpty()) {
try {
@@ -181,7 +181,7 @@ public class BugReportHandlerUtil {
final UserManager userManager = context.getSystemService(UserManager.class);
final List<UserInfo> profileList = userManager.getProfiles(UserHandle.getCallingUserId());
// Only add non-Shell app as normal preference
final List<String> nonShellPackageList = bugreportWhitelistedPackages.stream()
final List<String> nonShellPackageList = bugreportAllowlistedPackages.stream()
.filter(pkg -> !SHELL_APP_PACKAGE.equals(pkg)).collect(Collectors.toList());
Collections.sort(nonShellPackageList);
for (String pkg : nonShellPackageList) {
@@ -202,15 +202,15 @@ public class BugReportHandlerUtil {
return validBugReportHandlerApplicationInfos;
}
private boolean isBugreportWhitelistedApp(String app) {
// Verify the app is bugreport-whitelisted
private boolean isBugreportAllowlistedApp(String app) {
// Verify the app is bugreport-allowlisted
if (TextUtils.isEmpty(app)) {
return false;
}
try {
return ActivityManager.getService().getBugreportWhitelistedPackages().contains(app);
} catch (RemoteException e) {
Log.e(TAG, "Failed to get bugreportWhitelistedPackages:", e);
Log.e(TAG, "Failed to get bugreportAllowlistedPackages:", e);
return false;
}
}

View File

@@ -55,7 +55,7 @@ public class SettingsBaseActivity extends FragmentActivity {
// Serves as a temporary list of tiles to ignore until we heard back from the PM that they
// are disabled.
private static ArraySet<ComponentName> sTileBlacklist = new ArraySet<>();
private static ArraySet<ComponentName> sTileDenylist = new ArraySet<>();
private final PackageReceiver mPackageReceiver = new PackageReceiver();
private final List<CategoryListener> mCategoryListeners = new ArrayList<>();
@@ -177,9 +177,9 @@ public class SettingsBaseActivity extends FragmentActivity {
boolean isEnabled = state == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
if (isEnabled != enabled || state == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) {
if (enabled) {
sTileBlacklist.remove(component);
sTileDenylist.remove(component);
} else {
sTileBlacklist.add(component);
sTileDenylist.add(component);
}
pm.setComponentEnabledSetting(component, enabled
? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
@@ -217,7 +217,7 @@ public class SettingsBaseActivity extends FragmentActivity {
@Override
protected void onPostExecute(Void result) {
mCategoryManager.updateCategoryFromBlacklist(sTileBlacklist);
mCategoryManager.updateCategoryFromDenylist(sTileDenylist);
onCategoriesChanged();
}
}

View File

@@ -85,15 +85,19 @@ public class CategoryManager {
tryInitCategories(context, forceClearCache);
}
public synchronized void updateCategoryFromBlacklist(Set<ComponentName> tileBlacklist) {
/**
* Update category from deny list
* @param tileDenylist
*/
public synchronized void updateCategoryFromDenylist(Set<ComponentName> tileDenylist) {
if (mCategories == null) {
Log.w(TAG, "Category is null, skipping blacklist update");
Log.w(TAG, "Category is null, skipping denylist update");
}
for (int i = 0; i < mCategories.size(); i++) {
DashboardCategory category = mCategories.get(i);
for (int j = 0; j < category.getTilesCount(); j++) {
Tile tile = category.getTile(j);
if (tileBlacklist.contains(tile.getIntent().getComponent())) {
if (tileDenylist.contains(tile.getIntent().getComponent())) {
category.removeTile(j--);
}
}

View File

@@ -175,7 +175,7 @@ public class UnrestrictedDataAccessPreference extends AppSwitchPreference implem
if (isDisabledByAdmin()) {
setSummary(R.string.disabled_by_admin);
} else if (mDataUsageState.isDataSaverDenylisted) {
setSummary(R.string.restrict_background_blacklisted);
setSummary(R.string.restrict_background_blocklisted);
} else {
setSummary("");
}

View File

@@ -118,7 +118,7 @@ public class BackgroundActivityPreferenceController extends AbstractPreferenceCo
public void updateSummary(Preference preference) {
if (mPowerAllowlistBackend.isAllowlisted(mTargetPackage)) {
preference.setSummary(R.string.background_activity_summary_whitelisted);
preference.setSummary(R.string.background_activity_summary_allowlisted);
return;
}
final int mode = mAppOpsManager

View File

@@ -391,11 +391,11 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
}
private boolean shouldShowSummary(BatterySipper sipper) {
final CharSequence[] whitelistPackages = mContext.getResources()
.getTextArray(R.array.whitelist_hide_summary_in_battery_usage);
final CharSequence[] allowlistPackages = mContext.getResources()
.getTextArray(R.array.allowlist_hide_summary_in_battery_usage);
final String target = sipper.packageWithHighestDrain;
for (CharSequence packageName: whitelistPackages) {
for (CharSequence packageName: allowlistPackages) {
if (TextUtils.equals(target, packageName)) {
return false;
}

View File

@@ -306,7 +306,7 @@ public class PanelFragment extends Fragment {
* Watching for the {@link Slice} to load.
* <p>
* If the Slice comes back {@code null} or with the Error attribute, if slice
* uri is not in the whitelist, remove the Slice data from the list, otherwise
* uri is not in the allowlist, remove the Slice data from the list, otherwise
* keep the Slice data.
* <p>
* If the Slice has come back fully loaded, then mark the Slice as loaded. No
@@ -337,10 +337,10 @@ public class PanelFragment extends Fragment {
}
private void removeSliceLiveData(Uri uri) {
final List<String> whiteList = Arrays.asList(
final List<String> allowList = Arrays.asList(
getResources().getStringArray(
R.array.config_panel_keep_observe_uri));
if (!whiteList.contains(uri.toString())) {
if (!allowList.contains(uri.toString())) {
mSliceLiveData.remove(uri);
}
}

View File

@@ -45,13 +45,13 @@ public class SearchFeatureProviderImpl implements SearchFeatureProvider {
final String packageName = caller.getPackageName();
final boolean isSettingsPackage = TextUtils.equals(packageName, context.getPackageName())
|| TextUtils.equals(getSettingsIntelligencePkgName(context), packageName);
final boolean isWhitelistedPackage =
final boolean isAllowlistedPackage =
isSignatureAllowlisted(context, caller.getPackageName());
if (isSettingsPackage || isWhitelistedPackage) {
if (isSettingsPackage || isAllowlistedPackage) {
return;
}
throw new SecurityException("Search result intents must be called with from a "
+ "whitelisted package.");
+ "allowlisted package.");
}
@Override

View File

@@ -328,7 +328,7 @@ public class SettingsSliceProvider extends SliceProvider {
.collect(Collectors.toList());
descendants.addAll(customSlices);
}
grantWhitelistedPackagePermissions(getContext(), descendants);
grantAllowlistedPackagePermissions(getContext(), descendants);
return descendants;
}
@@ -344,23 +344,23 @@ public class SettingsSliceProvider extends SliceProvider {
}
@VisibleForTesting
static void grantWhitelistedPackagePermissions(Context context, List<Uri> descendants) {
static void grantAllowlistedPackagePermissions(Context context, List<Uri> descendants) {
if (descendants == null) {
Log.d(TAG, "No descendants to grant permission with, skipping.");
}
final String[] whitelistPackages =
context.getResources().getStringArray(R.array.slice_whitelist_package_names);
if (whitelistPackages == null || whitelistPackages.length == 0) {
Log.d(TAG, "No packages to whitelist, skipping.");
final String[] allowlistPackages =
context.getResources().getStringArray(R.array.slice_allowlist_package_names);
if (allowlistPackages == null || allowlistPackages.length == 0) {
Log.d(TAG, "No packages to allowlist, skipping.");
return;
} else {
Log.d(TAG, String.format(
"Whitelisting %d uris to %d pkgs.",
descendants.size(), whitelistPackages.length));
"Allowlisting %d uris to %d pkgs.",
descendants.size(), allowlistPackages.length));
}
final SliceManager sliceManager = context.getSystemService(SliceManager.class);
for (Uri descendant : descendants) {
for (String toPackage : whitelistPackages) {
for (String toPackage : allowlistPackages) {
sliceManager.grantSlicePermission(toPackage, descendant);
}
}

View File

@@ -167,7 +167,7 @@ public class AppDialogFragment extends InstrumentedDialogFragment implements App
try {
if (mPackageInfo.packageName.equals(VpnUtils.getConnectedPackage(mService, userId))) {
mService.setAlwaysOnVpnPackage(userId, null, /* lockdownEnabled */ false,
/* lockdownWhitelist */ null);
/* lockdownAllowlist */ null);
mService.prepareVpn(mPackageInfo.packageName, VpnConfig.LEGACY_VPN, userId);
}
} catch (RemoteException e) {

View File

@@ -231,7 +231,7 @@ public class AppManagementFragment extends SettingsPreferenceFragment
private boolean setAlwaysOnVpn(boolean isEnabled, boolean isLockdown) {
return mConnectivityManager.setAlwaysOnVpnPackageForUser(mUserId,
isEnabled ? mPackageName : null, isLockdown, /* lockdownWhitelist */ null);
isEnabled ? mPackageName : null, isLockdown, /* lockdownAllowlist */ null);
}
private void updateUI() {

View File

@@ -180,7 +180,7 @@ public class ConfigDialogFragment extends InstrumentedDialogFragment implements
final ConnectivityManager conn = ConnectivityManager.from(mContext);
conn.setAlwaysOnVpnPackageForUser(UserHandle.myUserId(), null,
/* lockdownEnabled */ false, /* lockdownWhitelist */ null);
/* lockdownEnabled */ false, /* lockdownAllowlist */ null);
VpnUtils.setLockdownVpn(mContext, profile.key);
} else {
// update only if lockdown vpn has been changed