Add isUidActiveOrForeground for camera/audio to use.
The new interface isUidActiveOrForeground will call AM.isUidActiveOrForeground()
which check isUidActive() first, if flase, then check isUidForeground.
Bug: 151185692, 151777097, 109950150
Test: manual test.
Change-Id: I51ed1fe780dbead0688e73a37c6c762f84e8bf23
diff --git a/libs/binder/IActivityManager.cpp b/libs/binder/IActivityManager.cpp
index 1eb5363..9e1249b 100644
--- a/libs/binder/IActivityManager.cpp
+++ b/libs/binder/IActivityManager.cpp
@@ -104,6 +104,18 @@
}
return reply.readInt32();
}
+
+ virtual bool isUidActiveOrForeground(const uid_t uid, const String16& callingPackage)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IActivityManager::getInterfaceDescriptor());
+ data.writeInt32(uid);
+ data.writeString16(callingPackage);
+ remote()->transact(IS_UID_ACTIVE_OR_FOREGROUND_TRANSACTION, data, &reply);
+ // fail on exception
+ if (reply.readExceptionCode() != 0) return false;
+ return reply.readInt32() == 1;
+ }
};
// ------------------------------------------------------------------------------------