summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2015-09-03 12:24:24 -0700
committerEino-Ville Talvala <etalvala@google.com>2015-09-03 12:24:24 -0700
commit52aad85627f5216e7a3d9db425d2cc409f998a01 (patch)
tree8733629f149e3bd00e56d99afc55a28bf441f004 /services
parent3ca51aa9c8eb670b3b93ab37350fa4e0a0397bd6 (diff)
downloadframeworks_av-52aad85627f5216e7a3d9db425d2cc409f998a01.zip
frameworks_av-52aad85627f5216e7a3d9db425d2cc409f998a01.tar.gz
frameworks_av-52aad85627f5216e7a3d9db425d2cc409f998a01.tar.bz2
CameraService: Treat TOP_SLEEPING same as TOP for priority.
When arbitrating between camera clients, treat processes in the TOP_SLEEPING state with the same high priority as processes in the TOP state. This resolves race conditions during lock screen handoffs between clients such as face unlock (a bound foreground process) and a secure camera app (the topmost activity, but transitioning from TOP_SLEEPING to TOP asynchronously from the activity lifecycle callbacks). Bug: 23731720 Change-Id: I92c3f8f561c7725627826c0ba3dc926e99af746c
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/CameraService.cpp5
-rw-r--r--services/camera/libcameraservice/CameraService.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index d289704..f5a0887 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -602,6 +602,11 @@ int CameraService::getCameraPriorityFromProcState(int procState) {
procState);
return -1;
}
+ // Treat sleeping TOP processes the same as regular TOP processes, for
+ // access priority. This is important for lock-screen camera launch scenarios
+ if (procState == PROCESS_STATE_TOP_SLEEPING) {
+ procState = PROCESS_STATE_TOP;
+ }
return INT_MAX - procState;
}
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index a8c6b6c..330a19d 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -75,6 +75,8 @@ public:
// 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;