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
*/
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;
" camera service UID!");
return;
}
- notifySwitchWithRetries(30);
+ notifySwitchWithRetries(RETRY_TIMES);
}
@Override
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);
}
}
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);
}
}
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;
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 {
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;
}