RESTRICT AUTOMERGE Do not run RebootReadinessManagerTest on watch form factors
This commit modifies RebootReadinessManager's CTS tests to be skipped on
devices which have the FEATURE_WATCH flag.
Bug: 285366822
Test: atest CtsRebootReadinessTestCases
Change-Id: If7e16a46e752185468b01f44b888d9b2f2236fdb
diff --git a/tests/src/com/android/cts/scheduling/RebootReadinessManagerTest.java b/tests/src/com/android/cts/scheduling/RebootReadinessManagerTest.java
index 31c233a..c456bde 100644
--- a/tests/src/com/android/cts/scheduling/RebootReadinessManagerTest.java
+++ b/tests/src/com/android/cts/scheduling/RebootReadinessManagerTest.java
@@ -19,12 +19,14 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeFalse;
import android.Manifest;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.PackageManager;
import android.os.HandlerExecutor;
import android.os.HandlerThread;
import android.provider.DeviceConfig;
@@ -36,6 +38,7 @@
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -106,11 +109,19 @@
Thread.sleep(1000);
}
+ @Before
+ public void setUp() {
+ assumeFalse(InstrumentationRegistry.getContext().getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WATCH));
+ }
+
@After
public void tearDown() {
- mRebootReadinessManager.removeRequestRebootReadinessStatusListener(READY_CALLBACK);
- mRebootReadinessManager.removeRequestRebootReadinessStatusListener(BLOCKING_CALLBACK);
- mRebootReadinessManager.cancelPendingReboot();
+ if (mRebootReadinessManager != null) {
+ mRebootReadinessManager.removeRequestRebootReadinessStatusListener(READY_CALLBACK);
+ mRebootReadinessManager.removeRequestRebootReadinessStatusListener(BLOCKING_CALLBACK);
+ mRebootReadinessManager.cancelPendingReboot();
+ }
}
@AfterClass