当前位置: 首页>>代码示例>>Java>>正文


Java DeathRecipient类代码示例

本文整理汇总了Java中android.os.IBinder.DeathRecipient的典型用法代码示例。如果您正苦于以下问题:Java DeathRecipient类的具体用法?Java DeathRecipient怎么用?Java DeathRecipient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DeathRecipient类属于android.os.IBinder包,在下文中一共展示了DeathRecipient类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPref

import android.os.IBinder.DeathRecipient; //导入依赖的package包/类
/**
 * @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;
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:25,代码来源:PluginProviderStub.java

示例2: newSession

import android.os.IBinder.DeathRecipient; //导入依赖的package包/类
public boolean newSession(ICustomTabsCallback callback) {
    final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback);

    try {
        DeathRecipient e = new DeathRecipient() {
            public void binderDied() {
                CustomTabsService.this.cleanUpSession(sessionToken);
            }
        };
        synchronized (CustomTabsService.this.mDeathRecipientMap) {
            callback.asBinder().linkToDeath(e, 0);
            CustomTabsService.this.mDeathRecipientMap.put(callback.asBinder(), e);
        }

        return CustomTabsService.this.newSession(sessionToken);
    } catch (RemoteException var7) {
        return false;
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:20,代码来源:CustomTabsService.java

示例3: newSession

import android.os.IBinder.DeathRecipient; //导入依赖的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

示例4: newSession

import android.os.IBinder.DeathRecipient; //导入依赖的package包/类
@Override
public boolean newSession(ICustomTabsCallback callback) {
    final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback);
    try {
        DeathRecipient deathRecipient = new 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:plusCubed,项目名称:anticipate,代码行数:20,代码来源:CustomTabsService.java

示例5: cleanUpSession

import android.os.IBinder.DeathRecipient; //导入依赖的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;
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:15,代码来源:CustomTabsService.java

示例6: cleanUpSession

import android.os.IBinder.DeathRecipient; //导入依赖的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;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:CustomTabsService.java

示例7: cleanUpSession

import android.os.IBinder.DeathRecipient; //导入依赖的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;
}
 
开发者ID:GoogleChrome,项目名称:custom-tabs-client,代码行数:24,代码来源:CustomTabsService.java

示例8: linkToDeath

import android.os.IBinder.DeathRecipient; //导入依赖的package包/类
public void linkToDeath(DeathRecipient deathRecipient, int i) throws RemoteException {
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:3,代码来源:MyFakeIBinder.java

示例9: unlinkToDeath

import android.os.IBinder.DeathRecipient; //导入依赖的package包/类
public boolean unlinkToDeath(DeathRecipient deathRecipient, int i) {
    return false;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:MyFakeIBinder.java


注:本文中的android.os.IBinder.DeathRecipient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。