android.os.IBinder.DeathRecipient Java Examples
The following examples show how to use
android.os.IBinder.DeathRecipient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomTabsService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public boolean newSession(ICustomTabsCallback callback) { final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback); try { DeathRecipient deathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { cleanUpSession(sessionToken); } }; synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } }
Example #2
Source File: CustomTabsService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public boolean newSession(ICustomTabsCallback callback) { final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback); try { DeathRecipient deathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { cleanUpSession(sessionToken); } }; synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } }
Example #3
Source File: CustomTabsService.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public boolean newSession(ICustomTabsCallback callback) { final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback); try { DeathRecipient deathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { cleanUpSession(sessionToken); } }; synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } }
Example #4
Source File: CustomTabsService.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public boolean newSession(ICustomTabsCallback callback) { final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback); try { DeathRecipient deathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { cleanUpSession(sessionToken); } }; synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } }
Example #5
Source File: PluginProviderStub.java From springreplugin with Apache License 2.0 | 6 votes |
/** * @param context * @return * @throws RemoteException */ public static final IPref getPref(Context context) throws RemoteException { if (sPref == null) { if (IPC.isPersistentProcess()) { // 需要枷锁否? initPref(); } else { IBinder b = PluginProviderStub.proxyFetchHostPref(context); b.linkToDeath(new DeathRecipient() { @Override public void binderDied() { sPref = null; } }, 0); sPref = IPref.Stub.asInterface(b); } } return sPref; }
Example #6
Source File: CustomTabsService.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public boolean newSession(ICustomTabsCallback callback) { final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback); try { DeathRecipient deathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { cleanUpSession(sessionToken); } }; synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } }
Example #7
Source File: CustomTabsService.java From 365browser with Apache License 2.0 | 6 votes |
@Override public boolean newSession(ICustomTabsCallback callback) { final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback); try { DeathRecipient deathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { cleanUpSession(sessionToken); } }; synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } }
Example #8
Source File: CustomTabsService.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * Called when the client side {@link IBinder} for this {@link CustomTabsSessionToken} is dead. * Can also be used to clean up {@link DeathRecipient} instances allocated for the given token. * * @param sessionToken The session token for which the {@link DeathRecipient} call has been * received. * @return Whether the clean up was successful. Multiple calls with two tokens holdings the * same binder will return false. */ protected boolean cleanUpSession(CustomTabsSessionToken sessionToken) { try { synchronized (mDeathRecipientMap) { IBinder binder = sessionToken.getCallbackBinder(); DeathRecipient deathRecipient = mDeathRecipientMap.get(binder); binder.unlinkToDeath(deathRecipient, 0); mDeathRecipientMap.remove(binder); } } catch (NoSuchElementException e) { return false; } return true; }
Example #9
Source File: Installer.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void connect() { IBinder binder = ServiceManager.getService("installd"); if (binder != null) { try { binder.linkToDeath(new DeathRecipient() { @Override public void binderDied() { Slog.w(TAG, "installd died; reconnecting"); connect(); } }, 0); } catch (RemoteException e) { binder = null; } } if (binder != null) { mInstalld = IInstalld.Stub.asInterface(binder); try { invalidateMounts(); } catch (InstallerException ignored) { } } else { Slog.w(TAG, "installd not found; trying again"); BackgroundThread.getHandler().postDelayed(() -> { connect(); }, DateUtils.SECOND_IN_MILLIS); } }
Example #10
Source File: CustomTabsService.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * Called when the client side {@link IBinder} for this {@link CustomTabsSessionToken} is dead. * Can also be used to clean up {@link DeathRecipient} instances allocated for the given token. * * @param sessionToken The session token for which the {@link DeathRecipient} call has been * received. * @return Whether the clean up was successful. Multiple calls with two tokens holdings the * same binder will return false. */ protected boolean cleanUpSession(CustomTabsSessionToken sessionToken) { try { synchronized (mDeathRecipientMap) { IBinder binder = sessionToken.getCallbackBinder(); DeathRecipient deathRecipient = mDeathRecipientMap.get(binder); binder.unlinkToDeath(deathRecipient, 0); mDeathRecipientMap.remove(binder); } } catch (NoSuchElementException e) { return false; } return true; }
Example #11
Source File: CustomTabsService.java From 365browser with Apache License 2.0 | 5 votes |
/** * Called when the client side {@link IBinder} for this {@link CustomTabsSessionToken} is dead. * Can also be used to clean up {@link DeathRecipient} instances allocated for the given token. * * @param sessionToken The session token for which the {@link DeathRecipient} call has been * received. * @return Whether the clean up was successful. Multiple calls with two tokens holdings the * same binder will return false. */ protected boolean cleanUpSession(CustomTabsSessionToken sessionToken) { try { synchronized (mDeathRecipientMap) { IBinder binder = sessionToken.getCallbackBinder(); DeathRecipient deathRecipient = mDeathRecipientMap.get(binder); binder.unlinkToDeath(deathRecipient, 0); mDeathRecipientMap.remove(binder); } } catch (NoSuchElementException e) { return false; } return true; }
Example #12
Source File: CustomTabsService.java From custom-tabs-client with Apache License 2.0 | 5 votes |
/** * Called when the client side {@link IBinder} for this {@link CustomTabsSessionToken} is dead. * Can also be used to clean up {@link DeathRecipient} instances allocated for the given token. * * @param sessionToken The session token for which the {@link DeathRecipient} call has been * received. * @return Whether the clean up was successful. Multiple calls with two tokens holdings the * same binder will return false. */ protected boolean cleanUpSession(CustomTabsSessionToken sessionToken) { try { synchronized (mDeathRecipientMap) { IBinder binder = sessionToken.getCallbackBinder(); DeathRecipient deathRecipient = mDeathRecipientMap.get(binder); binder.unlinkToDeath(deathRecipient, 0); mDeathRecipientMap.remove(binder); } } catch (NoSuchElementException e) { return false; } return true; }
Example #13
Source File: CustomTabsService.java From custom-tabs-client with Apache License 2.0 | 5 votes |
private boolean newSessionInternal(ICustomTabsCallback callback, PendingIntent sessionId) { final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback, sessionId); try { DeathRecipient deathRecipient = () -> cleanUpSession(sessionToken); synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } }
Example #14
Source File: CustomTabsService.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Called when the client side {@link IBinder} for this {@link CustomTabsSessionToken} is dead. * Can also be used to clean up {@link DeathRecipient} instances allocated for the given token. * @param sessionToken The session token for which the {@link DeathRecipient} call has been * received. * @return Whether the clean up was successful. Multiple calls with two tokens holdings the * same binder will return false. */ protected boolean cleanUpSession(CustomTabsSessionToken sessionToken) { try { synchronized (mDeathRecipientMap) { IBinder binder = sessionToken.getCallbackBinder(); DeathRecipient deathRecipient = mDeathRecipientMap.get(binder); binder.unlinkToDeath(deathRecipient, 0); mDeathRecipientMap.remove(binder); } } catch (NoSuchElementException e) { return false; } return true; }
Example #15
Source File: CustomTabsService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Called when the client side {@link IBinder} for this {@link CustomTabsSessionToken} is dead. * Can also be used to clean up {@link DeathRecipient} instances allocated for the given token. * * @param sessionToken The session token for which the {@link DeathRecipient} call has been * received. * @return Whether the clean up was successful. Multiple calls with two tokens holdings the * same binder will return false. */ protected boolean cleanUpSession(CustomTabsSessionToken sessionToken) { try { synchronized (mDeathRecipientMap) { IBinder binder = sessionToken.getCallbackBinder(); DeathRecipient deathRecipient = mDeathRecipientMap.get(binder); binder.unlinkToDeath(deathRecipient, 0); mDeathRecipientMap.remove(binder); } } catch (NoSuchElementException e) { return false; } return true; }
Example #16
Source File: CustomTabsService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Called when the client side {@link IBinder} for this {@link CustomTabsSessionToken} is dead. * Can also be used to clean up {@link DeathRecipient} instances allocated for the given token. * * @param sessionToken The session token for which the {@link DeathRecipient} call has been * received. * @return Whether the clean up was successful. Multiple calls with two tokens holdings the * same binder will return false. */ protected boolean cleanUpSession(CustomTabsSessionToken sessionToken) { try { synchronized (mDeathRecipientMap) { IBinder binder = sessionToken.getCallbackBinder(); DeathRecipient deathRecipient = mDeathRecipientMap.get(binder); binder.unlinkToDeath(deathRecipient, 0); mDeathRecipientMap.remove(binder); } } catch (NoSuchElementException e) { return false; } return true; }
Example #17
Source File: MyFakeIBinder.java From letv with Apache License 2.0 | 4 votes |
public boolean unlinkToDeath(DeathRecipient deathRecipient, int i) { return false; }
Example #18
Source File: MyFakeIBinder.java From letv with Apache License 2.0 | 4 votes |
public void linkToDeath(DeathRecipient deathRecipient, int i) throws RemoteException { }