當前位置: 首頁>>代碼示例>>Java>>正文


Java IBinder.DeathRecipient方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:20,代碼來源:CustomTabsService.java

示例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) {
    }
}
 
開發者ID:josesamuel,項目名稱:RxRemote,代碼行數:10,代碼來源:RemoteEventListener_Proxy.java

示例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) {
    }
}
 
開發者ID:josesamuel,項目名稱:RxRemote,代碼行數:10,代碼來源:RemoteEventListener_Proxy.java

示例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();
        }
    }
}
 
開發者ID:josesamuel,項目名稱:RxRemote,代碼行數:33,代碼來源:RemoteEventController.java

示例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();
	}
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:14,代碼來源:ServiceManagerNative.java

示例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();
    }
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:14,代碼來源:ServiceManagerNative.java


注:本文中的android.os.IBinder.DeathRecipient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。