本文整理匯總了Java中android.os.IBinder.DeathRecipient方法的典型用法代碼示例。如果您正苦於以下問題:Java IBinder.DeathRecipient方法的具體用法?Java IBinder.DeathRecipient怎麽用?Java IBinder.DeathRecipient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.os.IBinder
的用法示例。
在下文中一共展示了IBinder.DeathRecipient方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newSession
import android.os.IBinder; //導入方法依賴的package包/類
@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;
}
}
示例2: linkToDeath
import android.os.IBinder; //導入方法依賴的package包/類
/**
* 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) {
}
}
示例3: unLinkToDeath
import android.os.IBinder; //導入方法依賴的package包/類
/**
* 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) {
}
}
示例4: subscribe
import android.os.IBinder; //導入方法依賴的package包/類
@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();
}
}
}
示例5: linkBinderDied
import android.os.IBinder; //導入方法依賴的package包/類
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();
}
}
示例6: linkBinderDied
import android.os.IBinder; //導入方法依賴的package包/類
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();
}
}