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

Commit 5a280ea7 authored by Hui Yu's avatar Hui Yu Committed by Android (Google) Code Review
Browse files

Merge "Add isUidActiveOrForeground() for camera/audio to use." into rvc-dev

parents 32230040 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.isUidActive(uid, String16("audioserver"));
    bool active = am.isUidActiveOrForeground(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.isUidActive(uid, String16("audioserver"));
    bool active = am.isUidActiveOrForeground(uid, String16("audioserver"));
    int state = ActivityManager::PROCESS_STATE_UNKNOWN;
    if (active) {
        state = am.getUidProcessState(uid, String16("audioserver"));
+3 −1
Original line number Diff line number Diff line
@@ -3188,7 +3188,9 @@ 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.isUidActive(uid, callingPackage);
            if (!active) {
                active = am.isUidActiveOrForeground(uid, callingPackage);
            }
            if (active) {
                break;
            }