Merge "Update language to comply with Android’s inclusive language guidance."

This commit is contained in:
Sudheer Shanka
2020-07-30 21:19:38 +00:00
committed by Gerrit Code Review
4 changed files with 18 additions and 19 deletions

View File

@@ -67,7 +67,7 @@ abstract class AbstractAppIdleTestCase extends AbstractRestrictBackgroundNetwork
setAppIdle(true); setAppIdle(true);
launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_ACTIVTIY); launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_ACTIVTIY);
finishActivity(); finishActivity();
assertAppIdle(false); // Sanity check - not idle anymore, since activity was launched... assertAppIdle(false); // verify - not idle anymore, since activity was launched...
assertBackgroundNetworkAccess(true); assertBackgroundNetworkAccess(true);
setAppIdle(true); setAppIdle(true);
assertBackgroundNetworkAccess(false); assertBackgroundNetworkAccess(false);
@@ -86,24 +86,24 @@ abstract class AbstractAppIdleTestCase extends AbstractRestrictBackgroundNetwork
assertBackgroundNetworkAccess(false); assertBackgroundNetworkAccess(false);
addPowerSaveModeWhitelist(TEST_APP2_PKG); addPowerSaveModeWhitelist(TEST_APP2_PKG);
assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted assertAppIdle(false); // verify - not idle anymore, since whitelisted
assertBackgroundNetworkAccess(true); assertBackgroundNetworkAccess(true);
removePowerSaveModeWhitelist(TEST_APP2_PKG); removePowerSaveModeWhitelist(TEST_APP2_PKG);
assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed assertAppIdle(true); // verify - idle again, once whitelisted was removed
assertBackgroundNetworkAccess(false); assertBackgroundNetworkAccess(false);
addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG); addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted assertAppIdle(false); // verify - not idle anymore, since whitelisted
assertBackgroundNetworkAccess(true); assertBackgroundNetworkAccess(true);
removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG); removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed assertAppIdle(true); // verify - idle again, once whitelisted was removed
assertBackgroundNetworkAccess(false); assertBackgroundNetworkAccess(false);
assertsForegroundAlwaysHasNetworkAccess(); assertsForegroundAlwaysHasNetworkAccess();
// Sanity check - no whitelist, no access! // verify - no whitelist, no access!
setAppIdle(true); setAppIdle(true);
assertBackgroundNetworkAccess(false); assertBackgroundNetworkAccess(false);
} }

View File

