Java Code Examples for android.os.RemoteException

The following are top voted examples for showing how to use android.os.RemoteException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: chromium-for-android-56-debug-video   File: GSAServiceClient.java   Source Code and License 6 votes vote down vote up
@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);
    }
}
 
Example 2
Project: VirtualHook   File: VActivityManagerService.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 3
Project: remoter   File: RemoterClientToRemoterServerTest.java   Source Code and License 6 votes vote down vote up
@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));
}
 
Example 4
Project: letv   File: ApkManager.java   Source Code and License 6 votes vote down vote up
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;
    }
}
 
Example 5
Project: letv   File: ApkManager.java   Source Code and License 6 votes vote down vote up
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;
    }
}
 
Example 6
Project: GitHub   File: BaseFileServiceUIGuard.java   Source Code and License 6 votes vote down vote up
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));
}
 
Example 7
Project: Brevent   File: PlayServiceConnection.java   Source Code and License 6 votes vote down vote up
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);
    }
}
 
Example 8
Project: Phoenix-for-VK   File: MusicUtils.java   Source Code and License 6 votes vote down vote up
/**
 * 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) {
    }
}
 
Example 9
Project: letv   File: IApkManagerImpl.java   Source Code and License 6 votes vote down vote up
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;
    }
}
 
Example 10
Project: boohee_v5.6   File: MediaBrowserCompat.java   Source Code and License 6 votes vote down vote up
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);
    }
}
 
Example 11
Project: ThunderMusic   File: MediaLockscreenActivity.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 12
Project: DroidPlugin   File: IPluginManagerImpl.java   Source Code and License 6 votes vote down vote up
@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);
        }
    }
}
 
Example 13
Project: springreplugin   File: IPC.java   Source Code and License 6 votes vote down vote up
/**
 * 多进程使用, 将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;
}
 
Example 14
Project: Saiy-PS   File: SelfAwareHelper.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 15
Project: RxRemote   File: RemoteEventListener_Proxy.java   Source Code and License 6 votes vote down vote up
@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();
    }
}
 
Example 16
Project: Musicoco   File: ListViewsController.java   Source Code and License 6 votes vote down vote up
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();
    }
}
 
Example 17
Project: react-native-streaming-audio-player   File: MediaNotificationManager.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 18
Project: starcor.xul   File: XulRemoteDataService.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 19
Project: VirtualHook   File: VActivityManager.java   Source Code and License 5 votes vote down vote up
public boolean isAppPid(int pid) {
    try {
        return getService().isAppPid(pid);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
 
Example 20
Project: TPlayer   File: VirtualStorageManager.java   Source Code and License 5 votes vote down vote up
public String getVirtualStorage(String packageName, int userId) {
    try {
        return getRemote().getVirtualStorage(packageName, userId);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
 
Example 21
Project: Snach-Android   File: SnachRemoteHandler.java   Source Code and License 5 votes vote down vote up
public void sendAppContent(ActionAppContentItem appContentItem){
    try {
        mRemoteService.setUpActionAppContent(appContentItem);
    } catch (DeadObjectException de){
        de.printStackTrace();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 22
Project: CustomAndroidOneSheeld   File: CameraFragment.java   Source Code and License 5 votes vote down vote up
@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();
}
 
Example 23
Project: PlusGram   File: CustomTabsSessionToken.java   Source Code and License 5 votes vote down vote up
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");
            }

        }
    };
}
 
Example 24
Project: TPlayer   File: VAccountManagerService.java   Source Code and License 5 votes vote down vote up
@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();
}
 
Example 25
Project: letv   File: MediaControllerCompat.java   Source Code and License 5 votes vote down vote up
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();
    }
}
 
Example 26
Project: DroidPlugin   File: PluginInstrumentation.java   Source Code and License 5 votes vote down vote up
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);
        }
    }
}
 
Example 27
Project: VirtualHook   File: VirtualStorageService.java   Source Code and License 5 votes vote down vote up
@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();
    }
}
 
Example 28
Project: VirtualHook   File: VirtualCore.java   Source Code and License 5 votes vote down vote up
public boolean isOutsidePackageVisible(String pkg) {
    try {
        return getService().isOutsidePackageVisible(pkg);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
 
Example 29
Project: container   File: VActivityManager.java   Source Code and License 5 votes vote down vote up
public ComponentName getActivityForToken(IBinder token) {
    try {
        return getService().getActivityClassForToken(VUserHandle.myUserId(), token);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
 
Example 30
Project: VirtualHook   File: VActivityManager.java   Source Code and License 5 votes vote down vote up
public ComponentName getCallingActivity(IBinder token) {
    try {
        return getService().getCallingActivity(VUserHandle.myUserId(), token);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
 
Example 31
Project: boohee_v5.6   File: ServiceTalker.java   Source Code and License 5 votes vote down vote up
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;
        }
    }
}
 
Example 32
Project: TPlayer   File: VPackageInstallerService.java   Source Code and License 5 votes vote down vote up
@Override
public void setPermissionsResult(int sessionId, boolean accepted) throws RemoteException {
    synchronized (mSessions) {
        PackageInstallerSession session = mSessions.get(sessionId);
        if (session != null) {
            session.setPermissionsResult(accepted);
        }
    }
}
 
Example 33
Project: VirtualHook   File: VJobScheduler.java   Source Code and License 5 votes vote down vote up
public int schedule(JobInfo job) {
    try {
        return getRemote().schedule(job);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
 
Example 34
Project: ProgressManager   File: a.java   Source Code and License 5 votes vote down vote up
/**
 * 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) {
    }
}
 
Example 35
Project: CSipSimple   File: SipService.java   Source Code and License 5 votes vote down vote up
/**
       * {@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();
}
 
Example 36
Project: letv   File: NotificationManagerCompat.java   Source Code and License 5 votes vote down vote up
public void send(INotificationSideChannel service) throws RemoteException {
    if (this.all) {
        service.cancelAll(this.packageName);
    } else {
        service.cancel(this.packageName, this.id, this.tag);
    }
}
 
Example 37
Project: VirtualHook   File: VUserManager.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 38
Project: VirtualHook   File: VActivityManager.java   Source Code and License 5 votes vote down vote up
public boolean onActivityDestroy(IBinder token) {
    mActivities.remove(token);
    try {
        return getService().onActivityDestroyed(VUserHandle.myUserId(), token);
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
 
Example 39
Project: KomaMusic   File: MusicUtils.java   Source Code and License 5 votes vote down vote up
/**
 * @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;
}
 
Example 40
Project: VirtualHook   File: VAccountManagerService.java   Source Code and License 5 votes vote down vote up
@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");
	}
}
 
Example 41
Project: Hello-Music-droid   File: MusicPlayer.java   Source Code and License 5 votes vote down vote up
public static final int getQueueHistorySize() {
    if (mService != null) {
        try {
            return mService.getQueueHistorySize();
        } catch (final RemoteException ignored) {
        }
    }
    return 0;
}
 
Example 42
Project: TPlayer   File: VirtualCore.java   Source Code and License 5 votes vote down vote up
public boolean uninstallPackage(String pkgName) {
    try {
        return getService().uninstallPackage(pkgName);
    } catch (RemoteException e) {
        // Ignore
    }
    return false;
}
 
Example 43
Project: astrobee_android   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    mServiceMessenger = new Messenger(service);
    mTextCommStatus.setText("Comm Status: Connected");
    Log.i(LOGTAG, "CONNECTED to SERVICE!");
    try {
        Message msg = Message.obtain(null, MSG_REGISTER_CLIENT);
        msg.replyTo = mMessenger;
        mServiceMessenger.send(msg);
    } catch (RemoteException re) {
        // In this case the service has crashed before we could even do anything with it
    }
    mTextMsgGSToRobot.setText(gsApp.commandList.get(0).getString("cmd"));
    gsApp.executeRobotInstructions("");
}
 
Example 44
Project: container   File: VActivityManager.java   Source Code and License 5 votes vote down vote up
public void unbindFinished(IBinder token, Intent service, boolean doRebind) {
    try {
        getService().unbindFinished(token, service, doRebind, VUserHandle.myUserId());
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 45
Project: Musicoco   File: ListOption.java   Source Code and License 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.play_location:
            try {
                int index = control.currentSongIndex();
                mPlayList.smoothScrollToPosition(index);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            break;
        default:
            break;
    }
}
 
Example 46
Project: ProgressManager   File: a.java   Source Code and License 5 votes vote down vote up
/**
 * Returns true if the activity is currently in picture-in-picture mode.
 * @see android.R.attr#supportsPictureInPicture
 *
 * @return True if the activity is in picture-in-picture mode.
 */
public boolean isInPictureInPictureMode() {
    try {
        return ActivityManagerNative.getDefault().isInPictureInPictureMode(mToken);
    } catch (RemoteException e) {
    }
    return false;
}
 
Example 47
Project: ProgressManager   File: a.java   Source Code and License 5 votes vote down vote up
/**
 * Force finish another activity that you had previously started with
 * {@link #startActivityForResult}.
 *
 * @param requestCode The request code of the activity that you had
 *                    given to startActivityForResult().  If there are multiple
 *                    activities started with this request code, they
 *                    will all be finished.
 */
public void finishActivity(int requestCode) {
    if (mParent == null) {
        try {
            ActivityManagerNative.getDefault()
                    .finishSubActivity(mToken, mEmbeddedID, requestCode);
        } catch (RemoteException e) {
            // Empty
        }
    } else {
        mParent.finishActivityFromChild(this, requestCode);
    }
}
 
Example 48
Project: KomaMusic   File: MusicUtils.java   Source Code and License 5 votes vote down vote up
/**
 * Set shake to play status
 */
public static void setShakeToPlayEnabled(final boolean enabled) {
    try {
        if (mService != null) {
            mService.setShakeToPlayEnabled(enabled);
        }
    } catch (final RemoteException ignored) {
    }
}
 
Example 49
Project: KomaMusic   File: MusicUtils.java   Source Code and License 5 votes vote down vote up
/**
 * @return The queue history size
 */
public static final int getQueueHistorySize() {
    if (mService != null) {
        try {
            return mService.getQueueHistorySize();
        } catch (final RemoteException ignored) {
        }
    }
    return 0;
}
 
Example 50
Project: TPlayer   File: VNotificationManager.java   Source Code and License 5 votes vote down vote up
public int dealNotificationId(int id, String packageName, String tag, int userId) {
    try {
        return getService().dealNotificationId(id, packageName, tag, userId);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    return id;
}
 
Example 51
Project: boohee_v5.6   File: MediaBrowserServiceCompat.java   Source Code and License 5 votes vote down vote up
private void sendRequest(int what, Bundle data) throws RemoteException {
    Message msg = Message.obtain();
    msg.what = what;
    msg.arg1 = 1;
    msg.setData(data);
    this.mCallbacks.send(msg);
}
 
Example 52
Project: container   File: VAccountManager.java   Source Code and License 5 votes vote down vote up
public boolean accountAuthenticated(Account account) {
	try {
		return getRemote().accountAuthenticated(VUserHandle.myUserId(), account);
	} catch (RemoteException e) {
		return VirtualRuntime.crash(e);
	}
}
 
Example 53
Project: Musicoco   File: AudioFocusManager.java   Source Code and License 5 votes vote down vote up
private void play() {
    try {
        control.resume();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 54
Project: EasyAppleSyncAdapter   File: LocalCalendar.java   Source Code and License 5 votes vote down vote up
@Override
public void setCTag(String cTag) throws CalendarStorageException {
    try {
        ContentValues values = new ContentValues(1);
        values.put(COLUMN_CTAG, cTag);
        provider.update(calendarSyncURI(), values, null, null);
    } catch (RemoteException e) {
        throw new CalendarStorageException("Couldn't write local (last known) CTag", e);
    }
}
 
Example 55
Project: RxRemote   File: RemoteEventListener_Stub.java   Source Code and License 5 votes vote down vote up
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    try {
        switch (code) {
            case INTERFACE_TRANSACTION: {
                reply.writeString(DESCRIPTOR);
                return true;
            }
            case TRANSACTION_onRemoteEvent_0: {
                data.enforceInterface(DESCRIPTOR);
                Bundle arg_stb_0;
                if (data.readInt() != 0) {
                    arg_stb_0 = android.os.Bundle.CREATOR.createFromParcel(data);
                } else {
                    arg_stb_0 = null;
                }
                serviceImpl.onRemoteEvent(arg_stb_0);
                return true;
            }
            case TRANSACTION_onCompleted_1: {
                data.enforceInterface(DESCRIPTOR);
                serviceImpl.onCompleted();
                return true;
            }

            case TRANSACTION_onError_2: {
                data.enforceInterface(DESCRIPTOR);
                serviceImpl.onError(new Exception(data.readString()));
                return true;
            }

        }
    } catch (Exception ignored) {
    }
    return super.onTransact(code, data, reply, flags);
}
 
Example 56
Project: container   File: VActivityManager.java   Source Code and License 5 votes vote down vote up
public void killApplicationProcess(String procName, int uid) {
    try {
        getService().killApplicationProcess(procName, uid);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 57
Project: container   File: VAccountManager.java   Source Code and License 5 votes vote down vote up
public void invalidateAuthToken(String accountType, String authToken) {
	try {
		getRemote().invalidateAuthToken(VUserHandle.myUserId(), accountType, authToken);
	} catch (RemoteException e) {
		e.printStackTrace();
	}
}
 
Example 58
Project: letv   File: MediaSessionCompat.java   Source Code and License 4 votes vote down vote up
public void fastForward() throws RemoteException {
    MediaSessionImplBase.this.postToHandler(9);
}
 
Example 59
Project: FileDownloader-master   File: FDServiceSeparateHandler.java   Source Code and License 4 votes vote down vote up
@Override
public boolean checkDownloading(String url, String path) throws RemoteException {
    return downloadManager.isDownloading(url, path);
}
 
Example 60
Project: letv   File: IApkManagerImpl.java   Source Code and License 4 votes vote down vote up
public String getProcessNameByPid(int pid) throws RemoteException {
    return this.mActivityManagerService.getProcessNameByPid(pid);
}