本文整理汇总了Java中android.os.IBinder.unlinkToDeath方法的典型用法代码示例。如果您正苦于以下问题:Java IBinder.unlinkToDeath方法的具体用法?Java IBinder.unlinkToDeath怎么用?Java IBinder.unlinkToDeath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.IBinder
的用法示例。
在下文中一共展示了IBinder.unlinkToDeath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanUpSession
import android.os.IBinder; //导入方法依赖的package包/类
protected boolean cleanUpSession(CustomTabsSessionToken sessionToken) {
try {
Map e = this.mDeathRecipientMap;
synchronized (this.mDeathRecipientMap) {
IBinder binder = sessionToken.getCallbackBinder();
DeathRecipient deathRecipient = this.mDeathRecipientMap.get(binder);
binder.unlinkToDeath(deathRecipient, 0);
this.mDeathRecipientMap.remove(binder);
return true;
}
} catch (NoSuchElementException var7) {
return false;
}
}
示例2: cleanUpSession
import android.os.IBinder; //导入方法依赖的package包/类
/**
* 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;
}
示例3: 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();
}
}
示例4: 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();
}
}