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


Java RemoteException類代碼示例

本文整理匯總了Java中android.os.RemoteException的典型用法代碼示例。如果您正苦於以下問題:Java RemoteException類的具體用法?Java RemoteException怎麽用?Java RemoteException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RemoteException類屬於android.os包,在下文中一共展示了RemoteException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onServiceConnected

import android.os.RemoteException; //導入依賴的package包/類
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    // Ignore this call if we disconnected in the meantime.
    if (mContext == null) return;

    mService = new Messenger(service);
    mComponentName = name;
    try {
        Message registerClientMessage = Message.obtain(
                null, REQUEST_REGISTER_CLIENT);
        registerClientMessage.replyTo = mMessenger;
        Bundle b = mGsaHelper.getBundleForRegisteringGSAClient(mContext);
        registerClientMessage.setData(b);
        registerClientMessage.getData().putString(
                KEY_GSA_PACKAGE_NAME, mContext.getPackageName());
        mService.send(registerClientMessage);
        // Send prepare overlay message if there is a pending GSA context.
    } catch (RemoteException e) {
        Log.w(SERVICE_CONNECTION_TAG, "GSAServiceConnection - remote call failed", e);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:22,代碼來源:GSAServiceClient.java

示例2: acquireProviderClient

import android.os.RemoteException; //導入依賴的package包/類
@Override
public IBinder acquireProviderClient(int userId, ProviderInfo info) {
    ProcessRecord callerApp;
    synchronized (mPidsSelfLocked) {
        callerApp = findProcessLocked(VBinder.getCallingPid());
    }
    if (callerApp == null) {
        throw new SecurityException("Who are you?");
    }
    String processName = info.processName;
    ProcessRecord r;
    synchronized (this) {
        r = startProcessIfNeedLocked(processName, userId, info.packageName);
    }
    if (r != null && r.client.asBinder().isBinderAlive()) {
        try {
            return r.client.acquireProviderClient(info);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    return null;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:24,代碼來源:VActivityManagerService.java

示例3: testMapParams

import android.os.RemoteException; //導入依賴的package包/類
@Test
public void testMapParams() throws RemoteException {
    Map inList = new HashMap();
    Map inOutList = new HashMap();

    inList.put(1, 1);
    inList.put(2, 2);

    inOutList.put(5, 5);
    inOutList.put(6, 6);


    Map result = sampleService.testMap(inList, inOutList);

    Log.i(TAG, "Map Result " + result);

    Assert.assertEquals(3, result.size());
    Assert.assertEquals(100, result.get("Result"));

    Assert.assertEquals(4, inOutList.size());
    Assert.assertEquals(1, inOutList.get(1));
    Assert.assertEquals(2, inOutList.get(2));
}
 
開發者ID:josesamuel,項目名稱:remoter,代碼行數:24,代碼來源:RemoterClientToRemoterServerTest.java

示例4: resolveActivityInfo

import android.os.RemoteException; //導入依賴的package包/類
public ActivityInfo resolveActivityInfo(Intent intent, int flags) throws RemoteException {
    try {
        if (this.mApkManager == null) {
            return null;
        }
        if (intent.getComponent() != null) {
            return this.mApkManager.getActivityInfo(intent.getComponent(), flags);
        }
        ResolveInfo resolveInfo = this.mApkManager.resolveIntent(intent, intent.resolveTypeIfNeeded(this.mHostContext.getContentResolver()), flags);
        if (resolveInfo == null || resolveInfo.activityInfo == null) {
            return null;
        }
        return resolveInfo.activityInfo;
    } catch (RemoteException e) {
        JLog.log("wuxinrong", "獲取ActivityInfo 失敗 e=" + e.getMessage());
        throw e;
    } catch (Exception e2) {
        JLog.log("wuxinrong", "獲取ActivityInfo 失敗 e=" + e2.getMessage());
        return null;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:22,代碼來源:ApkManager.java

示例5: resolveServiceInfo

import android.os.RemoteException; //導入依賴的package包/類
public ServiceInfo resolveServiceInfo(Intent intent, int flags) throws RemoteException {
    try {
        if (this.mApkManager == null) {
            return null;
        }
        if (intent.getComponent() != null) {
            return this.mApkManager.getServiceInfo(intent.getComponent(), flags);
        }
        ResolveInfo resolveInfo = this.mApkManager.resolveIntent(intent, intent.resolveTypeIfNeeded(this.mHostContext.getContentResolver()), flags);
        if (resolveInfo == null || resolveInfo.serviceInfo == null) {
            return null;
        }
        return resolveInfo.serviceInfo;
    } catch (RemoteException e) {
        JLog.log("wuxinrong", "獲取ServiceInfo 失敗 e=" + e.getMessage());
        throw e;
    } catch (Exception e2) {
        JLog.log("wuxinrong", "獲取ServiceInfo 失敗 e=" + e2.getMessage());
        return null;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:22,代碼來源:ApkManager.java

示例6: releaseConnect

import android.os.RemoteException; //導入依賴的package包/類
private void releaseConnect(final boolean isLost) {
    if (!isLost && this.service != null) {
        try {
            unregisterCallback(this.service, this.callback);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "release connect resources %s", this.service);
    }
    this.service = null;

    FileDownloadEventPool.getImpl().
            asyncPublishInNewThread(new DownloadServiceConnectChangedEvent(
                    isLost ? DownloadServiceConnectChangedEvent.ConnectStatus.lost :
                            DownloadServiceConnectChangedEvent.ConnectStatus.disconnected,
                    serviceClass));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:BaseFileServiceUIGuard.java

示例7: doActivate

import android.os.RemoteException; //導入依賴的package包/類
private void doActivate() {
    try {
        Collection<String> purchased = null;
        uiHandler.sendEmptyMessageDelayed(MESSAGE_CHECK, DELAY);
        synchronized (lock) {
            if (mInApp != null && mInApp.isBillingSupported(VERSION, mPackageName, TYPE) == 0) {
                Bundle inapp = mInApp.getPurchases(VERSION, mPackageName, TYPE, null);
                purchased = checkPurchased(inapp);
            }
        }
        uiHandler.removeMessages(MESSAGE_CHECK);
        uiHandler.obtainMessage(MESSAGE_ACTIVATE, purchased).sendToTarget();
    } catch (RemoteException e) {
        Log.d(mTag, "Can't check Play", e);
    }
}
 
開發者ID:brevent,項目名稱:Brevent,代碼行數:17,代碼來源:PlayServiceConnection.java

示例8: cycleShuffle

import android.os.RemoteException; //導入依賴的package包/類
/**
 * Cycles through the shuffle options.
 */
public static void cycleShuffle() {
    try {
        if (mService != null) {
            switch (mService.getShuffleMode()) {
                case MusicPlaybackService.SHUFFLE_NONE:
                    mService.setShuffleMode(MusicPlaybackService.SHUFFLE);
                    if (mService.getRepeatMode() == MusicPlaybackService.REPEAT_CURRENT) {
                        mService.setRepeatMode(MusicPlaybackService.REPEAT_ALL);
                    }
                    break;
                case MusicPlaybackService.SHUFFLE:
                    mService.setShuffleMode(MusicPlaybackService.SHUFFLE_NONE);
                    break;
                default:
                    break;
            }
        }
    } catch (final RemoteException ignored) {
    }
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:24,代碼來源:MusicUtils.java

示例9: getReceiverIntentFilter

import android.os.RemoteException; //導入依賴的package包/類
public List<IntentFilter> getReceiverIntentFilter(ActivityInfo info) throws RemoteException {
    try {
        if (getAndCheckCallingPkg(info.packageName) != null) {
            PluginPackageParser parser = (PluginPackageParser) this.mPluginCache.get(info.packageName);
            if (parser != null) {
                List<IntentFilter> filters = parser.getReceiverIntentFilter(info);
                if (filters != null && filters.size() > 0) {
                    return new ArrayList(filters);
                }
            }
        }
        return new ArrayList(0);
    } catch (Exception e) {
        RemoteException remoteException = new RemoteException();
        remoteException.setStackTrace(e.getStackTrace());
        throw remoteException;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:19,代碼來源:IApkManagerImpl.java

示例10: subscribe

import android.os.RemoteException; //導入依賴的package包/類
public void subscribe(@NonNull String parentId, Bundle options, @NonNull SubscriptionCallback callback) {
    SubscriptionCallbackApi21 cb21 = new SubscriptionCallbackApi21(callback, options);
    Subscription sub = (Subscription) this.mSubscriptions.get(parentId);
    if (sub == null) {
        sub = new Subscription();
        this.mSubscriptions.put(parentId, sub);
    }
    sub.setCallbackForOptions(cb21, options);
    if (!MediaBrowserCompatApi21.isConnected(this.mBrowserObj)) {
        return;
    }
    if (options == null || this.mServiceBinderWrapper == null) {
        MediaBrowserCompatApi21.subscribe(this.mBrowserObj, parentId, cb21.mSubscriptionCallbackObj);
        return;
    }
    try {
        this.mServiceBinderWrapper.addSubscription(parentId, options, this.mCallbacksMessenger);
    } catch (RemoteException e) {
        Log.i(MediaBrowserCompat.TAG, "Remote error subscribing media item: " + parentId);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:22,代碼來源:MediaBrowserCompat.java

示例11: onServiceConnected

import android.os.RemoteException; //導入依賴的package包/類
public void onServiceConnected(ComponentName classname, IBinder obj) {
    mService = IMediaPlaybackService.Stub.asInterface(obj);
    startPlayback();
    try {
        // Assume something is playing when the service says it is,
        // but also if the audio ID is valid but the service is paused.
        if (mService.getAudioId() >= 0 || mService.isPlaying()
                || mService.getPath() != null) {
            // something is playing now, we're done
            mRepeatButton.setVisibility(View.VISIBLE);
            mShuffleButton.setVisibility(View.VISIBLE);
            setRepeatButtonImage();
            setShuffleButtonImage();
            setPauseButtonImage();
            return;
        }
    } catch (RemoteException ex) {
    }
    // Service is dead or not playing anything. If we got here as part
    // of a "play this file" Intent, exit. Otherwise go to the Music
    // app start screen.
    if (getIntent().getData() == null) {
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setClass(MediaLockscreenActivity.this,
                OnlineActivity.class);
        startActivity(intent);
    }
    finish();
}
 
開發者ID:89luca89,項目名稱:ThunderMusic,代碼行數:31,代碼來源:MediaLockscreenActivity.java

示例12: deleteApplicationCacheFiles

import android.os.RemoteException; //導入依賴的package包/類
@Override
public void deleteApplicationCacheFiles(String packageName, IPackageDataObserver observer) throws RemoteException {
    boolean success = false;
    try {
        if (TextUtils.isEmpty(packageName)) {
            return;
        }

        PluginPackageParser parser = mPluginCache.get(packageName);
        if (parser == null) {
            return;
        }
        ApplicationInfo applicationInfo = parser.getApplicationInfo(0);
        Utils.deleteDir(new File(applicationInfo.dataDir, "caches").getName());
        success = true;
    } catch (Exception e) {
        handleException(e);
    } finally {
        if (observer != null) {
            observer.onRemoveCompleted(packageName, success);
        }
    }
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:24,代碼來源:IPluginManagerImpl.java

示例13: sendLocalBroadcast2Process

import android.os.RemoteException; //導入依賴的package包/類
/**
 * 多進程使用, 將intent送到目標進程,對方將收到Local Broadcast廣播
 * <p>
 * 隻有當目標進程存活時才能將數據送達
 * <p>
 * 常駐進程通過Local Broadcast注冊處理代碼
 *
 * @param target 目標進程名
 * @param intent Intent對象
 */
public static boolean sendLocalBroadcast2Process(Context c, String target, Intent intent) {
    if (LOG) {
        LogDebug.d(TAG, "sendLocalBroadcast2Process: target=" + target + " intent=" + intent);
    }
    if (TextUtils.isEmpty(target)) {
        return false;
    }
    try {
        PluginProcessMain.getPluginHost().sendIntent2Process(target, intent);
        return true;
    } catch (RemoteException e) {
        if (LOGR) {
            e.printStackTrace();
        }
    }
    return false;
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:28,代碼來源:IPC.java

示例14: validateRemoteBundle

import android.os.RemoteException; //導入依賴的package包/類
/**
 * Check that the @param bundle is valid, this includes scrubbing it for parameters that could
 * cause the app to crash. If it is not valid, an error is logged and the request ignored.
 * <p>
 *
 * @param rl     the remote {@link ISaiyListener}
 * @param bundle the bundle to check
 * @return true if the bundle is acceptable
 */
public boolean validateRemoteBundle(final ISaiyListener rl, final Bundle bundle) throws RemoteException {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "validateRemoteBundle");
    }

    if (bundle != null) {
        bundle.setClassLoader(RequestParcel.class.getClassLoader());

        if (UtilsBundle.isSuspicious(bundle)) {
            MyLog.e("Remote Saiy Request", mContext.getString(ai.saiy.android.R.string.error_bundle_corrupt));
        } else {
            if (DEBUG) {
                MyLog.i(CLS_NAME, "validateRemoteBundle: bundle valid");
            }
            return true;
        }
    } else {
        MyLog.e("Remote Saiy Request", mContext.getString(ai.saiy.android.R.string.error_bundle_null));
    }

    rl.onError(Defaults.ERROR.ERROR_DEVELOPER.name(), Validation.ID_UNKNOWN);
    return false;
}
 
開發者ID:brandall76,項目名稱:Saiy-PS,代碼行數:33,代碼來源:SelfAwareHelper.java

示例15: onRemoteEvent

import android.os.RemoteException; //導入依賴的package包/類
@Override
public void onRemoteEvent(Bundle remoteData) {
    android.os.Parcel data = android.os.Parcel.obtain();
    android.os.Parcel reply = android.os.Parcel.obtain();
    try {
        data.writeInterfaceToken(DESCRIPTOR);
        if (remoteData != null) {
            data.writeInt(1);
            remoteData.writeToParcel(data, 0);
        } else {
            data.writeInt(0);
        }
        mRemote.transact(TRANSACTION_onRemoteEvent_0, data, reply, android.os.IBinder.FLAG_ONEWAY);
    } catch (RemoteException re) {
        throw new RuntimeException(re);
    } finally {
        reply.recycle();
        data.recycle();
    }
}
 
開發者ID:josesamuel,項目名稱:RxRemote,代碼行數:21,代碼來源:RemoteEventListener_Proxy.java


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