[Settings] Inclusive language for Data Usage
Change wordings in data usage part into inclusive language. Bug: 160707804 Test: make RunSettingsRoboTests Change-Id: I713e52df8201413b884257a51bc1f71a0d43179d
This commit is contained in:
@@ -304,12 +304,12 @@ public class AllInOneTetherSettings extends RestrictedDashboardFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
@@ -218,11 +218,11 @@ public class TetherSettings extends RestrictedSettingsFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@@ -110,7 +110,7 @@ public class SpecialAppAccessPreferenceController extends BasePreferenceControll
|
||||
continue;
|
||||
}
|
||||
if (entry.extraInfo instanceof DataUsageState
|
||||
&& ((DataUsageState) entry.extraInfo).isDataSaverWhitelisted) {
|
||||
&& ((DataUsageState) entry.extraInfo).isDataSaverAllowlisted) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@@ -235,11 +235,11 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (preference == mRestrictBackground) {
|
||||
mDataSaverBackend.setIsBlacklisted(mAppItem.key, mPackageName, !(Boolean) newValue);
|
||||
mDataSaverBackend.setIsDenylisted(mAppItem.key, mPackageName, !(Boolean) newValue);
|
||||
updatePrefs();
|
||||
return true;
|
||||
} else if (preference == mUnrestrictedData) {
|
||||
mDataSaverBackend.setIsWhitelisted(mAppItem.key, mPackageName, (Boolean) newValue);
|
||||
mDataSaverBackend.setIsAllowlisted(mAppItem.key, mPackageName, (Boolean) newValue);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -330,7 +330,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
|
||||
private boolean getUnrestrictData() {
|
||||
if (mDataSaverBackend != null) {
|
||||
return mDataSaverBackend.isWhitelisted(mAppItem.key);
|
||||
return mDataSaverBackend.isAllowlisted(mAppItem.key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -464,16 +464,16 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
if (mAppItem.uids.get(uid, false)) {
|
||||
updatePrefs(getAppRestrictBackground(), isWhitelisted);
|
||||
updatePrefs(getAppRestrictBackground(), isAllowlisted);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
if (mAppItem.uids.get(uid, false)) {
|
||||
updatePrefs(isBlacklisted, getUnrestrictData());
|
||||
updatePrefs(isDenylisted, getUnrestrictData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,24 +37,24 @@ public class AppStateDataUsageBridge extends AppStateBaseBridge {
|
||||
final int N = apps.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
AppEntry app = apps.get(i);
|
||||
app.extraInfo = new DataUsageState(mDataSaverBackend.isWhitelisted(app.info.uid),
|
||||
mDataSaverBackend.isBlacklisted(app.info.uid));
|
||||
app.extraInfo = new DataUsageState(mDataSaverBackend.isAllowlisted(app.info.uid),
|
||||
mDataSaverBackend.isDenylisted(app.info.uid));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateExtraInfo(AppEntry app, String pkg, int uid) {
|
||||
app.extraInfo = new DataUsageState(mDataSaverBackend.isWhitelisted(uid),
|
||||
mDataSaverBackend.isBlacklisted(uid));
|
||||
app.extraInfo = new DataUsageState(mDataSaverBackend.isAllowlisted(uid),
|
||||
mDataSaverBackend.isDenylisted(uid));
|
||||
}
|
||||
|
||||
public static class DataUsageState {
|
||||
public boolean isDataSaverWhitelisted;
|
||||
public boolean isDataSaverBlacklisted;
|
||||
public boolean isDataSaverAllowlisted;
|
||||
public boolean isDataSaverDenylisted;
|
||||
|
||||
public DataUsageState(boolean isDataSaverWhitelisted, boolean isDataSaverBlacklisted) {
|
||||
this.isDataSaverWhitelisted = isDataSaverWhitelisted;
|
||||
this.isDataSaverBlacklisted = isDataSaverBlacklisted;
|
||||
public DataUsageState(boolean isDataSaverAllowlisted, boolean isDataSaverDenylisted) {
|
||||
this.isDataSaverAllowlisted = isDataSaverAllowlisted;
|
||||
this.isDataSaverDenylisted = isDataSaverDenylisted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -42,8 +42,8 @@ public class DataSaverBackend {
|
||||
private final NetworkPolicyManager mPolicyManager;
|
||||
private final ArrayList<Listener> mListeners = new ArrayList<>();
|
||||
private SparseIntArray mUidPolicies = new SparseIntArray();
|
||||
private boolean mWhitelistInitialized;
|
||||
private boolean mBlacklistInitialized;
|
||||
private boolean mAllowlistInitialized;
|
||||
private boolean mDenylistInitialized;
|
||||
|
||||
// TODO: Staticize into only one.
|
||||
public DataSaverBackend(Context context) {
|
||||
@@ -77,63 +77,63 @@ public class DataSaverBackend {
|
||||
mContext, SettingsEnums.ACTION_DATA_SAVER_MODE, enabled ? 1 : 0);
|
||||
}
|
||||
|
||||
public void refreshWhitelist() {
|
||||
loadWhitelist();
|
||||
public void refreshAllowlist() {
|
||||
loadAllowlist();
|
||||
}
|
||||
|
||||
public void setIsWhitelisted(int uid, String packageName, boolean whitelisted) {
|
||||
final int policy = whitelisted ? POLICY_ALLOW_METERED_BACKGROUND : POLICY_NONE;
|
||||
public void setIsAllowlisted(int uid, String packageName, boolean allowlisted) {
|
||||
final int policy = allowlisted ? POLICY_ALLOW_METERED_BACKGROUND : POLICY_NONE;
|
||||
mPolicyManager.setUidPolicy(uid, policy);
|
||||
mUidPolicies.put(uid, policy);
|
||||
if (whitelisted) {
|
||||
if (allowlisted) {
|
||||
mMetricsFeatureProvider.action(
|
||||
mContext, SettingsEnums.ACTION_DATA_SAVER_WHITELIST, packageName);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isWhitelisted(int uid) {
|
||||
loadWhitelist();
|
||||
public boolean isAllowlisted(int uid) {
|
||||
loadAllowlist();
|
||||
return mUidPolicies.get(uid, POLICY_NONE) == POLICY_ALLOW_METERED_BACKGROUND;
|
||||
}
|
||||
|
||||
private void loadWhitelist() {
|
||||
if (mWhitelistInitialized) {
|
||||
private void loadAllowlist() {
|
||||
if (mAllowlistInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int uid : mPolicyManager.getUidsWithPolicy(POLICY_ALLOW_METERED_BACKGROUND)) {
|
||||
mUidPolicies.put(uid, POLICY_ALLOW_METERED_BACKGROUND);
|
||||
}
|
||||
mWhitelistInitialized = true;
|
||||
mAllowlistInitialized = true;
|
||||
}
|
||||
|
||||
public void refreshBlacklist() {
|
||||
loadBlacklist();
|
||||
public void refreshDenylist() {
|
||||
loadDenylist();
|
||||
}
|
||||
|
||||
public void setIsBlacklisted(int uid, String packageName, boolean blacklisted) {
|
||||
final int policy = blacklisted ? POLICY_REJECT_METERED_BACKGROUND : POLICY_NONE;
|
||||
public void setIsDenylisted(int uid, String packageName, boolean denylisted) {
|
||||
final int policy = denylisted ? POLICY_REJECT_METERED_BACKGROUND : POLICY_NONE;
|
||||
mPolicyManager.setUidPolicy(uid, policy);
|
||||
mUidPolicies.put(uid, policy);
|
||||
if (blacklisted) {
|
||||
if (denylisted) {
|
||||
mMetricsFeatureProvider.action(
|
||||
mContext, SettingsEnums.ACTION_DATA_SAVER_BLACKLIST, packageName);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBlacklisted(int uid) {
|
||||
loadBlacklist();
|
||||
public boolean isDenylisted(int uid) {
|
||||
loadDenylist();
|
||||
return mUidPolicies.get(uid, POLICY_NONE) == POLICY_REJECT_METERED_BACKGROUND;
|
||||
}
|
||||
|
||||
private void loadBlacklist() {
|
||||
if (mBlacklistInitialized) {
|
||||
private void loadDenylist() {
|
||||
if (mDenylistInitialized) {
|
||||
return;
|
||||
}
|
||||
for (int uid : mPolicyManager.getUidsWithPolicy(POLICY_REJECT_METERED_BACKGROUND)) {
|
||||
mUidPolicies.put(uid, POLICY_REJECT_METERED_BACKGROUND);
|
||||
}
|
||||
mBlacklistInitialized = true;
|
||||
mDenylistInitialized = true;
|
||||
}
|
||||
|
||||
private void handleRestrictBackgroundChanged(boolean isDataSaving) {
|
||||
@@ -142,21 +142,21 @@ public class DataSaverBackend {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleWhitelistChanged(int uid, boolean isWhitelisted) {
|
||||
private void handleAllowlistChanged(int uid, boolean isAllowlisted) {
|
||||
for (int i = 0; i < mListeners.size(); i++) {
|
||||
mListeners.get(i).onWhitelistStatusChanged(uid, isWhitelisted);
|
||||
mListeners.get(i).onAllowlistStatusChanged(uid, isAllowlisted);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleBlacklistChanged(int uid, boolean isBlacklisted) {
|
||||
private void handleDenylistChanged(int uid, boolean isDenylisted) {
|
||||
for (int i = 0; i < mListeners.size(); i++) {
|
||||
mListeners.get(i).onBlacklistStatusChanged(uid, isBlacklisted);
|
||||
mListeners.get(i).onDenylistStatusChanged(uid, isDenylisted);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleUidPoliciesChanged(int uid, int newPolicy) {
|
||||
loadWhitelist();
|
||||
loadBlacklist();
|
||||
loadAllowlist();
|
||||
loadDenylist();
|
||||
|
||||
final int oldPolicy = mUidPolicies.get(uid, POLICY_NONE);
|
||||
if (newPolicy == POLICY_NONE) {
|
||||
@@ -165,17 +165,17 @@ public class DataSaverBackend {
|
||||
mUidPolicies.put(uid, newPolicy);
|
||||
}
|
||||
|
||||
final boolean wasWhitelisted = oldPolicy == POLICY_ALLOW_METERED_BACKGROUND;
|
||||
final boolean wasBlacklisted = oldPolicy == POLICY_REJECT_METERED_BACKGROUND;
|
||||
final boolean isWhitelisted = newPolicy == POLICY_ALLOW_METERED_BACKGROUND;
|
||||
final boolean isBlacklisted = newPolicy == POLICY_REJECT_METERED_BACKGROUND;
|
||||
final boolean wasAllowlisted = oldPolicy == POLICY_ALLOW_METERED_BACKGROUND;
|
||||
final boolean wasDenylisted = oldPolicy == POLICY_REJECT_METERED_BACKGROUND;
|
||||
final boolean isAllowlisted = newPolicy == POLICY_ALLOW_METERED_BACKGROUND;
|
||||
final boolean isDenylisted = newPolicy == POLICY_REJECT_METERED_BACKGROUND;
|
||||
|
||||
if (wasWhitelisted != isWhitelisted) {
|
||||
handleWhitelistChanged(uid, isWhitelisted);
|
||||
if (wasAllowlisted != isAllowlisted) {
|
||||
handleAllowlistChanged(uid, isAllowlisted);
|
||||
}
|
||||
|
||||
if (wasBlacklisted != isBlacklisted) {
|
||||
handleBlacklistChanged(uid, isBlacklisted);
|
||||
if (wasDenylisted != isDenylisted) {
|
||||
handleDenylistChanged(uid, isDenylisted);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -211,8 +211,8 @@ public class DataSaverBackend {
|
||||
public interface Listener {
|
||||
void onDataSaverChanged(boolean isDataSaving);
|
||||
|
||||
void onWhitelistStatusChanged(int uid, boolean isWhitelisted);
|
||||
void onAllowlistStatusChanged(int uid, boolean isAllowlisted);
|
||||
|
||||
void onBlacklistStatusChanged(int uid, boolean isBlacklisted);
|
||||
void onDenylistStatusChanged(int uid, boolean isDenylisted);
|
||||
}
|
||||
}
|
||||
|
@@ -48,10 +48,10 @@ public class DataSaverPreference extends Preference implements DataSaverBackend.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
}
|
||||
}
|
||||
|
@@ -82,8 +82,8 @@ public class DataSaverSummary extends SettingsPreferenceFragment
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mDataSaverBackend.refreshWhitelist();
|
||||
mDataSaverBackend.refreshBlacklist();
|
||||
mDataSaverBackend.refreshAllowlist();
|
||||
mDataSaverBackend.refreshDenylist();
|
||||
mDataSaverBackend.addListener(this);
|
||||
mDataUsageBridge.resume();
|
||||
}
|
||||
@@ -125,11 +125,11 @@ public class DataSaverSummary extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,7 +146,7 @@ public class DataSaverSummary extends SettingsPreferenceFragment
|
||||
continue;
|
||||
}
|
||||
if (entry.extraInfo != null && ((AppStateDataUsageBridge.DataUsageState)
|
||||
entry.extraInfo).isDataSaverWhitelisted) {
|
||||
entry.extraInfo).isDataSaverAllowlisted) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@@ -79,15 +79,15 @@ public class UnrestrictedDataAccessPreference extends AppSwitchPreference implem
|
||||
|
||||
@Override
|
||||
protected void onClick() {
|
||||
if (mDataUsageState.isDataSaverBlacklisted) {
|
||||
// app is blacklisted, launch App Data Usage screen
|
||||
if (mDataUsageState.isDataSaverDenylisted) {
|
||||
// app is denylisted, launch App Data Usage screen
|
||||
AppInfoDashboardFragment.startAppInfoFragment(AppDataUsage.class,
|
||||
R.string.data_usage_app_summary_title,
|
||||
null /* arguments */,
|
||||
mParentFragment,
|
||||
mEntry);
|
||||
} else {
|
||||
// app is not blacklisted, let superclass handle toggle switch
|
||||
// app is not denylisted, let superclass handle toggle switch
|
||||
super.onClick();
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class UnrestrictedDataAccessPreference extends AppSwitchPreference implem
|
||||
widgetFrame.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
widgetFrame.setVisibility(
|
||||
mDataUsageState != null && mDataUsageState.isDataSaverBlacklisted
|
||||
mDataUsageState != null && mDataUsageState.isDataSaverDenylisted
|
||||
? View.INVISIBLE : View.VISIBLE);
|
||||
}
|
||||
super.onBindViewHolder(holder);
|
||||
@@ -136,17 +136,17 @@ public class UnrestrictedDataAccessPreference extends AppSwitchPreference implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
if (mDataUsageState != null && mEntry.info.uid == uid) {
|
||||
mDataUsageState.isDataSaverWhitelisted = isWhitelisted;
|
||||
mDataUsageState.isDataSaverAllowlisted = isAllowlisted;
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
if (mDataUsageState != null && mEntry.info.uid == uid) {
|
||||
mDataUsageState.isDataSaverBlacklisted = isBlacklisted;
|
||||
mDataUsageState.isDataSaverDenylisted = isDenylisted;
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
@@ -167,14 +167,14 @@ public class UnrestrictedDataAccessPreference extends AppSwitchPreference implem
|
||||
mHelper.setDisabledByAdmin(admin);
|
||||
}
|
||||
|
||||
// Sets UI state based on whitelist/blacklist status.
|
||||
// Sets UI state based on allowlist/denylist status.
|
||||
public void updateState() {
|
||||
setTitle(mEntry.label);
|
||||
if (mDataUsageState != null) {
|
||||
setChecked(mDataUsageState.isDataSaverWhitelisted);
|
||||
setChecked(mDataUsageState.isDataSaverAllowlisted);
|
||||
if (isDisabledByAdmin()) {
|
||||
setSummary(R.string.disabled_by_admin);
|
||||
} else if (mDataUsageState.isDataSaverBlacklisted) {
|
||||
} else if (mDataUsageState.isDataSaverDenylisted) {
|
||||
setSummary(R.string.restrict_background_blacklisted);
|
||||
} else {
|
||||
setSummary("");
|
||||
|
@@ -186,11 +186,11 @@ public class UnrestrictedDataAccessPreferenceController extends BasePreferenceCo
|
||||
if (preference instanceof UnrestrictedDataAccessPreference) {
|
||||
final UnrestrictedDataAccessPreference
|
||||
accessPreference = (UnrestrictedDataAccessPreference) preference;
|
||||
boolean whitelisted = newValue == Boolean.TRUE;
|
||||
logSpecialPermissionChange(whitelisted, accessPreference.getEntry().info.packageName);
|
||||
mDataSaverBackend.setIsWhitelisted(accessPreference.getEntry().info.uid,
|
||||
accessPreference.getEntry().info.packageName, whitelisted);
|
||||
accessPreference.getDataUsageState().isDataSaverWhitelisted = whitelisted;
|
||||
boolean allowlisted = newValue == Boolean.TRUE;
|
||||
logSpecialPermissionChange(allowlisted, accessPreference.getEntry().info.packageName);
|
||||
mDataSaverBackend.setIsAllowlisted(accessPreference.getEntry().info.uid,
|
||||
accessPreference.getEntry().info.packageName, allowlisted);
|
||||
accessPreference.getDataUsageState().isDataSaverAllowlisted = allowlisted;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -224,8 +224,8 @@ public class UnrestrictedDataAccessPreferenceController extends BasePreferenceCo
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void logSpecialPermissionChange(boolean whitelisted, String packageName) {
|
||||
final int logCategory = whitelisted ? SettingsEnums.APP_SPECIAL_PERMISSION_UNL_DATA_ALLOW
|
||||
void logSpecialPermissionChange(boolean allowlisted, String packageName) {
|
||||
final int logCategory = allowlisted ? SettingsEnums.APP_SPECIAL_PERMISSION_UNL_DATA_ALLOW
|
||||
: SettingsEnums.APP_SPECIAL_PERMISSION_UNL_DATA_DENY;
|
||||
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider().action(mContext,
|
||||
logCategory, packageName);
|
||||
|
@@ -129,11 +129,11 @@ public abstract class TetherBasePreferenceController extends TogglePreferenceCon
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -368,12 +368,12 @@ public class TetherEnabler implements SwitchWidgetController.OnSwitchChangeListe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
// we don't care, since we just want to read the value
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
// we don't care, since we just want to read the value
|
||||
}
|
||||
|
||||
|
@@ -162,12 +162,12 @@ public class WifiTetherSwitchBarController implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWhitelistStatusChanged(int uid, boolean isWhitelisted) {
|
||||
public void onAllowlistStatusChanged(int uid, boolean isAllowlisted) {
|
||||
// we don't care, since we just want to read the value
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlacklistStatusChanged(int uid, boolean isBlacklisted) {
|
||||
public void onDenylistStatusChanged(int uid, boolean isDenylisted) {
|
||||
// we don't care, since we just want to read the value
|
||||
}
|
||||
}
|
||||
|
@@ -124,7 +124,7 @@ public class ChartDataUsagePreferenceTest {
|
||||
tonight - TimeUnit.DAYS.toMillis(2), tonight - TimeUnit.DAYS.toMillis(1), 83849690L));
|
||||
mNetworkCycleData.add(createNetworkCycleData(
|
||||
tonight - TimeUnit.DAYS.toMillis(1), tonight, 1883657L));
|
||||
// add dummy usage data for next 5 days
|
||||
// add test usage data for next 5 days
|
||||
mNetworkCycleData.add(createNetworkCycleData(
|
||||
tonight, tonight + TimeUnit.DAYS.toMillis(1), 0L));
|
||||
mNetworkCycleData.add(createNetworkCycleData(
|
||||
@@ -149,7 +149,7 @@ public class ChartDataUsagePreferenceTest {
|
||||
|
||||
verify(usageView).addPath(pointsCaptor.capture());
|
||||
final SparseIntArray points = pointsCaptor.getValue();
|
||||
// should only have 7 points: 1 dummy point indicating the start of data, starting point 0,
|
||||
// should only have 7 points: 1 test point indicating the start of data, starting point 0,
|
||||
// and 5 actual data point for each day
|
||||
assertThat(points.size()).isEqualTo(7);
|
||||
assertThat(points.keyAt(0)).isEqualTo(-1);
|
||||
|
@@ -61,7 +61,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
private static final long CYCLE_DURATION_MILLIS = 1000000000L;
|
||||
private static final long UPDATE_LAG_MILLIS = 10000000L;
|
||||
private static final String DUMMY_CARRIER = "z-mobile";
|
||||
private static final String FAKE_CARRIER = "z-mobile";
|
||||
|
||||
private Activity mActivity;
|
||||
private PreferenceViewHolder mHolder;
|
||||
@@ -99,7 +99,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageInfo_withLaunchIntent_launchButtonShown() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -108,7 +108,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageInfo_withoutLaunchIntent_launchButtonNotShown() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
null /* launchIntent */);
|
||||
|
||||
bindViewHolder();
|
||||
@@ -117,7 +117,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageInfo_withDataPlans_carrierInfoShown() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -126,7 +126,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageInfo_withNoDataPlans_carrierInfoNotShown() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -140,12 +140,12 @@ public class DataUsageSummaryPreferenceTest {
|
||||
final long updateTime = System.currentTimeMillis()
|
||||
- TimeUnit.DAYS.toMillis(baseUnit) - TimeUnit.HOURS.toMillis(smudge);
|
||||
mCarrierInfo = (TextView) mHolder.findViewById(R.id.carrier_and_update);
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
assertThat(mCarrierInfo.getText().toString())
|
||||
.isEqualTo("Updated by " + DUMMY_CARRIER + " " + baseUnit + " days ago");
|
||||
.isEqualTo("Updated by " + FAKE_CARRIER + " " + baseUnit + " days ago");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -155,12 +155,12 @@ public class DataUsageSummaryPreferenceTest {
|
||||
final long updateTime = System.currentTimeMillis()
|
||||
- TimeUnit.HOURS.toMillis(baseUnit) - TimeUnit.MINUTES.toMillis(smudge);
|
||||
mCarrierInfo = (TextView) mHolder.findViewById(R.id.carrier_and_update);
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
assertThat(mCarrierInfo.getText().toString())
|
||||
.isEqualTo("Updated by " + DUMMY_CARRIER + " " + baseUnit + " hr ago");
|
||||
.isEqualTo("Updated by " + FAKE_CARRIER + " " + baseUnit + " hr ago");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -170,24 +170,24 @@ public class DataUsageSummaryPreferenceTest {
|
||||
final long updateTime = System.currentTimeMillis()
|
||||
- TimeUnit.MINUTES.toMillis(baseUnit) - TimeUnit.SECONDS.toMillis(smudge);
|
||||
mCarrierInfo = (TextView) mHolder.findViewById(R.id.carrier_and_update);
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
assertThat(mCarrierInfo.getText().toString())
|
||||
.isEqualTo("Updated by " + DUMMY_CARRIER + " " + baseUnit + " min ago");
|
||||
.isEqualTo("Updated by " + FAKE_CARRIER + " " + baseUnit + " min ago");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCarrierUpdateTime_shouldFormatLessThanMinuteCorrectly() {
|
||||
final long updateTime = System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(45);
|
||||
mCarrierInfo = (TextView) mHolder.findViewById(R.id.carrier_and_update);
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
assertThat(mCarrierInfo.getText().toString())
|
||||
.isEqualTo("Updated by " + DUMMY_CARRIER + " just now");
|
||||
.isEqualTo("Updated by " + FAKE_CARRIER + " just now");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -218,7 +218,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
public void setUsageInfo_withRecentCarrierUpdate_doesNotSetCarrierInfoWarningColorAndFont() {
|
||||
final long updateTime = System.currentTimeMillis() - TimeUnit.HOURS.toMillis(1);
|
||||
mCarrierInfo = (TextView) mHolder.findViewById(R.id.carrier_and_update);
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -231,7 +231,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
@Test
|
||||
public void testSetUsageInfo_withStaleCarrierUpdate_setsCarrierInfoWarningColorAndFont() {
|
||||
final long updateTime = System.currentTimeMillis() - TimeUnit.HOURS.toMillis(7);
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, updateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -244,7 +244,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageInfo_withNoDataPlans_usageTitleNotShown() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -253,7 +253,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageInfo_withMultipleDataPlans_usageTitleShown() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 2 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 2 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -264,7 +264,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
public void testSetUsageInfo_cycleRemainingTimeIsLessOneDay() {
|
||||
// just under one day
|
||||
final long cycleEnd = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(23);
|
||||
mSummaryPreference.setUsageInfo(cycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(cycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -276,7 +276,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
@Test
|
||||
public void testSetUsageInfo_cycleRemainingTimeNegativeDaysLeft_shouldDisplayNoneLeft() {
|
||||
final long cycleEnd = System.currentTimeMillis() - 1L;
|
||||
mSummaryPreference.setUsageInfo(cycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(cycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -290,7 +290,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
final int daysLeft = 3;
|
||||
final long cycleEnd = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(daysLeft)
|
||||
+ TimeUnit.HOURS.toMillis(1);
|
||||
mSummaryPreference.setUsageInfo(cycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(cycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
new Intent());
|
||||
|
||||
bindViewHolder();
|
||||
@@ -369,7 +369,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageAndRemainingInfo_withUsageInfo_dataUsageAndRemainingShown() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
mSummaryPreference.setUsageNumbers(
|
||||
BillingCycleSettings.MIB_IN_BYTES,
|
||||
@@ -386,7 +386,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageInfo_withDataOverusage() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
mSummaryPreference.setUsageNumbers(
|
||||
11 * BillingCycleSettings.MIB_IN_BYTES,
|
||||
@@ -402,7 +402,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
|
||||
@Test
|
||||
public void testSetUsageInfo_withUsageInfo_dataUsageShown() {
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
new Intent());
|
||||
mSummaryPreference.setUsageNumbers(
|
||||
BillingCycleSettings.MIB_IN_BYTES, -1L, true /* hasMobileData */);
|
||||
@@ -419,7 +419,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
intent.setPackage("test-owner.example.com");
|
||||
intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, 42);
|
||||
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
intent);
|
||||
|
||||
bindViewHolder();
|
||||
@@ -448,7 +448,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
doReturn(dataUsed).when(mHolder).findViewById(R.id.data_usage_view);
|
||||
doReturn(dataRemaining).when(mHolder).findViewById(R.id.data_remaining_view);
|
||||
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 1 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 1 /* numPlans */,
|
||||
new Intent());
|
||||
mSummaryPreference.setUsageNumbers(
|
||||
BillingCycleSettings.MIB_IN_BYTES,
|
||||
@@ -484,7 +484,7 @@ public class DataUsageSummaryPreferenceTest {
|
||||
+ TimeUnit.HOURS.toMillis(1);
|
||||
final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
mSummaryPreference = spy(mSummaryPreference);
|
||||
mSummaryPreference.setUsageInfo(cycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
|
||||
mSummaryPreference.setUsageInfo(cycleEnd, mUpdateTime, FAKE_CARRIER, 0 /* numPlans */,
|
||||
new Intent());
|
||||
mSummaryPreference.setUsageNumbers(1000000L, -1L, true);
|
||||
final String cycleText = "The quick fox";
|
||||
|
@@ -21,6 +21,7 @@ import static android.app.slice.Slice.HINT_TITLE;
|
||||
import static android.app.slice.SliceItem.FORMAT_TEXT;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
@@ -152,7 +153,7 @@ public class WifiCallingSliceHelperTest {
|
||||
mQueryImsState.setIsEnabledByUser(false);
|
||||
mQueryImsState.setIsTtyOnVolteEnabled(false);
|
||||
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
||||
mWfcSliceHelper.setActivationAppIntent(new Intent()); // dummy Intent
|
||||
mWfcSliceHelper.setActivationAppIntent(new Intent()); // unused Intent
|
||||
|
||||
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
|
||||
CustomSliceRegistry.WIFI_CALLING_URI);
|
||||
|
Reference in New Issue
Block a user