Camera service: Update client eviction priorities
Use both oom score and process state for client eviction.
The score will have higher priority over the process state.
This should resolve the state ambiguity when PiP clients
try to connect to exclusive camera resources while
foreground clients are running.
BUG: 34701266
Test: Manual testing, complete CTS Camera package
Change-Id: Ic775b011a20e50f9c0c1c0a4bc1cf7ca75410740
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index d463b59..c7acdc9 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -75,11 +75,6 @@
API_2 = 2
};
- // Process state (mirrors frameworks/base/core/java/android/app/ActivityManager.java)
- static const int PROCESS_STATE_NONEXISTENT = -1;
- static const int PROCESS_STATE_TOP = 2;
- static const int PROCESS_STATE_TOP_SLEEPING = 5;
-
// 3 second busy timeout when other clients are connecting
static const nsecs_t DEFAULT_CONNECT_TIMEOUT_NS = 3000000000;
@@ -402,8 +397,8 @@
* Make a ClientDescriptor object wrapping the given BasicClient strong pointer.
*/
static DescriptorPtr makeClientDescriptor(const String8& key, const sp<BasicClient>& value,
- int32_t cost, const std::set<String8>& conflictingKeys, int32_t priority,
- int32_t ownerId);
+ int32_t cost, const std::set<String8>& conflictingKeys, int32_t score,
+ int32_t ownerId, int32_t state);
/**
* Make a ClientDescriptor object wrapping the given BasicClient strong pointer with
@@ -775,11 +770,6 @@
*/
static String8 getFormattedCurrentTime();
- /**
- * Get the camera eviction priority from the current process state given by ActivityManager.
- */
- static int getCameraPriorityFromProcState(int procState);
-
static binder::Status makeClient(const sp<CameraService>& cameraService,
const sp<IInterface>& cameraCb, const String16& packageName, const String8& cameraId,
int facing, int clientPid, uid_t clientUid, int servicePid, bool legacyMode,