From ef6532c9d46439e4773435c10624d097a53978df Mon Sep 17 00:00:00 2001 From: Hui Yu Date: Tue, 24 Mar 2020 16:12:07 -0700 Subject: 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 --- libs/binder/ActivityManager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libs/binder/ActivityManager.cpp') diff --git a/libs/binder/ActivityManager.cpp b/libs/binder/ActivityManager.cpp index 5e4c98fc7a..4f2709d91a 100644 --- a/libs/binder/ActivityManager.cpp +++ b/libs/binder/ActivityManager.cpp @@ -98,6 +98,15 @@ int32_t ActivityManager::getUidProcessState(const uid_t uid, const String16& cal return PROCESS_STATE_UNKNOWN; } +bool ActivityManager::isUidActiveOrForeground(const uid_t uid, const String16& callingPackage) +{ + sp service = getService(); + if (service != nullptr) { + return service->isUidActiveOrForeground(uid, callingPackage); + } + return false; +} + status_t ActivityManager::linkToDeath(const sp& recipient) { sp service = getService(); if (service != nullptr) { -- cgit v1.2.3-59-g8ed1b