[Wi-Fi] WiFi Settings inclusive language fix plan phase 1

Replace WiFi related terms which contain Master wording.
Goal: Create a fixit for Android Platform to reduce the use of non-inclusive language for all code.

Bug: 161425297
Test: make RunSettingsRoboTests -j or
make RunSettingsRoboTests ROBOTEST_FILTER=DashboardFragmentTest
make RunSettingsRoboTests ROBOTEST_FILTER=WirelessDebuggingPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=AutomaticStorageManagementSwitchPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=AllInOneTetherPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=TopLevelNetworkEntryPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=PrimarySwitchPreferenceTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiPrimarySwitchPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherPreferenceControllerTest

Change-Id: I9395c50e092e124016609f88f7c8151554a0d874
This commit is contained in:
govenliu
2020-07-16 17:09:03 +08:00
parent 670d37c44e
commit b70ddb9df7
29 changed files with 119 additions and 108 deletions

View File

@@ -33,13 +33,19 @@ import android.util.ArraySet;
import android.util.IconDrawableFactory;
import android.util.Slog;
import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.applications.AppInfoBase;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.notification.app.AppNotificationSettings;
import com.android.settings.widget.MasterSwitchPreference;
import com.android.settings.widget.PrimarySwitchPreference;
import com.android.settingslib.TwoTargetPreference;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -52,12 +58,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
/**
* This controller displays a list of recently used apps and a "See all" button. If there is
* no recently used app, "See all" will be displayed as "Notifications".
@@ -223,13 +223,13 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
// Rebind prefs/avoid adding new prefs if possible. Adding/removing prefs causes jank.
// Build a cached preference pool
final Map<String, MasterSwitchPreference> appPreferences = new ArrayMap<>();
final Map<String, PrimarySwitchPreference> appPreferences = new ArrayMap<>();
int prefCount = mCategory.getPreferenceCount();
for (int i = 0; i < prefCount; i++) {
final Preference pref = mCategory.getPreference(i);
final String key = pref.getKey();
if (!TextUtils.equals(key, KEY_SEE_ALL)) {
appPreferences.put(key, (MasterSwitchPreference) pref);
appPreferences.put(key, (PrimarySwitchPreference) pref);
}
}
final int recentAppsCount = recentApps.size();
@@ -244,10 +244,10 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
}
boolean rebindPref = true;
MasterSwitchPreference pref = appPreferences.remove(getKey(app.getUserId(),
PrimarySwitchPreference pref = appPreferences.remove(getKey(app.getUserId(),
pkgName));
if (pref == null) {
pref = new MasterSwitchPreference(prefContext);
pref = new PrimarySwitchPreference(prefContext);
rebindPref = false;
}
pref.setKey(getKey(app.getUserId(), pkgName));

View File

@@ -39,7 +39,7 @@ import com.android.settings.applications.AppInfoBase;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.notification.NotificationBackend;
import com.android.settings.widget.MasterSwitchPreference;
import com.android.settings.widget.PrimarySwitchPreference;
import com.android.settingslib.RestrictedSwitchPreference;
import java.util.ArrayList;
@@ -92,8 +92,8 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
// the 0th index is the mAllNotificationsToggle which allows users to
// toggle all notifications from this app to bypass DND
for (int i = 1; i < mPreferenceCategory.getPreferenceCount(); i++) {
MasterSwitchPreference childPreference =
(MasterSwitchPreference) mPreferenceCategory.getPreference(i);
PrimarySwitchPreference childPreference =
(PrimarySwitchPreference) mPreferenceCategory.getPreference(i);
childPreference.setChecked(showNotificationInDnd(mChannels.get(i - 1)));
}
return true;
@@ -158,7 +158,7 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
mPreferenceCategory.removeAll();
mPreferenceCategory.addPreference(mAllNotificationsToggle);
for (NotificationChannel channel : mChannels) {
MasterSwitchPreference channelPreference = new MasterSwitchPreference(mContext);
PrimarySwitchPreference channelPreference = new PrimarySwitchPreference(mContext);
channelPreference.setDisabledByAdmin(mAdmin);
channelPreference.setSwitchEnabled(
(mAdmin == null || !channelPreference.isDisabledByAdmin())

View File

@@ -23,11 +23,7 @@ import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.graphics.BlendMode;
import android.graphics.BlendModeColorFilter;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.Settings;
@@ -43,7 +39,7 @@ import com.android.settings.Utils;
import com.android.settings.applications.AppInfoBase;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.notification.NotificationBackend;
import com.android.settings.widget.MasterSwitchPreference;
import com.android.settings.widget.PrimarySwitchPreference;
import com.android.settingslib.RestrictedSwitchPreference;
import java.util.ArrayList;
@@ -177,7 +173,7 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
protected Preference populateSingleChannelPrefs(PreferenceGroup parent,
final NotificationChannel channel, final boolean groupBlocked) {
MasterSwitchPreference channelPref = new MasterSwitchPreference(mContext);
PrimarySwitchPreference channelPref = new PrimarySwitchPreference(mContext);
channelPref.setSwitchEnabled(mAdmin == null
&& isChannelBlockable(channel)
&& isChannelConfigurable(channel)
@@ -186,7 +182,7 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
if (channel.getImportance() > IMPORTANCE_LOW) {
channelPref.setIcon(getAlertingIcon());
}
channelPref.setIconSize(MasterSwitchPreference.ICON_SIZE_SMALL);
channelPref.setIconSize(PrimarySwitchPreference.ICON_SIZE_SMALL);
channelPref.setKey(channel.getId());
channelPref.setTitle(channel.getName());
channelPref.setSummary(NotificationBackend.getSentSummary(
@@ -210,7 +206,7 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
int importance = value ? channel.getOriginalImportance() : IMPORTANCE_NONE;
channel.setImportance(importance);
channel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
MasterSwitchPreference channelPref1 = (MasterSwitchPreference) preference;
PrimarySwitchPreference channelPref1 = (PrimarySwitchPreference) preference;
channelPref1.setIcon(null);
if (channel.getImportance() > IMPORTANCE_LOW) {
channelPref1.setIcon(getAlertingIcon());
@@ -243,7 +239,7 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
int childCount = groupGroup.getPreferenceCount();
for (int i = 0; i < childCount; i++) {
Preference pref = groupGroup.getPreference(i);
if (pref instanceof MasterSwitchPreference) {
if (pref instanceof PrimarySwitchPreference) {
toRemove.add(pref);
}
}