Revert "Add isUidActiveOrForeground for camera/audio to use."
Revert submission 10829580-isUidForeground Reason for revert: In CameraService.cpp, before this change, around "am.isUidActive", there was up to 300 ms retry. After this change, the code could move forward fast without retry, but at "mAppOpsManager->startOpNoThrow" call, for the same reason as uid is not updated fast enough, "mAppOpsManager->startOpNoThrow" could also fail. This CL does not really fix the root cause, but it changes the timing and now the code fails at "mAppOpsManager->startOpNoThrow" call. Also the timing change may also cause recent multiple CTS test failures. Bug: 154570809, 155032617, 154849083 Reverted Changes: Iffed63293:Add isUidActiveOrForeground() for camera/audio to ... I3685e0c8d:Add isUidActiveOrForeground() for camera/audio to ... I51ed1fe78:Add isUidActiveOrForeground for camera/audio to us... Change-Id: I9fbeb190c5a0ac640ad5be8140fe4aaeb7cfe33d
This commit is contained in:
parent
ef6532c9d4
commit
94ea7ac7e0
4 changed files with 20 additions and 43 deletions
|
@ -98,15 +98,6 @@ 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<IActivityManager> service = getService();
|
||||
if (service != nullptr) {
|
||||
return service->isUidActiveOrForeground(uid, callingPackage);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
status_t ActivityManager::linkToDeath(const sp<IBinder::DeathRecipient>& recipient) {
|
||||
sp<IActivityManager> service = getService();
|
||||
if (service != nullptr) {
|
||||
|
|
|
@ -104,18 +104,6 @@ public:
|
|||
}
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
|
|
@ -46,24 +46,25 @@ public:
|
|||
PROCESS_STATE_PERSISTENT = 0,
|
||||
PROCESS_STATE_PERSISTENT_UI = 1,
|
||||
PROCESS_STATE_TOP = 2,
|
||||
PROCESS_STATE_BOUND_TOP = 3,
|
||||
PROCESS_STATE_FOREGROUND_SERVICE = 4,
|
||||
PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 5,
|
||||
PROCESS_STATE_IMPORTANT_FOREGROUND = 6,
|
||||
PROCESS_STATE_IMPORTANT_BACKGROUND = 7,
|
||||
PROCESS_STATE_TRANSIENT_BACKGROUND = 8,
|
||||
PROCESS_STATE_BACKUP = 9,
|
||||
PROCESS_STATE_SERVICE = 10,
|
||||
PROCESS_STATE_RECEIVER = 11,
|
||||
PROCESS_STATE_TOP_SLEEPING = 12,
|
||||
PROCESS_STATE_HEAVY_WEIGHT = 13,
|
||||
PROCESS_STATE_HOME = 14,
|
||||
PROCESS_STATE_LAST_ACTIVITY = 15,
|
||||
PROCESS_STATE_CACHED_ACTIVITY = 16,
|
||||
PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 17,
|
||||
PROCESS_STATE_CACHED_RECENT = 18,
|
||||
PROCESS_STATE_CACHED_EMPTY = 19,
|
||||
PROCESS_STATE_NONEXISTENT = 20,
|
||||
PROCESS_STATE_FOREGROUND_SERVICE_LOCATION = 3,
|
||||
PROCESS_STATE_BOUND_TOP = 4,
|
||||
PROCESS_STATE_FOREGROUND_SERVICE = 5,
|
||||
PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 6,
|
||||
PROCESS_STATE_IMPORTANT_FOREGROUND = 7,
|
||||
PROCESS_STATE_IMPORTANT_BACKGROUND = 8,
|
||||
PROCESS_STATE_TRANSIENT_BACKGROUND = 9,
|
||||
PROCESS_STATE_BACKUP = 10,
|
||||
PROCESS_STATE_SERVICE = 11,
|
||||
PROCESS_STATE_RECEIVER = 12,
|
||||
PROCESS_STATE_TOP_SLEEPING = 13,
|
||||
PROCESS_STATE_HEAVY_WEIGHT = 14,
|
||||
PROCESS_STATE_HOME = 15,
|
||||
PROCESS_STATE_LAST_ACTIVITY = 16,
|
||||
PROCESS_STATE_CACHED_ACTIVITY = 17,
|
||||
PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 18,
|
||||
PROCESS_STATE_CACHED_RECENT = 19,
|
||||
PROCESS_STATE_CACHED_EMPTY = 20,
|
||||
PROCESS_STATE_NONEXISTENT = 21,
|
||||
};
|
||||
|
||||
ActivityManager();
|
||||
|
@ -76,7 +77,6 @@ public:
|
|||
void unregisterUidObserver(const sp<IUidObserver>& observer);
|
||||
bool isUidActive(const uid_t uid, const String16& callingPackage);
|
||||
int getUidProcessState(const uid_t uid, const String16& callingPackage);
|
||||
bool isUidActiveOrForeground(const uid_t uid, const String16& callingPackage);
|
||||
|
||||
|
||||
status_t linkToDeath(const sp<IBinder::DeathRecipient>& recipient);
|
||||
|
|
|
@ -39,15 +39,13 @@ public:
|
|||
virtual void unregisterUidObserver(const sp<IUidObserver>& observer) = 0;
|
||||
virtual bool isUidActive(const uid_t uid, const String16& callingPackage) = 0;
|
||||
virtual int32_t getUidProcessState(const uid_t uid, const String16& callingPackage) = 0;
|
||||
virtual bool isUidActiveOrForeground(const uid_t uid, const String16& callingPackage) = 0;
|
||||
|
||||
enum {
|
||||
OPEN_CONTENT_URI_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
|
||||
REGISTER_UID_OBSERVER_TRANSACTION,
|
||||
UNREGISTER_UID_OBSERVER_TRANSACTION,
|
||||
IS_UID_ACTIVE_TRANSACTION,
|
||||
GET_UID_PROCESS_STATE_TRANSACTION,
|
||||
IS_UID_ACTIVE_OR_FOREGROUND_TRANSACTION,
|
||||
GET_UID_PROCESS_STATE_TRANSACTION
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue