Java 类android.os.RemoteException 实例源码

项目:chromium-for-android-56-debug-video    文件:GSAServiceClient.java   
@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);
    }
}
项目:VirtualHook    文件:VActivityManagerService.java   
@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;
}
项目:remoter    文件:RemoterClientToRemoterServerTest.java   
@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));
}
项目:letv    文件:ApkManager.java   
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;
    }
}
项目:letv    文件:ApkManager.java   
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;
    }
}
项目:GitHub    文件:BaseFileServiceUIGuard.java   
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));
}
项目:Brevent    文件:PlayServiceConnection.java   
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);
    }
}
项目:Phoenix-for-VK    文件:MusicUtils.java   
/**
 * 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) {
    }
}
项目:letv    文件:IApkManagerImpl.java   
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;
    }
}
项目:boohee_v5.6    文件:MediaBrowserCompat.java   
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);
    }
}
项目:ThunderMusic    文件:MediaLockscreenActivity.java   
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();
}
项目:DroidPlugin    文件:IPluginManagerImpl.java   
@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);
        }
    }
}
项目:springreplugin    文件:IPC.java   
/**
 * 多进程使用, 将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;
}
项目:Saiy-PS    文件:SelfAwareHelper.java   
/**
 * 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;
}
项目:RxRemote    文件:RemoteEventListener_Proxy.java   
@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();
    }
}
项目:Musicoco    文件:ListViewsController.java   
public void initData(IPlayControl control, DBMusicocoController dbController) {
    this.control = control;
    this.dbController = dbController;
    this.songOperation = new SongOperation(activity, control, dbController);

    adapter = new PlayListAdapter(activity, data);
    mList.setAdapter(adapter);
    initAdapterClickListener();

    try {
        int index = control.currentSongIndex();
        if (index < adapter.getCount() - 1) {
            currentSong = index;
            mList.setSelection(currentSong);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:react-native-streaming-audio-player    文件:MediaNotificationManager.java   
public MediaNotificationManager(AudioPlayerService service) throws RemoteException {
    mService = service;
    updateSessionToken();

    mNotificationManager = NotificationManagerCompat.from(service);

    String pkg = mService.getPackageName();
    mPauseIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE,
            new Intent(ACTION_PAUSE).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT);
    mPlayIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE,
            new Intent(ACTION_PLAY).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT);
    mPreviousIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE,
            new Intent(ACTION_PREV).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT);
    mNextIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE,
            new Intent(ACTION_NEXT).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT);

    // Cancel all notifications to handle the case where the Service was killed and
    // restarted by the system.
    mNotificationManager.cancelAll();
}
项目:starcor.xul    文件:XulRemoteDataService.java   
@Override
public void onError(IXulRemoteDataOperation op, int code) throws RemoteException {
    if (code == XulDataService.CODE_NO_PROVIDER) {
        return;
    }
    _clauseInfo.dataOperation = getDataOperation(op);
    _ctx.deliverError(_dataCallback, _clauseInfo.clause);
}
项目:VirtualHook    文件:VActivityManager.java   
public boolean isAppPid(int pid) {
    try {
        return getService().isAppPid(pid);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
项目:TPlayer    文件:VirtualStorageManager.java   
public String getVirtualStorage(String packageName, int userId) {
    try {
        return getRemote().getVirtualStorage(packageName, userId);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
项目:Snach-Android    文件:SnachRemoteHandler.java   
public void sendAppContent(ActionAppContentItem appContentItem){
    try {
        mRemoteService.setUpActionAppContent(appContentItem);
    } catch (DeadObjectException de){
        de.printStackTrace();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:CustomAndroidOneSheeld    文件:CameraFragment.java   
@Override
public void doOnPause() {
    if (getApplication().getRunningShields().get(
            getControllerTag()) != null) {
        try {
            ((CameraShield) getApplication().getRunningShields().get(
                    getControllerTag())).hidePreview();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    camerLogo.setVisibility(View.VISIBLE);
    if (getView() != null) getView().invalidate();
}
项目:PlusGram    文件:CustomTabsSessionToken.java   
CustomTabsSessionToken(ICustomTabsCallback callbackBinder) {
    this.mCallbackBinder = callbackBinder;
    this.mCallback = new CustomTabsCallback() {
        public void onNavigationEvent(int navigationEvent, Bundle extras) {
            try {
                CustomTabsSessionToken.this.mCallbackBinder.onNavigationEvent(navigationEvent, extras);
            } catch (RemoteException var4) {
                Log.e("CustomTabsSessionToken", "RemoteException during ICustomTabsCallback transaction");
            }

        }
    };
}
项目:TPlayer    文件:VAccountManagerService.java   
@Override
public void run() throws RemoteException {
    mAccountsOfType = getAccounts(mUserId, mAuthenticatorInfo.desc.type);
    // check whether each account matches the requested features
    mAccountsWithFeatures = new ArrayList<Account>(mAccountsOfType.length);
    mCurrentAccount = 0;

    checkAccount();
}
项目:letv    文件:MediaControllerCompat.java   
public void registerCallback(Callback callback, Handler handler) {
    if (callback == null) {
        throw new IllegalArgumentException("callback may not be null.");
    }
    try {
        this.mBinder.asBinder().linkToDeath(callback, 0);
        this.mBinder.registerCallbackListener((IMediaControllerCallback) callback.mCallbackObj);
        callback.setHandler(handler);
        callback.mRegistered = true;
    } catch (RemoteException e) {
        Log.e(MediaControllerCompat.TAG, "Dead object in registerCallback. " + e);
        callback.onSessionDestroyed();
    }
}
项目:DroidPlugin    文件:PluginInstrumentation.java   
private void onActivityDestory(Activity activity) throws RemoteException {
    Intent targetIntent = activity.getIntent();
    if (targetIntent != null) {
        ActivityInfo targetInfo = targetIntent.getParcelableExtra(Env.EXTRA_TARGET_INFO);
        ActivityInfo stubInfo = targetIntent.getParcelableExtra(Env.EXTRA_STUB_INFO);
        if (targetInfo != null && stubInfo != null) {
            PluginManager.getInstance().onActivityDestory(stubInfo, targetInfo);
        }
    }
}
项目:VirtualHook    文件:VirtualStorageService.java   
@Override
public void setVirtualStorage(String packageName, int userId, String vsPath) throws RemoteException {
    checkUserId(userId);
    synchronized (mConfigs) {
        VSConfig config = getOrCreateVSConfigLocked(packageName, userId);
        config.vsPath = vsPath;
        mLayer.save();
    }
}
项目:VirtualHook    文件:VirtualCore.java   
public boolean isOutsidePackageVisible(String pkg) {
    try {
        return getService().isOutsidePackageVisible(pkg);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
项目:container    文件:VActivityManager.java   
public ComponentName getActivityForToken(IBinder token) {
    try {
        return getService().getActivityClassForToken(VUserHandle.myUserId(), token);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
项目:VirtualHook    文件:VActivityManager.java   
public ComponentName getCallingActivity(IBinder token) {
    try {
        return getService().getCallingActivity(VUserHandle.myUserId(), token);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
项目:boohee_v5.6    文件:ServiceTalker.java   
protected Bundle tryTalkAsV6OrV5(Account account, Bundle options, IBinder service) throws
        RemoteException {
    try {
        return talkWithServiceV6(account, options, Stub.asInterface(service));
    } catch (SecurityException e) {
        try {
            return talkWithServiceV5(account, options, IXiaomiAuthService.Stub.asInterface
                    (service));
        } catch (SecurityException e2) {
            Log.e(TAG, "failed to talked with Auth Service", e2);
            return null;
        }
    }
}
项目:TPlayer    文件:VPackageInstallerService.java   
@Override
public void setPermissionsResult(int sessionId, boolean accepted) throws RemoteException {
    synchronized (mSessions) {
        PackageInstallerSession session = mSessions.get(sessionId);
        if (session != null) {
            session.setPermissionsResult(accepted);
        }
    }
}
项目:VirtualHook    文件:VJobScheduler.java   
public int schedule(JobInfo job) {
    try {
        return getRemote().schedule(job);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
项目:ProgressManager    文件:a.java   
/**
 * Starts a local voice interaction session. When ready,
 * {@link #onLocalVoiceInteractionStarted()} is called. You can pass a bundle of private options
 * to the registered voice interaction service.
 * @param privateOptions a Bundle of private arguments to the current voice interaction service
 */
public void startLocalVoiceInteraction(Bundle privateOptions) {
    try {
        ActivityManagerNative.getDefault().startLocalVoiceInteraction(mToken, privateOptions);
    } catch (RemoteException re) {
    }
}
项目:CSipSimple    文件:SipService.java   
/**
       * {@inheritDoc}
       */
@Override
public void forceStopService() throws RemoteException {
    SipService.this.enforceCallingOrSelfPermission(SipManager.PERMISSION_USE_SIP, null);
    Log.d(THIS_FILE, "Try to force service stop");
    cleanStop();
    //stopSelf();
}
项目:letv    文件:NotificationManagerCompat.java   
public void send(INotificationSideChannel service) throws RemoteException {
    if (this.all) {
        service.cancelAll(this.packageName);
    } else {
        service.cancel(this.packageName, this.id, this.tag);
    }
}
项目:VirtualHook    文件:VUserManager.java   
/**
 * Enable or disable the use of a guest account. If disabled, the existing guest account
 * will be wiped.
 * @param enable whether to enable a guest account.
 * @hide
 */
public void setGuestEnabled(boolean enable) {
    try {
        mService.setGuestEnabled(enable);
    } catch (RemoteException re) {
        Log.w(TAG, "Could not change guest account availability to " + enable);
    }
}
项目:VirtualHook    文件:VActivityManager.java   
public boolean onActivityDestroy(IBinder token) {
    mActivities.remove(token);
    try {
        return getService().onActivityDestroyed(VUserHandle.myUserId(), token);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
项目:KomaMusic    文件:MusicUtils.java   
/**
 * @return The position of the current track in the queue.
 */
public static final int getQueuePosition() {
    try {
        if (mService != null) {
            return mService.getQueuePosition();
        }
    } catch (final RemoteException ignored) {
    }
    return 0;
}
项目:VirtualHook    文件:VAccountManagerService.java   
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    mAuthenticator = IAccountAuthenticator.Stub.asInterface(service);
    try {
        run();
    } catch (RemoteException e) {
        onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
                "remote exception");
    }
}