diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2022-04-05 21:13:46 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-04-05 21:13:46 +0000 |
commit | bf3d81d41125f5261166ce8d3e5bb5487e2dd9a4 (patch) | |
tree | 2a362e3e9006b269bfac817ce9abd1deed5be944 | |
parent | d4391aa039936f5ec7a6b525c38f5c62736ebcd7 (diff) | |
parent | 9b626ee6f805f06c6b38cfd3a5bc99df07abbc4e (diff) | |
download | cts-bf3d81d41125f5261166ce8d3e5bb5487e2dd9a4.tar.gz |
Merge "DO NOT MERGE: cts: Re-launch the desired activity after screen-on on TVs." into pie-cts-dev
2 files changed, 11 insertions, 0 deletions
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java index 1844878f647..30d8c27a84b 100644 --- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java +++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java @@ -1028,6 +1028,11 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation } } + protected void startActivity() throws Exception { + final Intent launchIntent = getIntentForComponent(TYPE_COMPONENT_ACTIVTIY); + mContext.startActivity(launchIntent); + } + private void startForegroundService() throws Exception { final Intent launchIntent = getIntentForComponent(TYPE_COMPONENT_FOREGROUND_SERVICE); mContext.startForegroundService(launchIntent); diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java index c3962fbbc39..5c4a59ef01b 100644 --- a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java +++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java @@ -21,6 +21,7 @@ import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED; import android.util.Log; +import static com.android.compatibility.common.util.FeatureUtil.isTV; import com.android.compatibility.common.util.CddTest; @@ -146,6 +147,11 @@ public class DataSaverModeTest extends AbstractRestrictBackgroundNetworkTestCase turnScreenOff(); assertBackgroundNetworkAccess(false); turnScreenOn(); + // On some TVs, it is possible that the activity on top may change after the screen is + // turned off and on again, so relaunch the activity in the test app again. + if (isTV()) { + startActivity(); + } assertForegroundNetworkAccess(); // Goes back to background state. |