Add API to query if a UID is active
Test: cts-tradefed run cts-dev -m CtsCameraTestCases Bug: 72863398 Change-Id: I4bacfd87cac782ef178e9a279cd833b229150ae1
This commit is contained in:
committed by
Svetoslav Ganov
parent
4acd39d3db
commit
0c1c9cd7f2
@@ -94,6 +94,7 @@ interface IActivityManager {
|
||||
void registerUidObserver(in IUidObserver observer, int which, int cutpoint,
|
||||
String callingPackage);
|
||||
void unregisterUidObserver(in IUidObserver observer);
|
||||
boolean isUidActive(int uid, String callingPackage);
|
||||
// =============== End of transactions used on native side as well ============================
|
||||
|
||||
// Special low-level communication with activity manager.
|
||||
|
||||
@@ -14051,6 +14051,18 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUidActive(int uid, String callingPackage) {
|
||||
if (!hasUsageStatsPermission(callingPackage)) {
|
||||
enforceCallingPermission(android.Manifest.permission.PACKAGE_USAGE_STATS,
|
||||
"getPackageProcessState");
|
||||
}
|
||||
synchronized (this) {
|
||||
final UidRecord uidRecord = mActiveUids.get(uid);
|
||||
return uidRecord != null && !uidRecord.setIdle;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convertFromTranslucent(IBinder token) {
|
||||
final long origId = Binder.clearCallingIdentity();
|
||||
|
||||
Reference in New Issue
Block a user