Java Code Examples for android.os.IBinder.DeathRecipient

The following are Jave code examples for showing how to use DeathRecipient of the android.os.IBinder class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: chromium-for-android-56-debug-video   File: CustomTabsService.java   Source Code and License Vote up 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
Project: RxRemote   File: RemoteEventListener_Proxy.java   Source Code and License Vote up 5 votes
/**
 * Register a {@link android.os.IBinder.DeathRecipient} to know of binder connection lose
 */
public void linkToDeath(IBinder.DeathRecipient deathRecipient) {
    try {
        mRemote.linkToDeath(deathRecipient, 0);
    } catch (Exception ignored) {
    }
}
 
Example 3
Project: RxRemote   File: RemoteEventListener_Proxy.java   Source Code and License Vote up 5 votes
/**
 * UnRegister a {@link android.os.IBinder.DeathRecipient} to know of binder connection lose
 */
public void unLinkToDeath(IBinder.DeathRecipient deathRecipient) {
    try {
        mRemote.unlinkToDeath(deathRecipient, 0);
    } catch (Exception ignored) {
    }
}
 
Example 4
Project: RxRemote   File: RemoteEventManager_Proxy.java   Source Code and License Vote up 5 votes
/**
 * Register a {@link android.os.IBinder.DeathRecipient} to know of binder connection lose
 */
public void linkToDeath(IBinder.DeathRecipient deathRecipient) {
    try {
        mRemote.linkToDeath(deathRecipient, 0);
    } catch (Exception ignored) {
    }
}
 
Example 5
Project: RxRemote   File: RemoteEventManager_Proxy.java   Source Code and License Vote up 5 votes
/**
 * UnRegister a {@link android.os.IBinder.DeathRecipient} to know of binder connection lose
 */
public void unLinkToDeath(IBinder.DeathRecipient deathRecipient) {
    try {
        mRemote.unlinkToDeath(deathRecipient, 0);
    } catch (Exception ignored) {
    }
}
 
Example 6
Project: RxRemote   File: RemoteEventController.java   Source Code and License Vote up 5 votes
@Override
public void subscribe(final RemoteEventListener listener) {
    if (DEBUG) {
        Log.v(TAG, "onSubscribe " + completed + " " + lastEvent);
    }
    synchronized (LOCK) {
        this.listener = listener;
        if (!completed) {
            RemoteEventController.this.onSubscribed();
            if (listener instanceof RemoteEventListener_Proxy) {
                deathRecipient = new IBinder.DeathRecipient() {
                    @Override
                    public void binderDied() {
                        if (DEBUG) {
                            Log.v(TAG, "Binder dead");
                        }
                        unsubscribe();
                    }
                };
                ((RemoteEventListener_Proxy) listener).linkToDeath(deathRecipient);
            }
        }
        if (lastEvent != null) {
            sendEventToObservable(lastEvent, dataType);
        }
        if (lastException != null) {
            sendOnError(lastException);
        } else if (completed) {
            sendOnCompleted();
        }
    }
}
 
Example 7
Project: VirtualHook   File: ServiceManagerNative.java   Source Code and License Vote up 5 votes
private static void linkBinderDied(final IBinder binder) {
	IBinder.DeathRecipient deathRecipient = new IBinder.DeathRecipient() {
		@Override
		public void binderDied() {
			binder.unlinkToDeath(this, 0);
		}
	};
	try {
		binder.linkToDeath(deathRecipient, 0);
	} catch (RemoteException e) {
		e.printStackTrace();
	}
}
 
Example 8
Project: TPlayer   File: ServiceManagerNative.java   Source Code and License Vote up 5 votes
private static void linkBinderDied(final IBinder binder) {
    IBinder.DeathRecipient deathRecipient = new IBinder.DeathRecipient() {
        @Override
        public void binderDied() {
            binder.unlinkToDeath(this, 0);
        }
    };
    try {
        binder.linkToDeath(deathRecipient, 0);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 9
Project: container   File: ServiceManagerNative.java   Source Code and License Vote up 5 votes
private static void linkBinderDied(final IBinder binder) {
	IBinder.DeathRecipient deathRecipient = new IBinder.DeathRecipient() {
		@Override
		public void binderDied() {
			binder.unlinkToDeath(this, 0);
		}
	};
	try {
		binder.linkToDeath(deathRecipient, 0);
	} catch (RemoteException e) {
		e.printStackTrace();
	}
}