summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/camera/CameraServiceProxy.java36
1 files changed, 21 insertions, 15 deletions
diff --git a/services/core/java/com/android/server/camera/CameraServiceProxy.java b/services/core/java/com/android/server/camera/CameraServiceProxy.java
index 527539d8ce0d..7733d6779e48 100644
--- a/services/core/java/com/android/server/camera/CameraServiceProxy.java
+++ b/services/core/java/com/android/server/camera/CameraServiceProxy.java
@@ -50,7 +50,7 @@ import java.util.List;
import java.util.Set;
/**
- * CameraServiceProxy is the system_server analog to the camera service running in mediaserver.
+ * CameraServiceProxy is the system_server analog to the camera service running in cameraserver.
*
* @hide
*/
@@ -74,6 +74,7 @@ public class CameraServiceProxy extends SystemService
private static final int MSG_SWITCH_USER = 1;
private static final int RETRY_DELAY_TIME = 20; //ms
+ private static final int RETRY_TIMES = 30;
// Maximum entries to keep in usage history before dumping out
private static final int MAX_USAGE_HISTORY = 100;
@@ -171,7 +172,7 @@ public class CameraServiceProxy extends SystemService
" camera service UID!");
return;
}
- notifySwitchWithRetries(30);
+ notifySwitchWithRetries(RETRY_TIMES);
}
@Override
@@ -242,7 +243,8 @@ public class CameraServiceProxy extends SystemService
public void onStartUser(int userHandle) {
synchronized(mLock) {
if (mEnabledCameraUsers == null) {
- // Initialize mediaserver, or update mediaserver if we are recovering from a crash.
+ // Initialize cameraserver, or update cameraserver if we are recovering
+ // from a crash.
switchUserLocked(userHandle);
}
}
@@ -324,9 +326,9 @@ public class CameraServiceProxy extends SystemService
Set<Integer> currentUserHandles = getEnabledUserHandles(userHandle);
mLastUser = userHandle;
if (mEnabledCameraUsers == null || !mEnabledCameraUsers.equals(currentUserHandles)) {
- // Some user handles have been added or removed, update mediaserver.
+ // Some user handles have been added or removed, update cameraserver.
mEnabledCameraUsers = currentUserHandles;
- notifyMediaserverLocked(ICameraService.EVENT_USER_SWITCHED, currentUserHandles);
+ notifySwitchWithRetriesLocked(RETRY_TIMES);
}
}
@@ -343,12 +345,16 @@ public class CameraServiceProxy extends SystemService
private void notifySwitchWithRetries(int retries) {
synchronized(mLock) {
- if (mEnabledCameraUsers == null) {
- return;
- }
- if (notifyMediaserverLocked(ICameraService.EVENT_USER_SWITCHED, mEnabledCameraUsers)) {
- retries = 0;
- }
+ notifySwitchWithRetriesLocked(retries);
+ }
+ }
+
+ private void notifySwitchWithRetriesLocked(int retries) {
+ if (mEnabledCameraUsers == null) {
+ return;
+ }
+ if (notifyCameraserverLocked(ICameraService.EVENT_USER_SWITCHED, mEnabledCameraUsers)) {
+ retries = 0;
}
if (retries <= 0) {
return;
@@ -358,13 +364,13 @@ public class CameraServiceProxy extends SystemService
RETRY_DELAY_TIME);
}
- private boolean notifyMediaserverLocked(int eventType, Set<Integer> updatedUserHandles) {
- // Forward the user switch event to the native camera service running in the mediaserver
+ private boolean notifyCameraserverLocked(int eventType, Set<Integer> updatedUserHandles) {
+ // Forward the user switch event to the native camera service running in the cameraserver
// process.
if (mCameraServiceRaw == null) {
IBinder cameraServiceBinder = getBinderService(CAMERA_SERVICE_BINDER_NAME);
if (cameraServiceBinder == null) {
- Slog.w(TAG, "Could not notify mediaserver, camera service not available.");
+ Slog.w(TAG, "Could not notify cameraserver, camera service not available.");
return false; // Camera service not active, cannot evict user clients.
}
try {
@@ -380,7 +386,7 @@ public class CameraServiceProxy extends SystemService
try {
mCameraServiceRaw.notifySystemEvent(eventType, toArray(updatedUserHandles));
} catch (RemoteException e) {
- Slog.w(TAG, "Could not notify mediaserver, remote exception: " + e);
+ Slog.w(TAG, "Could not notify cameraserver, remote exception: " + e);
// Not much we can do if camera service is dead.
return false;
}