Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12c7ec75 authored by Hui Yu's avatar Hui Yu
Browse files

Revert "Add isUidActiveOrForeground() for camera/audio to use."

Revert "Add isUidActiveOrForeground() for camera/audio to use."

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: I8acde2524201b6c6d0d5c0ff9cfb2053ffbcb8ef
parent ffffffc4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -945,7 +945,7 @@ bool AudioPolicyService::UidPolicy::isUidActive(uid_t uid) {
        }
    }
    ActivityManager am;
    bool active = am.isUidActiveOrForeground(uid, String16("audioserver"));
    bool active = am.isUidActive(uid, String16("audioserver"));
    {
        Mutex::Autolock _l(mLock);
        mCachedUids.insert(std::pair<uid_t,
@@ -990,7 +990,7 @@ int AudioPolicyService::UidPolicy::getUidState(uid_t uid) {
        }
    }
    ActivityManager am;
    bool active = am.isUidActiveOrForeground(uid, String16("audioserver"));
    bool active = am.isUidActive(uid, String16("audioserver"));
    int state = ActivityManager::PROCESS_STATE_UNKNOWN;
    if (active) {
        state = am.getUidProcessState(uid, String16("audioserver"));
+1 −3
Original line number Diff line number Diff line
@@ -3188,9 +3188,7 @@ bool CameraService::UidPolicy::isUidActiveLocked(uid_t uid, String16 callingPack
            // some polling which should happen pretty rarely anyway as the race is hard
            // to hit.
            active = mActiveUids.find(uid) != mActiveUids.end();
            if (!active) {
                active = am.isUidActiveOrForeground(uid, callingPackage);
            }
            if (!active) active = am.isUidActive(uid, callingPackage);
            if (active) {
                break;
            }