@@ -240,12 +240,12 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
} }
protected void assertBackgroundNetworkAccess(boolean expectAllowed) throws Exception { protected void assertBackgroundNetworkAccess(boolean expectAllowed) throws Exception {
assertBackgroundState(); // Sanity check. assertBackgroundState();
assertNetworkAccess(expectAllowed /* expectAvailable */, false /* needScreenOn */); assertNetworkAccess(expectAllowed /* expectAvailable */, false /* needScreenOn */);
} }
protected void assertForegroundNetworkAccess() throws Exception { protected void assertForegroundNetworkAccess() throws Exception {
assertForegroundState(); // Sanity check. assertForegroundState();
// We verified that app is in foreground state but if the screen turns-off while // We verified that app is in foreground state but if the screen turns-off while
// verifying for network access, the app will go into background state (in case app's // verifying for network access, the app will go into background state (in case app's
// foreground status was due to top activity). So, turn the screen on when verifying // foreground status was due to top activity). So, turn the screen on when verifying
@@ -254,7 +254,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
} }
protected void assertForegroundServiceNetworkAccess() throws Exception { protected void assertForegroundServiceNetworkAccess() throws Exception {
assertForegroundServiceState(); // Sanity check. assertForegroundServiceState();
assertNetworkAccess(true /* expectAvailable */, false /* needScreenOn */); assertNetworkAccess(true /* expectAvailable */, false /* needScreenOn */);
} }
@@ -385,7 +385,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
} }
// Network status format is described on MyBroadcastReceiver.checkNetworkStatus() // Network status format is described on MyBroadcastReceiver.checkNetworkStatus()
final String[] parts = resultData.split(NETWORK_STATUS_SEPARATOR); final String[] parts = resultData.split(NETWORK_STATUS_SEPARATOR);
assertEquals("Wrong network status: " + resultData, 5, parts.length); // Sanity check assertEquals("Wrong network status: " + resultData, 5, parts.length);
final State state = parts[0].equals("null") ? null : State.valueOf(parts[0]); final State state = parts[0].equals("null") ? null : State.valueOf(parts[0]);
final DetailedState detailedState = parts[1].equals("null") final DetailedState detailedState = parts[1].equals("null")
? null : DetailedState.valueOf(parts[1]); ? null : DetailedState.valueOf(parts[1]);
@@ -558,7 +558,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
// TODO: currently the power-save mode is behaving like idle, but once it changes, we'll // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
// need to use netpolicy for whitelisting // need to use netpolicy for whitelisting
executeShellCommand("dumpsys deviceidle whitelist +" + packageName); executeShellCommand("dumpsys deviceidle whitelist +" + packageName);
assertPowerSaveModeWhitelist(packageName, true); // Sanity check assertPowerSaveModeWhitelist(packageName, true);
} }
protected void removePowerSaveModeWhitelist(String packageName) throws Exception { protected void removePowerSaveModeWhitelist(String packageName) throws Exception {
@@ -566,7 +566,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
// TODO: currently the power-save mode is behaving like idle, but once it changes, we'll // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
// need to use netpolicy for whitelisting // need to use netpolicy for whitelisting
executeShellCommand("dumpsys deviceidle whitelist -" + packageName); executeShellCommand("dumpsys deviceidle whitelist -" + packageName);
assertPowerSaveModeWhitelist(packageName, false); // Sanity check assertPowerSaveModeWhitelist(packageName, false);
} }
protected void assertPowerSaveModeExceptIdleWhitelist(String packageName, boolean expected) protected void assertPowerSaveModeExceptIdleWhitelist(String packageName, boolean expected)
@@ -582,7 +582,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
// TODO: currently the power-save mode is behaving like idle, but once it changes, we'll // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
// need to use netpolicy for whitelisting // need to use netpolicy for whitelisting
executeShellCommand("dumpsys deviceidle except-idle-whitelist +" + packageName); executeShellCommand("dumpsys deviceidle except-idle-whitelist +" + packageName);
assertPowerSaveModeExceptIdleWhitelist(packageName, true); // Sanity check assertPowerSaveModeExceptIdleWhitelist(packageName, true);
} }
protected void removePowerSaveModeExceptIdleWhitelist(String packageName) throws Exception { protected void removePowerSaveModeExceptIdleWhitelist(String packageName) throws Exception {
@@ -591,7 +591,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
// TODO: currently the power-save mode is behaving like idle, but once it changes, we'll // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
// need to use netpolicy for whitelisting // need to use netpolicy for whitelisting
executeShellCommand("dumpsys deviceidle except-idle-whitelist reset"); executeShellCommand("dumpsys deviceidle except-idle-whitelist reset");
assertPowerSaveModeExceptIdleWhitelist(packageName, false); // Sanity check assertPowerSaveModeExceptIdleWhitelist(packageName, false);
} }
protected void turnBatteryOn() throws Exception { protected void turnBatteryOn() throws Exception {
@@ -646,7 +646,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
} }
protected void setDozeMode(boolean enabled) throws Exception { protected void setDozeMode(boolean enabled) throws Exception {
// Sanity check, since tests should check beforehand.... // Check doze mode is supported.
assertTrue("Device does not support Doze Mode", isDozeModeSupported()); assertTrue("Device does not support Doze Mode", isDozeModeSupported());
Log.i(TAG, "Setting Doze Mode to " + enabled); Log.i(TAG, "Setting Doze Mode to " + enabled);
@@ -659,7 +659,6 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
turnBatteryOff(); turnBatteryOff();
executeShellCommand("dumpsys deviceidle unforce"); executeShellCommand("dumpsys deviceidle unforce");
} }
// Sanity check.
assertDozeMode(enabled); assertDozeMode(enabled);
} }
@@ -670,7 +669,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
protected void setAppIdle(boolean enabled) throws Exception { protected void setAppIdle(boolean enabled) throws Exception {
Log.i(TAG, "Setting app idle to " + enabled); Log.i(TAG, "Setting app idle to " + enabled);
executeSilentShellCommand("am set-inactive " + TEST_APP2_PKG + " " + enabled ); executeSilentShellCommand("am set-inactive " + TEST_APP2_PKG + " " + enabled );
assertAppIdle(enabled); // Sanity check assertAppIdle(enabled);
} }
protected void assertAppIdle(boolean enabled) throws Exception { protected void assertAppIdle(boolean enabled) throws Exception {

View File

@@ -67,7 +67,7 @@ public class DataSaverModeTest extends AbstractRestrictBackgroundNetworkTestCase
public void testGetRestrictBackgroundStatus_disabled() throws Exception { public void testGetRestrictBackgroundStatus_disabled() throws Exception {
assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED); assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED);
// Sanity check: make sure status is always disabled, never whitelisted // Verify status is always disabled, never whitelisted
addRestrictBackgroundWhitelist(mUid); addRestrictBackgroundWhitelist(mUid);
assertRestrictBackgroundChangedReceived(0); assertRestrictBackgroundChangedReceived(0);
assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED); assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED);

View File

@@ -367,7 +367,7 @@ public class HostsideRestrictBackgroundNetworkTests extends HostsideNetworkTestC
// TODO: currently the power-save mode is behaving like idle, but once it changes, we'll // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
// need to use netpolicy for whitelisting // need to use netpolicy for whitelisting
runCommand("dumpsys deviceidle whitelist +" + packageName); runCommand("dumpsys deviceidle whitelist +" + packageName);
assertPowerSaveModeWhitelist(packageName, true); // Sanity check assertPowerSaveModeWhitelist(packageName, true);
} }
protected boolean isDozeModeEnabled() throws Exception { protected boolean isDozeModeEnabled() throws Exception {