[AAE Pwr Mgt] Don't allow non-Car jobs to delay SHUTDOWN_PREPARE
Some Car jobs need to do asynchronous processing when we enter
the SHUTDOWN_PREPARE power state. We use a CompletableFuture to
coordinate this processing.
Non-Car jobs might not behave nicely and might not signal that the
future completed. To prevent a bad non-Car job from blocking the
car power state machine, this CL uses two types of listeners: one
that signals completion and one that does not. A CompletableFuture is
given only to jobs that register using 'registerListenerWithCompletion,'
which is only callable from the system process.
Fixes: 130440556
Test: On Hawk, using CAN simulator to trigger power state changes
Change-Id: I92db99a1a82d89ff700cfe99e466df08cbbb7e6d
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index 34492fc..116919d 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -259,7 +259,7 @@
mCarUserService.onSwitchUser(userHandle);
}
- private static void assertCallingFromSystemProcess() {
+ static void assertCallingFromSystemProcess() {
int uid = Binder.getCallingUid();
if (uid != Process.SYSTEM_UID) {
throw new SecurityException("Only allowed from system");