Fix CTS test failures.

Some tests were passing invalid future timestamps.

Added a couple of new tests for permission checks.

Bug: 7001730
Change-Id: Ia4eb53dbc597f8b1a32f67fb15d8f0a7fae808f8
diff --git a/tests/tests/os/src/android/os/cts/PowerManagerTest.java b/tests/tests/os/src/android/os/cts/PowerManagerTest.java
index 9c248a6..50a3a4f 100644
--- a/tests/tests/os/src/android/os/cts/PowerManagerTest.java
+++ b/tests/tests/os/src/android/os/cts/PowerManagerTest.java
@@ -42,17 +42,36 @@
         Thread.sleep(TIME + MORE_TIME);
         assertFalse(wl.isHeld());
 
-        long baseTime = SystemClock.uptimeMillis();
         try {
-            pm.goToSleep(baseTime + 1);
+            pm.goToSleep(SystemClock.uptimeMillis());
             fail("goToSleep should throw SecurityException");
         } catch (SecurityException e) {
             // expected
         }
-        Thread.sleep(TIME);
 
-        baseTime = SystemClock.uptimeMillis();
-        pm.userActivity(baseTime + 1, false);
-        Thread.sleep(MORE_TIME);
+        try {
+            pm.wakeUp(SystemClock.uptimeMillis());
+            fail("wakeUp should throw SecurityException");
+        } catch (SecurityException e) {
+            // expected
+        }
+
+        try {
+            pm.nap(SystemClock.uptimeMillis());
+            fail("nap should throw SecurityException");
+        } catch (SecurityException e) {
+            // expected
+        }
+
+        try {
+            pm.reboot("Testing");
+            fail("reboot should throw SecurityException");
+        } catch (SecurityException e) {
+            // expected
+        }
+
+        // This method requires DEVICE_POWER but does not throw a SecurityException
+        // for historical reasons.  So this call should be a no-op.
+        pm.userActivity(SystemClock.uptimeMillis(), false);
     }
 }