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

Commit 2882bb9a authored by Ruben Brunk's avatar Ruben Brunk Committed by Android (Google) Code Review
Browse files

Merge "camera2: Fix arbitration priority calculation." into mnc-dev

parents 94183482 be0b6b4a
Loading
Loading
Loading
Loading
+5 −27
Original line number Diff line number Diff line
@@ -519,34 +519,12 @@ String8 CameraService::getFormattedCurrentTime() {
int CameraService::getCameraPriorityFromProcState(int procState) {
    // Find the priority for the camera usage based on the process state.  Higher priority clients
    // win for evictions.
    // Note: Unlike the ordering for ActivityManager, persistent system processes will always lose
    //       the camera to the top/foreground applications.
    switch(procState) {
        case PROCESS_STATE_TOP: // User visible
            return 100;
        case PROCESS_STATE_IMPORTANT_FOREGROUND: // Foreground
            return 90;
        case PROCESS_STATE_PERSISTENT: // Persistent system services
        case PROCESS_STATE_PERSISTENT_UI:
            return 80;
        case PROCESS_STATE_IMPORTANT_BACKGROUND: // "Important" background processes
            return 70;
        case PROCESS_STATE_BACKUP: // Everything else
        case PROCESS_STATE_HEAVY_WEIGHT:
        case PROCESS_STATE_SERVICE:
        case PROCESS_STATE_RECEIVER:
        case PROCESS_STATE_HOME:
        case PROCESS_STATE_LAST_ACTIVITY:
        case PROCESS_STATE_CACHED_ACTIVITY:
        case PROCESS_STATE_CACHED_ACTIVITY_CLIENT:
        case PROCESS_STATE_CACHED_EMPTY:
            return 1;
        case PROCESS_STATE_NONEXISTENT:
            return -1;
        default:
            ALOGE("%s: Received unknown process state from ActivityManagerService!", __FUNCTION__);
    if (procState < 0) {
        ALOGE("%s: Received invalid process state %d from ActivityManagerService!", __FUNCTION__,
                procState);
        return -1;
    }
    return INT_MAX - procState;
}

status_t CameraService::getCameraVendorTagDescriptor(/*out*/sp<VendorTagDescriptor>& desc) {
+1 −15
Original line number Diff line number Diff line
@@ -71,22 +71,8 @@ public:
        API_2 = 2
    };

    // Process States (mirrors frameworks/base/core/java/android/app/ActivityManager.java)
    // Process state (mirrors frameworks/base/core/java/android/app/ActivityManager.java)
    static const int PROCESS_STATE_NONEXISTENT = -1;
    static const int PROCESS_STATE_PERSISTENT = 0;
    static const int PROCESS_STATE_PERSISTENT_UI = 1;
    static const int PROCESS_STATE_TOP = 2;
    static const int PROCESS_STATE_IMPORTANT_FOREGROUND = 3;
    static const int PROCESS_STATE_IMPORTANT_BACKGROUND = 4;
    static const int PROCESS_STATE_BACKUP = 5;
    static const int PROCESS_STATE_HEAVY_WEIGHT = 6;
    static const int PROCESS_STATE_SERVICE = 7;
    static const int PROCESS_STATE_RECEIVER = 8;
    static const int PROCESS_STATE_HOME = 9;
    static const int PROCESS_STATE_LAST_ACTIVITY = 10;
    static const int PROCESS_STATE_CACHED_ACTIVITY = 11;
    static const int PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 12;
    static const int PROCESS_STATE_CACHED_EMPTY = 13;

    // 3 second busy timeout when other clients are connecting
    static const nsecs_t DEFAULT_CONNECT_TIMEOUT_NS = 3000000000;