@Override public void startListening() { try { super.startListening(); } catch (Exception e) { if (e.getCause() instanceof TransactionTooLargeException || e.getCause() instanceof DeadObjectException) { // We're willing to let this slide. The exception is being caused by the list of // RemoteViews which is being passed back. The startListening relationship will // have been established by this point, and we will end up populating the // widgets upon bind anyway. See issue 14255011 for more context. } else { throw new RuntimeException(e); } } }
public void stop(){ /** * Unbinds from the service. Should be called when the client app does not need this class anymore. */ Log.i("REMOTE_HANDLER", "stopping client"); if(isBound) { if (mRemoteService != null) { try { mRemoteService.unregisterCallback(mCallback); } catch (DeadObjectException de){ de.printStackTrace(); } catch (RemoteException e) { // There is nothing special we need to do if the service // has crashed. } } context.unbindService(mRemoteServiceConnection); isBound = false; } snachServiceEvent.onServiceDisconnected(); }
/** * 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 Action1<Emitter<T>>() { @Override public void call(Emitter<T> emitter) { try { protectedRun(emitter, queueReleaseInterface); } catch (DeadObjectException deadObjectException) { emitter.onError(provideException(deadObjectException)); } catch (Throwable throwable) { emitter.onError(throwable); } } }, Emitter.BackpressureMode.NONE ); }
private void transmitMitBihData() { try { // iterates through all values for (mSimPlotIter = 0; mSimPlotIter < mSimSignal.mValueList.getMaxSize(); mSimPlotIter++) { // new instance BleEcgSensor.BleEcgDataFrame data = new BleEcgSensor.BleEcgDataFrame(this, mSimSignal.mTimeList.get(mSimPlotIter), mSimSignal.mValueList.get(mSimPlotIter), (char) mSimSignal.labels.get(mSimSignal.mTimeList.get(mSimPlotIter).intValue())); sendNewData(data); Thread.sleep(2, 777777); } sendNotification("MSG_SIM_FILE_ENDED"); } catch (Exception e) { Log.e(TAG, "Error receiving MIT-BIH data!", e); if (DeadObjectException.class.isInstance(e)) { Thread.currentThread().interrupt(); mSimSignal = null; } } }
public final <A extends Api.zzb, T extends zzmu.zza<? extends Result, A>> T zzb(T paramT) { try { this.zzape.zzaoR.zzb(paramT); Api.zzb localzzb = this.zzape.zzaoR.zza(paramT.zzor()); if ((!localzzb.isConnected()) && (this.zzape.zzaqj.containsKey(paramT.zzor()))) { paramT.zzE(new Status(17)); return paramT; } paramT.zzb(localzzb); return paramT; } catch (DeadObjectException localDeadObjectException) { this.zzape.zza(new zznf.zza(this) { public final void zzoS() { zzna.this.onConnectionSuspended(1); } }); } return paramT; }
public final void zzb(A paramA) throws DeadObjectException { try { zza(paramA); return; } catch (DeadObjectException localDeadObjectException) { zzc(localDeadObjectException); throw localDeadObjectException; } catch (RemoteException localRemoteException) { zzc(localRemoteException); } }
public final void zza(zzp paramzzp) { ValidateAccountRequest localValidateAccountRequest = new ValidateAccountRequest(paramzzp, (Scope[])this.zzXp.toArray(new Scope[this.zzXp.size()]), this.mContext.getPackageName(), null); try { this.zzatN.zza(new zzd(this, this.zzatW.get()), localValidateAccountRequest); return; } catch (DeadObjectException localDeadObjectException) { Log.w("GmsClient", "service died"); zzdg$13462e(); return; } catch (RemoteException localRemoteException) { Log.w("GmsClient", "Remote exception occurred", localRemoteException); } }
public final T zzqn() throws DeadObjectException { synchronized (this.zzqp) { if (this.zzatS == 4) { throw new DeadObjectException(); } } zzqm(); if (this.zzatP != null) {} for (boolean bool = true;; bool = false) { zzx.zza(bool, "Client is connected but service is null"); IInterface localIInterface = this.zzatP; return localIInterface; } }
public final T l() { synchronized (this.c) { if (this.n == 4) { throw new DeadObjectException(); } } k(); if (this.f != null) {} for (boolean bool = true;; bool = false) { efj.a(bool, "Client is connected but service is null"); IInterface localIInterface = this.f; return localIInterface; } }
public final void b(A paramA) { try { a(paramA); return; } catch (DeadObjectException localDeadObjectException) { a(localDeadObjectException); throw localDeadObjectException; } catch (RemoteException localRemoteException) { a(localRemoteException); } }
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(); } }
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); } }
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); } }
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); } }
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); } } }
public WidgetsModel updateAndClone(Context context) { Preconditions.assertWorkerThread(); try { final ArrayList<WidgetItem> widgetsAndShortcuts = new ArrayList<>(); // Widgets AppWidgetManagerCompat widgetManager = AppWidgetManagerCompat.getInstance(context); for (AppWidgetProviderInfo widgetInfo : widgetManager.getAllProviders()) { widgetsAndShortcuts.add(new WidgetItem( LauncherAppWidgetProviderInfo.fromProviderInfo(context, widgetInfo), widgetManager)); } // Shortcuts PackageManager pm = context.getPackageManager(); for (ResolveInfo info : pm.queryIntentActivities(new Intent(Intent.ACTION_CREATE_SHORTCUT), 0)) { widgetsAndShortcuts.add(new WidgetItem(info, pm)); } setWidgetsAndShortcuts(widgetsAndShortcuts); } catch (Exception e) { if (!ProviderConfig.IS_DOGFOOD_BUILD && (e.getCause() instanceof TransactionTooLargeException || e.getCause() instanceof DeadObjectException)) { // the returned value may be incomplete and will not be refreshed until the next // time Launcher starts. // TODO: after figuring out a repro step, introduce a dirty bit to check when // onResume is called to refresh the widget provider list. } else { throw e; } } return clone(); }
/** * 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(); } } }); }
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) // 3、ApplicationPackageManager.isSafeMode // java.lang.RuntimeException: Package manager has died // at android.app.ApplicationPackageManager.isSafeMode(ApplicationPackageManager.java:820) 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; }
@Override public void onButtonPressed(int BUTTON_ID) { try { serviceCallback.OnButtonPressed(BUTTON_ID); } catch (DeadObjectException de) { de.printStackTrace(); }catch (RemoteException e) { e.printStackTrace(); } }
private void unbindAllClients(){ if(serviceCallback != null){ try { serviceCallback.StopClient(); } catch (DeadObjectException de){ de.printStackTrace(); } catch (RemoteException re){ re.printStackTrace(); } } }
public void sendAppContent(ListAppContentItem appContentItem){ try { mRemoteService.setUpListAppContent(appContentItem); } catch (DeadObjectException de){ de.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } }
public void sendAppContent(ActionAppContentItem appContentItem){ try { mRemoteService.setUpActionAppContent(appContentItem); } catch (DeadObjectException de){ de.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } }
public void sendPopUpContent(PopUpContentItem popUpContentItem){ try { mRemoteService.setUpPopUpContent(popUpContentItem); } catch (DeadObjectException de){ de.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } }
@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(); } }
public final void zza(zzp paramzzp, Set<Scope> paramSet) { try { Bundle localBundle = zzjM(); GetServiceRequest localGetServiceRequest = new GetServiceRequest(this.zzatV); localGetServiceRequest.zzatH = this.mContext.getPackageName(); localGetServiceRequest.zzatK = localBundle; if (paramSet != null) { localGetServiceRequest.zzatJ = ((Scope[])paramSet.toArray(new Scope[paramSet.size()])); } if (zzkc()) { if (this.zzRE == null) { break label134; } } label134: for (Account localAccount = this.zzRE;; localAccount = new Account("<<default account>>", "com.google")) { localGetServiceRequest.zzatL = localAccount; if (paramzzp != null) { localGetServiceRequest.zzatI = paramzzp.asBinder(); } this.zzatN.zza(new zzd(this, this.zzatW.get()), localGetServiceRequest); return; } return; } catch (DeadObjectException localDeadObjectException) { Log.w("GmsClient", "service died"); zzdg$13462e(); return; } catch (RemoteException localRemoteException) { Log.w("GmsClient", "Remote exception occurred", localRemoteException); } }
public final void onConnected(Bundle paramBundle) { zzx.zzcx("MeasurementServiceConnection.onConnected"); for (;;) { final zzl localzzl; try { this.zzboM = false; } finally {} try { localzzl = (zzl)this.zzboN.zzqn(); this.zzboN = null; zzz.this.zzBY().zzg(new Runnable() { public final void run() { if (!zzz.this.isConnected()) { zzz.this.zzBh().zzbnd.zzeB("Connected to remote service"); zzz.zza(zzz.this, localzzl); } } }); return; } catch (IllegalStateException localIllegalStateException) { continue; } catch (DeadObjectException localDeadObjectException) { continue; } this.zzboN = null; } }
public final void a() { while (!this.a.f.isEmpty()) { try { a((egt)this.a.f.remove()); } catch (DeadObjectException localDeadObjectException) {} } }
public final <A extends efb, T extends efs<? extends efn, A>> T b(T paramT) { try { a(paramT); return paramT; } catch (DeadObjectException localDeadObjectException) { this.a.a(new efv(this, this)); } return paramT; }
final boolean a(int paramInt1, int paramInt2, int paramInt3, Object paramObject, Bundle paramBundle) { Message localMessage = Message.obtain(); localMessage.what = paramInt1; localMessage.arg1 = paramInt2; localMessage.arg2 = paramInt3; localMessage.obj = paramObject; localMessage.setData(paramBundle); localMessage.replyTo = this.i; try { this.a.send(localMessage); return true; } catch (RemoteException localRemoteException) { if (paramInt1 != 2) { Log.e("MediaRouteProviderProxy", "Could not send message to service.", localRemoteException); } return false; } catch (DeadObjectException localDeadObjectException) { label74: break label74; } }
public final void a(ehs paramehs) { ValidateAccountRequest localValidateAccountRequest = new ValidateAccountRequest(paramehs, (Scope[])this.o.toArray(new Scope[this.o.size()]), this.i.getPackageName(), null); try { this.d.a(new eif(this, this.l.get()), localValidateAccountRequest); return; } catch (DeadObjectException localDeadObjectException) { a(1); return; } catch (RemoteException localRemoteException) {} }
public WidgetsModel updateAndClone(Context context) { Utilities.assertWorkerThread(); try { final ArrayList<Object> widgetsAndShortcuts = new ArrayList<>(); // Widgets for (AppWidgetProviderInfo widgetInfo : AppWidgetManagerCompat.getInstance(context).getAllProviders()) { widgetsAndShortcuts.add(LauncherAppWidgetProviderInfo .fromProviderInfo(context, widgetInfo)); } // Shortcuts widgetsAndShortcuts.addAll(context.getPackageManager().queryIntentActivities( new Intent(Intent.ACTION_CREATE_SHORTCUT), 0)); setWidgetsAndShortcuts(widgetsAndShortcuts); } catch (Exception e) { if (!LauncherAppState.isDogfoodBuild() && (e.getCause() instanceof TransactionTooLargeException || e.getCause() instanceof DeadObjectException)) { // the returned value may be incomplete and will not be refreshed until the next // time Launcher starts. // TODO: after figuring out a repro step, introduce a dirty bit to check when // onResume is called to refresh the widget provider list. } else { throw e; } } return clone(); }
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; }
public int sendMessage(Message message){ if(this.messenger == null){return SEND_MESSAGE_ERROR_MESSENGER_NULL;} if(message == null){return SEND_MESSAGE_ERROR_MESSAGE_NULL;} try { this.messenger.send(message); return SEND_MESSAGE_SUCCESS; } catch (RemoteException e) { e.printStackTrace(); if(e instanceof DeadObjectException){ return SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT; }else{ return SEND_MESSAGE_ERROR_MESSENGER_GENERIC_EXCEPTION; } } }
private void onRemoteException(RemoteException e) { if (e instanceof DeadObjectException) { Logger.log("Callback is dead - shutting down"); } else { Logger.log(e); } }
public static boolean isBinderSizeError(Exception e) { return e.getCause() instanceof TransactionTooLargeException || e.getCause() instanceof DeadObjectException; }