use of android.os.DeadObjectException in project android_frameworks_base by ResurrectionRemix.
the class CameraManager method throwAsPublicException.
/**
* Convert ServiceSpecificExceptions and Binder RemoteExceptions from camera binder interfaces
* into the correct public exceptions.
*
* @hide
*/
public static void throwAsPublicException(Throwable t) throws CameraAccessException {
if (t instanceof ServiceSpecificException) {
ServiceSpecificException e = (ServiceSpecificException) t;
int reason = CameraAccessException.CAMERA_ERROR;
switch(e.errorCode) {
case ICameraService.ERROR_DISCONNECTED:
reason = CameraAccessException.CAMERA_DISCONNECTED;
break;
case ICameraService.ERROR_DISABLED:
reason = CameraAccessException.CAMERA_DISABLED;
break;
case ICameraService.ERROR_CAMERA_IN_USE:
reason = CameraAccessException.CAMERA_IN_USE;
break;
case ICameraService.ERROR_MAX_CAMERAS_IN_USE:
reason = CameraAccessException.MAX_CAMERAS_IN_USE;
break;
case ICameraService.ERROR_DEPRECATED_HAL:
reason = CameraAccessException.CAMERA_DEPRECATED_HAL;
break;
case ICameraService.ERROR_ILLEGAL_ARGUMENT:
case ICameraService.ERROR_ALREADY_EXISTS:
throw new IllegalArgumentException(e.getMessage(), e);
case ICameraService.ERROR_PERMISSION_DENIED:
throw new SecurityException(e.getMessage(), e);
case ICameraService.ERROR_TIMED_OUT:
case ICameraService.ERROR_INVALID_OPERATION:
default:
reason = CameraAccessException.CAMERA_ERROR;
}
throw new CameraAccessException(reason, e.getMessage(), e);
} else if (t instanceof DeadObjectException) {
throw new CameraAccessException(CameraAccessException.CAMERA_DISCONNECTED, "Camera service has died unexpectedly", t);
} else if (t instanceof RemoteException) {
throw new UnsupportedOperationException("An unknown RemoteException was thrown" + " which should never happen.", t);
} else if (t instanceof RuntimeException) {
RuntimeException e = (RuntimeException) t;
throw e;
}
}
use of android.os.DeadObjectException in project android_frameworks_base by crdroidandroid.
the class MediaSessionRecord method pushNowPlayingContentChange.
private void pushNowPlayingContentChange() {
synchronized (mLock) {
if (mDestroyed) {
return;
}
for (int i = mControllerCallbacks.size() - 1; i >= 0; i--) {
ISessionControllerCallback cb = mControllerCallbacks.get(i);
try {
Log.d(TAG, "pushNowPlayingContentChange");
cb.onUpdateNowPlayingContentChange();
} catch (DeadObjectException e) {
Log.w(TAG, "Removing dead callback in pushNowPlayingContentChange. ", e);
mControllerCallbacks.remove(i);
} catch (RemoteException e) {
Log.w(TAG, "unexpected exception in pushNowPlayingContentChange. ", e);
}
}
}
}
use of android.os.DeadObjectException in project android_frameworks_base by crdroidandroid.
the class MediaSessionRecord method pushBrowsePlayerInfo.
private void pushBrowsePlayerInfo() {
synchronized (mLock) {
if (mDestroyed) {
return;
}
for (int i = mControllerCallbacks.size() - 1; i >= 0; i--) {
ISessionControllerCallback cb = mControllerCallbacks.get(i);
try {
Log.d(TAG, "pushBrowsePlayerInfo");
cb.onUpdateFolderInfoBrowsedPlayer(mBrowsedPlayerURI);
} catch (DeadObjectException e) {
Log.w(TAG, "Removing dead callback in pushBrowsePlayerInfo. ", e);
mControllerCallbacks.remove(i);
} catch (RemoteException e) {
Log.w(TAG, "unexpected exception in pushBrowsePlayerInfo. ", e);
}
}
}
}
use of android.os.DeadObjectException in project android_frameworks_base by crdroidandroid.
the class MediaSessionRecord method pushPlayItemResponse.
private void pushPlayItemResponse() {
synchronized (mLock) {
if (mDestroyed) {
return;
}
for (int i = mControllerCallbacks.size() - 1; i >= 0; i--) {
ISessionControllerCallback cb = mControllerCallbacks.get(i);
try {
Log.d(TAG, "pushPlayItemResponse");
cb.onPlayItemResponse(mPlayItemStatus);
} catch (DeadObjectException e) {
Log.w(TAG, "Removing dead callback in pushPlayItemResponse. ", e);
mControllerCallbacks.remove(i);
} catch (RemoteException e) {
Log.w(TAG, "unexpected exception in pushPlayItemResponse. ", e);
}
}
}
}
use of android.os.DeadObjectException in project android_frameworks_base by crdroidandroid.
the class ContentProviderClient method query.
/** See {@link ContentProvider#query ContentProvider.query} */
@Nullable
public Cursor query(@NonNull Uri url, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder, @Nullable CancellationSignal cancellationSignal) throws RemoteException {
Preconditions.checkNotNull(url, "url");
beforeRemote();
try {
ICancellationSignal remoteCancellationSignal = null;
if (cancellationSignal != null) {
cancellationSignal.throwIfCanceled();
remoteCancellationSignal = mContentProvider.createCancellationSignal();
cancellationSignal.setRemote(remoteCancellationSignal);
}
final Cursor cursor = mContentProvider.query(mPackageName, url, projection, selection, selectionArgs, sortOrder, remoteCancellationSignal);
if (cursor == null) {
return null;
}
if ("com.google.android.gms".equals(mPackageName)) {
// They're casting to a concrete subclass, sigh
return cursor;
} else {
return new CursorWrapperInner(cursor);
}
} catch (DeadObjectException e) {
if (!mStable) {
mContentResolver.unstableProviderDied(mContentProvider);
}
throw e;
} finally {
afterRemote();
}
}
Aggregations