diff options
| author | Ruben Brunk <rubenbrunk@google.com> | 2015-05-12 16:10:52 -0700 | 
|---|---|---|
| committer | Ruben Brunk <rubenbrunk@google.com> | 2015-05-12 16:10:52 -0700 | 
| commit | be0b6b4a3770a9dd2ff357fe3e88a6ba11a976ff (patch) | |
| tree | 108a879cb7c9f99d5c00695498863c65a66db14e | |
| parent | 804a77d1045c6c4023f73a0975a09025b2e8eef2 (diff) | |
| download | frameworks_av-be0b6b4a3770a9dd2ff357fe3e88a6ba11a976ff.zip frameworks_av-be0b6b4a3770a9dd2ff357fe3e88a6ba11a976ff.tar.gz frameworks_av-be0b6b4a3770a9dd2ff357fe3e88a6ba11a976ff.tar.bz2  | |
camera2: Fix arbitration priority calculation.
- Simplify priority calculation + handle constants
  added for device sleep: FOREGROUND_SERVICE and
  TOP_SLEEPING.
Bug: 19186859
Change-Id: Ia2a5517cd3150deaccb58a0aa1eaa583cb769add
| -rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 32 | ||||
| -rw-r--r-- | services/camera/libcameraservice/CameraService.h | 16 | 
2 files changed, 6 insertions, 42 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 3f80faf..3209be6 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -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__); -            return -1; +    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) { diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index 502fcfa..4cb7fa7 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -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;  | 
