类android.os.DeadObjectException源码实例Demo

下面列出了怎么用android.os.DeadObjectException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: android_9.0.0_r45   文件: RuntimeInit.java
/**
 * Report a serious error in the current process.  May or may not cause
 * the process to terminate (depends on system settings).
 *
 * @param tag to record with the error
 * @param t exception describing the error site and conditions
 */
public static void wtf(String tag, Throwable t, boolean system) {
    try {
        if (ActivityManager.getService().handleApplicationWtf(
                mApplicationObject, tag, system,
                new ApplicationErrorReport.ParcelableCrashInfo(t))) {
            // The Activity Manager has already written us off -- now exit.
            Process.killProcess(Process.myPid());
            System.exit(10);
        }
    } catch (Throwable t2) {
        if (t2 instanceof DeadObjectException) {
            // System process is dead; ignore
        } else {
            Slog.e(TAG, "Error reporting WTF", t2);
            Slog.e(TAG, "Original WTF:", t);
        }
    }
}
 
源代码2 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#getStreamTypes ContentProvider.getStreamTypes} */
public @Nullable String[] getStreamTypes(@NonNull Uri url, @NonNull String mimeTypeFilter)
        throws RemoteException {
    Preconditions.checkNotNull(url, "url");
    Preconditions.checkNotNull(mimeTypeFilter, "mimeTypeFilter");

    beforeRemote();
    try {
        return mContentProvider.getStreamTypes(url, mimeTypeFilter);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码3 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#canonicalize} */
public final @Nullable Uri canonicalize(@NonNull Uri url) throws RemoteException {
    Preconditions.checkNotNull(url, "url");

    beforeRemote();
    try {
        return mContentProvider.canonicalize(mPackageName, url);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码4 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#uncanonicalize} */
public final @Nullable Uri uncanonicalize(@NonNull Uri url) throws RemoteException {
    Preconditions.checkNotNull(url, "url");

    beforeRemote();
    try {
        return mContentProvider.uncanonicalize(mPackageName, url);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码5 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#refresh} */
public boolean refresh(Uri url, @Nullable Bundle args,
        @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);
        }
        return mContentProvider.refresh(mPackageName, url, args, remoteCancellationSignal);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码6 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#insert ContentProvider.insert} */
public @Nullable Uri insert(@NonNull Uri url, @Nullable ContentValues initialValues)
        throws RemoteException {
    Preconditions.checkNotNull(url, "url");

    beforeRemote();
    try {
        return mContentProvider.insert(mPackageName, url, initialValues);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码7 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#bulkInsert ContentProvider.bulkInsert} */
public int bulkInsert(@NonNull Uri url, @NonNull ContentValues[] initialValues)
        throws RemoteException {
    Preconditions.checkNotNull(url, "url");
    Preconditions.checkNotNull(initialValues, "initialValues");

    beforeRemote();
    try {
        return mContentProvider.bulkInsert(mPackageName, url, initialValues);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码8 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#delete ContentProvider.delete} */
public int delete(@NonNull Uri url, @Nullable String selection,
        @Nullable String[] selectionArgs) throws RemoteException {
    Preconditions.checkNotNull(url, "url");

    beforeRemote();
    try {
        return mContentProvider.delete(mPackageName, url, selection, selectionArgs);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码9 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#update ContentProvider.update} */
public int update(@NonNull Uri url, @Nullable ContentValues values, @Nullable String selection,
        @Nullable String[] selectionArgs) throws RemoteException {
    Preconditions.checkNotNull(url, "url");

    beforeRemote();
    try {
        return mContentProvider.update(mPackageName, url, values, selection, selectionArgs);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码10 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/**
 * See {@link ContentProvider#openFile ContentProvider.openFile}.  Note that
 * this <em>does not</em>
 * take care of non-content: URIs such as file:.  It is strongly recommended
 * you use the {@link ContentResolver#openFileDescriptor
 * ContentResolver.openFileDescriptor} API instead.
 */
public @Nullable ParcelFileDescriptor openFile(@NonNull Uri url, @NonNull String mode,
        @Nullable CancellationSignal signal) throws RemoteException, FileNotFoundException {
    Preconditions.checkNotNull(url, "url");
    Preconditions.checkNotNull(mode, "mode");

    beforeRemote();
    try {
        ICancellationSignal remoteSignal = null;
        if (signal != null) {
            signal.throwIfCanceled();
            remoteSignal = mContentProvider.createCancellationSignal();
            signal.setRemote(remoteSignal);
        }
        return mContentProvider.openFile(mPackageName, url, mode, remoteSignal, null);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码11 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/**
 * See {@link ContentProvider#openAssetFile ContentProvider.openAssetFile}.
 * Note that this <em>does not</em>
 * take care of non-content: URIs such as file:.  It is strongly recommended
 * you use the {@link ContentResolver#openAssetFileDescriptor
 * ContentResolver.openAssetFileDescriptor} API instead.
 */
public @Nullable AssetFileDescriptor openAssetFile(@NonNull Uri url, @NonNull String mode,
        @Nullable CancellationSignal signal) throws RemoteException, FileNotFoundException {
    Preconditions.checkNotNull(url, "url");
    Preconditions.checkNotNull(mode, "mode");

    beforeRemote();
    try {
        ICancellationSignal remoteSignal = null;
        if (signal != null) {
            signal.throwIfCanceled();
            remoteSignal = mContentProvider.createCancellationSignal();
            signal.setRemote(remoteSignal);
        }
        return mContentProvider.openAssetFile(mPackageName, url, mode, remoteSignal);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码12 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#openTypedAssetFile ContentProvider.openTypedAssetFile} */
public final @Nullable AssetFileDescriptor openTypedAssetFileDescriptor(@NonNull Uri uri,
        @NonNull String mimeType, @Nullable Bundle opts, @Nullable CancellationSignal signal)
                throws RemoteException, FileNotFoundException {
    Preconditions.checkNotNull(uri, "uri");
    Preconditions.checkNotNull(mimeType, "mimeType");

    beforeRemote();
    try {
        ICancellationSignal remoteSignal = null;
        if (signal != null) {
            signal.throwIfCanceled();
            remoteSignal = mContentProvider.createCancellationSignal();
            signal.setRemote(remoteSignal);
        }
        return mContentProvider.openTypedAssetFile(
                mPackageName, uri, mimeType, opts, remoteSignal);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码13 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#applyBatch ContentProvider.applyBatch} */
public @NonNull ContentProviderResult[] applyBatch(
        @NonNull ArrayList<ContentProviderOperation> operations)
                throws RemoteException, OperationApplicationException {
    Preconditions.checkNotNull(operations, "operations");

    beforeRemote();
    try {
        return mContentProvider.applyBatch(mPackageName, operations);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码14 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#call(String, String, Bundle)} */
public @Nullable Bundle call(@NonNull String method, @Nullable String arg,
        @Nullable Bundle extras) throws RemoteException {
    Preconditions.checkNotNull(method, "method");

    beforeRemote();
    try {
        return mContentProvider.call(mPackageName, method, arg, extras);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码15 项目: RxAndroidBle   文件: QueueOperation.java
/**
 * A function that returns this operation as an Observable.
 * When the returned observable is subscribed, this operation will be scheduled
 * to be run on the main thread. When appropriate the call to run() will be executed.
 * This operation is expected to call releaseRadio() at appropriate point after the run() was called.
 */
@Override
public final Observable<T> run(final QueueReleaseInterface queueReleaseInterface) {

    return Observable.create(
            new ObservableOnSubscribe<T>() {
                @Override
                public void subscribe(ObservableEmitter<T> emitter) {
                    try {
                        protectedRun(emitter, queueReleaseInterface);
                    } catch (DeadObjectException deadObjectException) {
                        emitter.tryOnError(provideException(deadObjectException));
                        RxBleLog.e(deadObjectException, "QueueOperation terminated with a DeadObjectException");
                    } catch (Throwable throwable) {
                        emitter.tryOnError(throwable);
                        RxBleLog.e(throwable, "QueueOperation terminated with an unexpected exception");
                    }
                }
            }
    );
}
 
源代码16 项目: TowerCollector   文件: MyApplication.java
private void initUnhandledExceptionHandler() {
    defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(@NotNull Thread thread, @NotNull Throwable ex) {
            Timber.e(ex, "CRASHED");
            if (ExceptionUtils.getRootCause(ex) instanceof SQLiteDatabaseCorruptException) {
                MeasurementsDatabase.deleteDatabase(getApplication());
            }
            // strange but it happens that app is tested on devices with lower SDK - don't send ACRA reports
            // also ignore errors caused by system failures
            if (Build.VERSION.SDK_INT >= BuildConfig.MIN_SDK_VERSION && !(ExceptionUtils.getRootCause(ex) instanceof DeadObjectException)) {
                defaultHandler.uncaughtException(thread, ex);
            }
        }
    });
}
 
源代码17 项目: island   文件: IslandSetup.java
private static void destroyProfile(final Activity activity) {
	@SuppressWarnings("UnnecessaryLocalVariable") final Context context = activity;		// MethodShuttle accepts only Context, but not Activity.
	MethodShuttle.runInProfile(activity, () -> {
		final DevicePolicies policies = new DevicePolicies(context);
		policies.execute(DevicePolicyManager::clearCrossProfileIntentFilters);
		policies.getManager().wipeData(0);
	}).whenComplete((result, e) -> {
		if (e != null && ! (e instanceof DeadObjectException)) {	// DeadObjectException is normal, as wipeData() also terminated the calling process.
			showPromptForProfileManualRemoval(activity);
			return;
		}
		ClonedHiddenSystemApps.reset(activity, Users.profile);
		activity.finishAffinity();	// Finish the whole activity stack.
		System.exit(0);		// Force terminate the whole app, to avoid potential inconsistency.
	});
}
 
源代码18 项目: HAPP   文件: InsulinIntegrationApp.java
public void sendTest(){
    Message msg = Message.obtain();
    Bundle bundle = new Bundle();
    bundle.putString    (Constants.treatmentService.ACTION, Constants.treatmentService.OUTGOING_TEST_MSG);
    bundle.putLong      (Constants.treatmentService.DATE_REQUESTED, new Date().getTime());
    bundle.putString    (Constants.treatmentService.PUMP, "");
    msg.setData(bundle);

    try {
        pump_driver_Service.send(msg);

    } catch (DeadObjectException d){
        Crashlytics.logException(d);
        d.printStackTrace();
    } catch (RemoteException e) {
        Crashlytics.logException(e);
        e.printStackTrace();
    }
}
 
源代码19 项目: android_9.0.0_r45   文件: RuntimeInit.java
@Override
public void uncaughtException(Thread t, Throwable e) {
    try {
        ensureLogging(t, e);

        // Don't re-enter -- avoid infinite loops if crash-reporting crashes.
        if (mCrashing) return;
        mCrashing = true;

        // Try to end profiling. If a profiler is running at this point, and we kill the
        // process (below), the in-memory buffer will be lost. So try to stop, which will
        // flush the buffer. (This makes method trace profiling useful to debug crashes.)
        if (ActivityThread.currentActivityThread() != null) {
            ActivityThread.currentActivityThread().stopProfiling();
        }

        // Bring up crash dialog, wait for it to be dismissed
        ActivityManager.getService().handleApplicationCrash(
                mApplicationObject, new ApplicationErrorReport.ParcelableCrashInfo(e));
    } catch (Throwable t2) {
        if (t2 instanceof DeadObjectException) {
            // System process is dead; ignore
        } else {
            try {
                Clog_e(TAG, "Error reporting crash", t2);
            } catch (Throwable t3) {
                // Even Clog_e() fails!  Oh well.
            }
        }
    } finally {
        // Try everything to make sure this process goes away.
        Process.killProcess(Process.myPid());
        System.exit(10);
    }
}
 
源代码20 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#query ContentProvider.query} */
public @Nullable Cursor query(@NonNull Uri uri, @Nullable String[] projection,
        Bundle queryArgs, @Nullable CancellationSignal cancellationSignal)
                throws RemoteException {
    Preconditions.checkNotNull(uri, "url");

    beforeRemote();
    try {
        ICancellationSignal remoteCancellationSignal = null;
        if (cancellationSignal != null) {
            cancellationSignal.throwIfCanceled();
            remoteCancellationSignal = mContentProvider.createCancellationSignal();
            cancellationSignal.setRemote(remoteCancellationSignal);
        }
        final Cursor cursor = mContentProvider.query(
                mPackageName, uri, projection, queryArgs, remoteCancellationSignal);
        if (cursor == null) {
            return null;
        }
        return new CursorWrapperInner(cursor);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码21 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#getType ContentProvider.getType} */
public @Nullable String getType(@NonNull Uri url) throws RemoteException {
    Preconditions.checkNotNull(url, "url");

    beforeRemote();
    try {
        return mContentProvider.getType(url);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码22 项目: letv   文件: ActivityResponse.java
public void onResult(Bundle result) {
    try {
        this.response.onResult(result);
    } catch (DeadObjectException e) {
        LOG.e(TAG, "[result:" + result + "] on result failed(DeadObjectException)", e);
    } catch (RemoteException e2) {
        LOG.e(TAG, "[result:" + result + "] on result failed(RemoteException)", e2);
    } catch (Throwable e3) {
        LOG.e(TAG, "[result:" + result + "] on result failed(Throwable)", e3);
    }
}
 
源代码23 项目: letv   文件: ActivityResponse.java
public void onError(int error, String message) {
    try {
        this.response.onError(error, message);
    } catch (DeadObjectException e) {
        LOG.e(TAG, "[error:" + error + "][message:" + message + "] on error failed(DeadObjectException)", e);
    } catch (RemoteException e2) {
        LOG.e(TAG, "[error:" + error + "][message:" + message + "] on error failed(RemoteException)", e2);
    } catch (Throwable e3) {
        LOG.e(TAG, "[error:" + error + "][message:" + message + "] on error failed(Throwable)", e3);
    }
}
 
源代码24 项目: letv   文件: ActivityResponse.java
public void onCancel() {
    try {
        this.response.onCancel();
    } catch (DeadObjectException e) {
        LOG.e(TAG, "on cancel failed(DeadObjectException)", e);
    } catch (RemoteException e2) {
        LOG.e(TAG, "on cancel failed(RemoteException)", e2);
    } catch (Throwable e3) {
        LOG.e(TAG, "on cancel failed(Throwable)", e3);
    }
}
 
源代码25 项目: letv   文件: NotificationManagerCompat.java
private void processListenerQueue(ListenerRecord record) {
    if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
        Log.d(NotificationManagerCompat.TAG, "Processing component " + record.componentName + ", " + record.taskQueue.size() + " queued tasks");
    }
    if (!record.taskQueue.isEmpty()) {
        if (!ensureServiceBound(record) || record.service == null) {
            scheduleListenerRetry(record);
            return;
        }
        while (true) {
            Task task = (Task) record.taskQueue.peek();
            if (task == null) {
                break;
            }
            try {
                if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
                    Log.d(NotificationManagerCompat.TAG, "Sending task " + task);
                }
                task.send(record.service);
                record.taskQueue.remove();
            } catch (DeadObjectException e) {
                if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
                    Log.d(NotificationManagerCompat.TAG, "Remote service has died: " + record.componentName);
                }
            } catch (RemoteException e2) {
                Log.w(NotificationManagerCompat.TAG, "RemoteException communicating with " + record.componentName, e2);
            }
        }
        if (!record.taskQueue.isEmpty()) {
            scheduleListenerRetry(record);
        }
    }
}
 
源代码26 项目: container   文件: LocalProxyUtils.java
/**
 * Generates the Proxy instance for a base object, each IPC call will clean its calling identity.
 * @param interfaceClass interface class
 * @param base base object
 * @param handler retry to get the remote object when server dead.
 * @return proxy object
 */
public static <T> T genProxy(Class<T> interfaceClass, final Object base, final DeadServerHandler handler) {
    //noinspection unchecked
    return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[]{ interfaceClass }, new InvocationHandler() {
        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            try {
                return method.invoke(base, args);
            } catch (Throwable e) {
                if (e.getCause() instanceof DeadObjectException) {
                    ServiceManagerNative.clearServerFetcher();
                    if (handler != null) {
                        Object newBase = handler.getNewRemoteInterface();
                        if (newBase != null) {
                            try {
                                return method.invoke(newBase, args);
                            } catch (Throwable retry_e) {
                                throw retry_e.getCause();
                            }
                        }
                        throw e.getCause();
                    }
                }
                throw e.getCause() == null ? e : e.getCause();
            }
        }
    });
}
 
源代码27 项目: AsteroidOSSync   文件: P_AndroidBluetoothManager.java
@Override public final int getBleState()
    {
        try
        {
            if (m_getLeState_marshmallow == null)
            {
                m_getLeState_marshmallow = BluetoothAdapter.class.getDeclaredMethod("getLeState");
            }
            m_refState = (Integer) m_getLeState_marshmallow.invoke(m_adaptor);
            m_state = m_adaptor.getState();
            // This is to fix an issue on the S7 (and perhaps other phones as well), where the OFF
            // state is never returned from the getLeState method. This is because the BLE_ states represent if LE only mode is on/off. This does NOT
            // relate to the Bluetooth radio being on/off. So, we check if STATE_BLE_ON, and the normal getState() method returns OFF, we
            // will return a state of OFF here.
            if (m_refState == BleStatuses.STATE_BLE_ON && m_state == OFF.getNativeCode())
            {
                return m_state;
            }
            else
            {
                // --- RB  > Not sure why this was setting to off, when the above handles the exception we want to handle. Commenting out for now.
//                m_refState = BleStatuses.STATE_OFF;
            }
            return m_refState;
        } catch (Exception e)
        {
            if (e instanceof DeadObjectException)
            {
                BleManager.UhOhListener.UhOh uhoh = BleManager.UhOhListener.UhOh.DEAD_OBJECT_EXCEPTION;
                m_bleManager.uhOh(uhoh);
            }
            return m_adaptor.getState();
        }
    }
 
private boolean isPackageManagerHasDiedException(Throwable e) {
//		1、packageManager.getPackageInfo
//		java.lang.RuntimeException: Package manager has died
//		at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:80)
//		...
//		Caused by: android.os.DeadObjectException
//		at android.os.BinderProxy.transact(Native Method)
//		at android.content.pm.IPackageManager$Stub$Proxy.getPackageInfo(IPackageManager.java:1374)

//		2、contentResolver.query
//		java.lang.RuntimeException: Package manager has died
//		at android.app.ApplicationPackageManager.resolveContentProvider(ApplicationPackageManager.java:636)
//		at android.app.ActivityThread.acquireProvider(ActivityThread.java:4750)
//		at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2234)
//		at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1425)
//		at android.content.ContentResolver.query(ContentResolver.java:445)
//		at android.content.ContentResolver.query(ContentResolver.java:404)
//		at com.qihoo.storager.MultiprocessSharedPreferences.getValue(AppStore:502)
//		...
//		Caused by: android.os.TransactionTooLargeException
//		at android.os.BinderProxy.transact(Native Method)
//		at android.content.pm.IPackageManager$Stub$Proxy.resolveContentProvider(IPackageManager.java:2500)
//		at android.app.ApplicationPackageManager.resolveContentProvider(ApplicationPackageManager.java:634)
		if (e instanceof  RuntimeException
				&& e.getMessage() != null
				&& e.getMessage().contains("Package manager has died")) {
			Throwable cause = getLastCause(e);
			if (cause instanceof DeadObjectException || cause.getClass().getName().equals("android.os.TransactionTooLargeException")) {
				return true;
			}
		}
		return false;
	}
 
源代码29 项目: SweetBlue   文件: P_AndroidBluetoothManager.java
@Override public final int getBleState()
    {
        try
        {
            if (m_getLeState_marshmallow == null)
            {
                m_getLeState_marshmallow = BluetoothAdapter.class.getDeclaredMethod("getLeState");
            }
            m_refState = (Integer) m_getLeState_marshmallow.invoke(m_adaptor);
            m_state = m_adaptor.getState();
            // This is to fix an issue on the S7 (and perhaps other phones as well), where the OFF
            // state is never returned from the getLeState method. This is because the BLE_ states represent if LE only mode is on/off. This does NOT
            // relate to the Bluetooth radio being on/off. So, we check if STATE_BLE_ON, and the normal getState() method returns OFF, we
            // will return a state of OFF here.
            if (m_refState == BleStatuses.STATE_BLE_ON && m_state == OFF.getNativeCode())
            {
                return m_state;
            }
            else
            {
                // --- RB  > Not sure why this was setting to off, when the above handles the exception we want to handle. Commenting out for now.
//                m_refState = BleStatuses.STATE_OFF;
            }
            return m_refState;
        } catch (Exception e)
        {
            if (e instanceof DeadObjectException)
            {
                BleManager.UhOhListener.UhOh uhoh = BleManager.UhOhListener.UhOh.DEAD_OBJECT_EXCEPTION;
                m_bleManager.uhOh(uhoh);
            }
            return m_adaptor.getState();
        }
    }
 
源代码30 项目: android-sdk   文件: SensorbergService.java
public void send(BeaconEvent beaconEvent) {
    for (Messenger messenger : storage) {
        try {
            Message message = Message.obtain(null, SensorbergServiceMessage.MSG_PRESENT_ACTION);
            Bundle bundle = new Bundle();
            bundle.putParcelable(SensorbergServiceMessage.MSG_PRESENT_ACTION_BEACONEVENT, beaconEvent);
            message.setData(bundle);
            messenger.send(message);
        } catch (DeadObjectException d) {
            //we need to remove this object!!
        } catch (RemoteException e) {
            logError("something went wrong sending BeaconEvent through Messenger", e);
        }
    }
}
 
 类所在包
 同包方法