diff options
author | 2018-10-18 14:56:24 -0700 | |
---|---|---|
committer | 2018-11-27 17:50:31 -0800 | |
commit | 0559589bd6fd3f8e97480d09e9f6e57011d2b950 (patch) | |
tree | 073b2cddd0c8d024de008ca42f24252558d3f89b /libs/binder/IActivityManager.cpp | |
parent | 910c0aa1384ee3122a4d3929ca3b94943a3dc539 (diff) |
Activity manager: native callback for process state
Make getUidProcessState() callback in IActivityManager.aidl
available to native processes.
Test: Manual test with audio recording apps pushed to background and back
to top.
Bug: 111438757
Change-Id: I16d001dcaeb3e9a38743aa7b301445c94fe5dc99
Diffstat (limited to 'libs/binder/IActivityManager.cpp')
-rw-r--r-- | libs/binder/IActivityManager.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/binder/IActivityManager.cpp b/libs/binder/IActivityManager.cpp index 428db4d579..377f604d44 100644 --- a/libs/binder/IActivityManager.cpp +++ b/libs/binder/IActivityManager.cpp @@ -17,8 +17,8 @@ #include <unistd.h> #include <fcntl.h> +#include <binder/ActivityManager.h> #include <binder/IActivityManager.h> - #include <binder/Parcel.h> namespace android { @@ -90,6 +90,20 @@ public: if (reply.readExceptionCode() != 0) return false; return reply.readInt32() == 1; } + + virtual int32_t getUidProcessState(const uid_t uid, const String16& callingPackage) + { + Parcel data, reply; + data.writeInterfaceToken(IActivityManager::getInterfaceDescriptor()); + data.writeInt32(uid); + data.writeString16(callingPackage); + remote()->transact(GET_UID_PROCESS_STATE_TRANSACTION, data, &reply); + // fail on exception + if (reply.readExceptionCode() != 0) { + return ActivityManager::PROCESS_STATE_UNKNOWN; + } + return reply.readInt32(); + } }; // ------------------------------------------------------------------------------------ |