Merge "Update language to comply with Android’s inclusive language guidance" into rvc-dev-plus-aosp am: ee4e5355bf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12308260

Change-Id: If4fa13f2b471943f9cf9624ff9089ef6b6bdb628
This commit is contained in:
TreeHugger Robot
2020-08-05 20:01:11 +00:00
committed by Automerger Merge Worker
10 changed files with 88 additions and 85 deletions

View File

@@ -531,6 +531,8 @@
<!-- Defines the blacklist for system icons. That is to say, the icons in the status bar that
are part of the blacklist are never displayed. Each item in the blacklist must be a string
defined in core/res/res/config.xml to properly blacklist the icon.
TODO: See if we can rename this config variable.
-->
<string-array name="config_statusBarIconBlackList" translatable="false">
<item>@*android:string/status_bar_rotate</item>

View File

@@ -234,7 +234,7 @@ public class BatteryMeterView extends LinearLayout implements
}
Dependency.get(TunerService.class)
.addTunable(this, StatusBarIconController.ICON_BLACKLIST);
.addTunable(this, StatusBarIconController.ICON_HIDE_LIST);
mIsSubscribedForTunerUpdates = true;
}
@@ -287,8 +287,8 @@ public class BatteryMeterView extends LinearLayout implements
@Override
public void onTuningChanged(String key, String newValue) {
if (StatusBarIconController.ICON_BLACKLIST.equals(key)) {
ArraySet<String> icons = StatusBarIconController.getIconBlacklist(
if (StatusBarIconController.ICON_HIDE_LIST.equals(key)) {
ArraySet<String> icons = StatusBarIconController.getIconHideList(
getContext(), newValue);
setVisibility(icons.contains(mSlotBattery) ? View.GONE : View.VISIBLE);
}

View File

@@ -83,15 +83,16 @@ public interface StatusBarIconController {
public void removeIcon(String slot, int tag);
public void removeAllIconsForSlot(String slot);
public static final String ICON_BLACKLIST = "icon_blacklist";
// TODO: See if we can rename this tunable name.
String ICON_HIDE_LIST = "icon_blacklist";
/** Reads the default blacklist from config value unless blacklistStr is provided. */
static ArraySet<String> getIconBlacklist(Context context, String blackListStr) {
/** Reads the default hide list from config value unless hideListStr is provided. */
static ArraySet<String> getIconHideList(Context context, String hideListStr) {
ArraySet<String> ret = new ArraySet<>();
String[] blacklist = blackListStr == null
String[] hideList = hideListStr == null
? context.getResources().getStringArray(R.array.config_statusBarIconBlackList)
: blackListStr.split(",");
for (String slot : blacklist) {
: hideListStr.split(",");
for (String slot : hideList) {
if (!TextUtils.isEmpty(slot)) {
ret.add(slot);
}

View File

@@ -59,7 +59,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
private static final String TAG = "StatusBarIconController";
private final ArrayList<IconManager> mIconGroups = new ArrayList<>();
private final ArraySet<String> mIconBlacklist = new ArraySet<>();
private final ArraySet<String> mIconHideList = new ArraySet<>();
// Points to light or dark context depending on the... context?
private Context mContext;
@@ -79,7 +79,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
loadDimens();
commandQueue.addCallback(this);
Dependency.get(TunerService.class).addTunable(this, ICON_BLACKLIST);
Dependency.get(TunerService.class).addTunable(this, ICON_HIDE_LIST);
}
@Override
@@ -89,12 +89,12 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
for (int i = 0; i < allSlots.size(); i++) {
Slot slot = allSlots.get(i);
List<StatusBarIconHolder> holders = slot.getHolderListInViewOrder();
boolean blocked = mIconBlacklist.contains(slot.getName());
boolean hidden = mIconHideList.contains(slot.getName());
for (StatusBarIconHolder holder : holders) {
int tag = holder.getTag();
int viewIndex = getViewIndex(getSlotIndex(slot.getName()), holder.getTag());
group.onIconAdded(viewIndex, slot.getName(), blocked, holder);
group.onIconAdded(viewIndex, slot.getName(), hidden, holder);
}
}
}
@@ -107,11 +107,11 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
@Override
public void onTuningChanged(String key, String newValue) {
if (!ICON_BLACKLIST.equals(key)) {
if (!ICON_HIDE_LIST.equals(key)) {
return;
}
mIconBlacklist.clear();
mIconBlacklist.addAll(StatusBarIconController.getIconBlacklist(mContext, newValue));
mIconHideList.clear();
mIconHideList.addAll(StatusBarIconController.getIconHideList(mContext, newValue));
ArrayList<Slot> currentSlots = getSlots();
ArrayMap<Slot, List<StatusBarIconHolder>> slotsToReAdd = new ArrayMap<>();
@@ -142,9 +142,9 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
private void addSystemIcon(int index, StatusBarIconHolder holder) {
String slot = getSlotName(index);
int viewIndex = getViewIndex(index, holder.getTag());
boolean blocked = mIconBlacklist.contains(slot);
boolean hidden = mIconHideList.contains(slot);
mIconGroups.forEach(l -> l.onIconAdded(viewIndex, slot, blocked, holder));
mIconGroups.forEach(l -> l.onIconAdded(viewIndex, slot, hidden, holder));
}
@Override

View File

@@ -52,12 +52,12 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
private final SecurityController mSecurityController;
private final Handler mHandler = Handler.getMain();
private boolean mBlockAirplane;
private boolean mBlockMobile;
private boolean mBlockWifi;
private boolean mBlockEthernet;
private boolean mHideAirplane;
private boolean mHideMobile;
private boolean mHideWifi;
private boolean mHideEthernet;
private boolean mActivityEnabled;
private boolean mForceBlockWifi;
private boolean mForceHideWifi;
// Track as little state as possible, and only for padding purposes
private boolean mIsAirplaneMode = false;
@@ -80,7 +80,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
mNetworkController = Dependency.get(NetworkController.class);
mSecurityController = Dependency.get(SecurityController.class);
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST);
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_HIDE_LIST);
mNetworkController.addCallback(this);
mSecurityController.addCallback(this);
}
@@ -114,21 +114,21 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
@Override
public void onTuningChanged(String key, String newValue) {
if (!StatusBarIconController.ICON_BLACKLIST.equals(key)) {
if (!StatusBarIconController.ICON_HIDE_LIST.equals(key)) {
return;
}
ArraySet<String> blockList = StatusBarIconController.getIconBlacklist(mContext, newValue);
boolean blockAirplane = blockList.contains(mSlotAirplane);
boolean blockMobile = blockList.contains(mSlotMobile);
boolean blockWifi = blockList.contains(mSlotWifi);
boolean blockEthernet = blockList.contains(mSlotEthernet);
ArraySet<String> hideList = StatusBarIconController.getIconHideList(mContext, newValue);
boolean hideAirplane = hideList.contains(mSlotAirplane);
boolean hideMobile = hideList.contains(mSlotMobile);
boolean hideWifi = hideList.contains(mSlotWifi);
boolean hideEthernet = hideList.contains(mSlotEthernet);
if (blockAirplane != mBlockAirplane || blockMobile != mBlockMobile
|| blockEthernet != mBlockEthernet || blockWifi != mBlockWifi) {
mBlockAirplane = blockAirplane;
mBlockMobile = blockMobile;
mBlockEthernet = blockEthernet;
mBlockWifi = blockWifi || mForceBlockWifi;
if (hideAirplane != mHideAirplane || hideMobile != mHideMobile
|| hideEthernet != mHideEthernet || hideWifi != mHideWifi) {
mHideAirplane = hideAirplane;
mHideMobile = hideMobile;
mHideEthernet = hideEthernet;
mHideWifi = hideWifi || mForceHideWifi;
// Re-register to get new callbacks.
mNetworkController.removeCallback(this);
mNetworkController.addCallback(this);
@@ -140,7 +140,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
boolean activityIn, boolean activityOut, String description, boolean isTransient,
String statusLabel) {
boolean visible = statusIcon.visible && !mBlockWifi;
boolean visible = statusIcon.visible && !mHideWifi;
boolean in = activityIn && mActivityEnabled && visible;
boolean out = activityOut && mActivityEnabled && visible;
@@ -189,7 +189,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
// Visibility of the data type indicator changed
boolean typeChanged = statusType != state.typeId && (statusType == 0 || state.typeId == 0);
state.visible = statusIcon.visible && !mBlockMobile;
state.visible = statusIcon.visible && !mHideMobile;
state.strengthId = statusIcon.icon;
state.typeId = statusType;
state.contentDescription = statusIcon.contentDescription;
@@ -270,7 +270,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
@Override
public void setEthernetIndicators(IconState state) {
boolean visible = state.visible && !mBlockEthernet;
boolean visible = state.visible && !mHideEthernet;
int resId = state.icon;
String description = state.contentDescription;
@@ -284,7 +284,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
@Override
public void setIsAirplaneMode(IconState icon) {
mIsAirplaneMode = icon.visible && !mBlockAirplane;
mIsAirplaneMode = icon.visible && !mHideAirplane;
int resId = icon.icon;
String description = icon.contentDescription;

View File

@@ -190,7 +190,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C
mBroadcastDispatcher.registerReceiverWithHandler(mIntentReceiver, filter,
Dependency.get(Dependency.TIME_TICK_HANDLER), UserHandle.ALL);
Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS,
StatusBarIconController.ICON_BLACKLIST);
StatusBarIconController.ICON_HIDE_LIST);
mCommandQueue.addCallback(this);
if (mShowDark) {
Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this);
@@ -296,8 +296,8 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C
if (CLOCK_SECONDS.equals(key)) {
mShowSeconds = TunerService.parseIntegerSwitch(newValue, false);
updateShowSeconds();
} else {
setClockVisibleByUser(!StatusBarIconController.getIconBlacklist(getContext(), newValue)
} else if (StatusBarIconController.ICON_HIDE_LIST.equals(key)) {
setClockVisibleByUser(!StatusBarIconController.getIconHideList(getContext(), newValue)
.contains("clock"));
updateClockVisibility();
}

View File

@@ -38,7 +38,7 @@ public class BatteryPreference extends DropDownPreference implements TunerServic
private final String mBattery;
private boolean mBatteryEnabled;
private boolean mHasPercentage;
private ArraySet<String> mBlacklist;
private ArraySet<String> mHideList;
private boolean mHasSetValue;
public BatteryPreference(Context context, AttributeSet attrs) {
@@ -52,7 +52,7 @@ public class BatteryPreference extends DropDownPreference implements TunerServic
super.onAttached();
mHasPercentage = Settings.System.getInt(getContext().getContentResolver(),
SHOW_BATTERY_PERCENT, 0) != 0;
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST);
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_HIDE_LIST);
}
@Override
@@ -63,9 +63,9 @@ public class BatteryPreference extends DropDownPreference implements TunerServic
@Override
public void onTuningChanged(String key, String newValue) {
if (StatusBarIconController.ICON_BLACKLIST.equals(key)) {
mBlacklist = StatusBarIconController.getIconBlacklist(getContext(), newValue);
mBatteryEnabled = !mBlacklist.contains(mBattery);
if (StatusBarIconController.ICON_HIDE_LIST.equals(key)) {
mHideList = StatusBarIconController.getIconHideList(getContext(), newValue);
mBatteryEnabled = !mHideList.contains(mBattery);
}
if (!mHasSetValue) {
// Because of the complicated tri-state it can end up looping and setting state back to
@@ -88,12 +88,12 @@ public class BatteryPreference extends DropDownPreference implements TunerServic
MetricsLogger.action(getContext(), MetricsEvent.TUNER_BATTERY_PERCENTAGE, v);
Settings.System.putInt(getContext().getContentResolver(), SHOW_BATTERY_PERCENT, v ? 1 : 0);
if (DISABLED.equals(value)) {
mBlacklist.add(mBattery);
mHideList.add(mBattery);
} else {
mBlacklist.remove(mBattery);
mHideList.remove(mBattery);
}
Dependency.get(TunerService.class).setValue(StatusBarIconController.ICON_BLACKLIST,
TextUtils.join(",", mBlacklist));
Dependency.get(TunerService.class).setValue(StatusBarIconController.ICON_HIDE_LIST,
TextUtils.join(",", mHideList));
return true;
}
}

View File

@@ -33,7 +33,7 @@ public class ClockPreference extends DropDownPreference implements TunerService.
private final String mClock;
private boolean mClockEnabled;
private boolean mHasSeconds;
private ArraySet<String> mBlacklist;
private ArraySet<String> mHideList;
private boolean mHasSetValue;
private boolean mReceivedSeconds;
private boolean mReceivedClock;
@@ -47,7 +47,7 @@ public class ClockPreference extends DropDownPreference implements TunerService.
@Override
public void onAttached() {
super.onAttached();
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST,
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_HIDE_LIST,
Clock.CLOCK_SECONDS);
}
@@ -59,10 +59,10 @@ public class ClockPreference extends DropDownPreference implements TunerService.
@Override
public void onTuningChanged(String key, String newValue) {
if (StatusBarIconController.ICON_BLACKLIST.equals(key)) {
if (StatusBarIconController.ICON_HIDE_LIST.equals(key)) {
mReceivedClock = true;
mBlacklist = StatusBarIconController.getIconBlacklist(getContext(), newValue);
mClockEnabled = !mBlacklist.contains(mClock);
mHideList = StatusBarIconController.getIconHideList(getContext(), newValue);
mClockEnabled = !mHideList.contains(mClock);
} else if (Clock.CLOCK_SECONDS.equals(key)) {
mReceivedSeconds = true;
mHasSeconds = newValue != null && Integer.parseInt(newValue) != 0;
@@ -87,12 +87,12 @@ public class ClockPreference extends DropDownPreference implements TunerService.
Dependency.get(TunerService.class).setValue(Clock.CLOCK_SECONDS, SECONDS.equals(value) ? 1
: 0);
if (DISABLED.equals(value)) {
mBlacklist.add(mClock);
mHideList.add(mClock);
} else {
mBlacklist.remove(mClock);
mHideList.remove(mClock);
}
Dependency.get(TunerService.class).setValue(StatusBarIconController.ICON_BLACKLIST,
TextUtils.join(",", mBlacklist));
Dependency.get(TunerService.class).setValue(StatusBarIconController.ICON_HIDE_LIST,
TextUtils.join(",", mHideList));
return true;
}
}

View File

@@ -34,7 +34,7 @@ import java.util.Set;
public class StatusBarSwitch extends SwitchPreference implements Tunable {
private Set<String> mBlacklist;
private Set<String> mHideList;
public StatusBarSwitch(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -43,7 +43,7 @@ public class StatusBarSwitch extends SwitchPreference implements Tunable {
@Override
public void onAttached() {
super.onAttached();
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST);
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_HIDE_LIST);
}
@Override
@@ -54,35 +54,35 @@ public class StatusBarSwitch extends SwitchPreference implements Tunable {
@Override
public void onTuningChanged(String key, String newValue) {
if (!StatusBarIconController.ICON_BLACKLIST.equals(key)) {
if (!StatusBarIconController.ICON_HIDE_LIST.equals(key)) {
return;
}
mBlacklist = StatusBarIconController.getIconBlacklist(getContext(), newValue);
setChecked(!mBlacklist.contains(getKey()));
mHideList = StatusBarIconController.getIconHideList(getContext(), newValue);
setChecked(!mHideList.contains(getKey()));
}
@Override
protected boolean persistBoolean(boolean value) {
if (!value) {
// If not enabled add to blacklist.
if (!mBlacklist.contains(getKey())) {
// If not enabled add to hideList.
if (!mHideList.contains(getKey())) {
MetricsLogger.action(getContext(), MetricsEvent.TUNER_STATUS_BAR_DISABLE,
getKey());
mBlacklist.add(getKey());
setList(mBlacklist);
mHideList.add(getKey());
setList(mHideList);
}
} else {
if (mBlacklist.remove(getKey())) {
if (mHideList.remove(getKey())) {
MetricsLogger.action(getContext(), MetricsEvent.TUNER_STATUS_BAR_ENABLE, getKey());
setList(mBlacklist);
setList(mHideList);
}
}
return true;
}
private void setList(Set<String> blacklist) {
private void setList(Set<String> hideList) {
ContentResolver contentResolver = getContext().getContentResolver();
Settings.Secure.putStringForUser(contentResolver, StatusBarIconController.ICON_BLACKLIST,
TextUtils.join(",", blacklist), ActivityManager.getCurrentUser());
Settings.Secure.putStringForUser(contentResolver, StatusBarIconController.ICON_HIDE_LIST,
TextUtils.join(",", hideList), ActivityManager.getCurrentUser());
}
}

View File

@@ -60,7 +60,7 @@ public class TunerServiceImpl extends TunerService {
// Things that use the tunable infrastructure but are now real user settings and
// shouldn't be reset with tuner settings.
private static final String[] RESET_BLACKLIST = new String[] {
private static final String[] RESET_EXCEPTION_LIST = new String[] {
QSTileHost.TILES_SETTING,
Settings.Secure.DOZE_ALWAYS_ON,
Settings.Secure.MEDIA_CONTROLS_RESUME
@@ -116,17 +116,17 @@ public class TunerServiceImpl extends TunerService {
private void upgradeTuner(int oldVersion, int newVersion, Handler mainHandler) {
if (oldVersion < 1) {
String blacklistStr = getValue(StatusBarIconController.ICON_BLACKLIST);
if (blacklistStr != null) {
ArraySet<String> iconBlacklist =
StatusBarIconController.getIconBlacklist(mContext, blacklistStr);
String hideListStr = getValue(StatusBarIconController.ICON_HIDE_LIST);
if (hideListStr != null) {
ArraySet<String> iconHideList =
StatusBarIconController.getIconHideList(mContext, hideListStr);
iconBlacklist.add("rotate");
iconBlacklist.add("headset");
iconHideList.add("rotate");
iconHideList.add("headset");
Settings.Secure.putStringForUser(mContentResolver,
StatusBarIconController.ICON_BLACKLIST,
TextUtils.join(",", iconBlacklist), mCurrentUser);
StatusBarIconController.ICON_HIDE_LIST,
TextUtils.join(",", iconHideList), mCurrentUser);
}
}
if (oldVersion < 2) {
@@ -251,7 +251,7 @@ public class TunerServiceImpl extends TunerService {
mContext.sendBroadcast(intent);
for (String key : mTunableLookup.keySet()) {
if (ArrayUtils.contains(RESET_BLACKLIST, key)) {
if (ArrayUtils.contains(RESET_EXCEPTION_LIST, key)) {
continue;
}
Settings.Secure.putStringForUser(mContentResolver, key, null, user);