private Context createPackageContext(String packageName) { try { Context hostContext = VirtualCore.get().getContext(); return hostContext.createPackageContext(packageName, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); VirtualRuntime.crash(new RemoteException()); } throw new RuntimeException(); }
@Test public void serviceConnected_unbindsAfterRemoteException() throws Exception { binderMock.setStartException(new RemoteException("something bad happened")); connection.onServiceConnected(null, binderMock); assertTrue(connection.wasUnbound()); }
@Test public void onStop_unbindsAfterRemoteException() throws Exception { connection.onServiceConnected(null, binderMock); binderMock.verifyStartArguments(jobData, noopCallback); assertFalse(connection.wasUnbound()); binderMock.setStopException(new RemoteException("something bad happened")); connection.onStop(job, true); binderMock.verifyStopArguments(jobData, true); assertTrue(connection.wasUnbound()); verify(contextMock).unbindService(connection); }
@TargetApi(18) private void applyChangesToServices(int type, Region region) throws RemoteException { if (mScheduledScanJobsEnabled) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ScanJobScheduler.getInstance().applySettingsToScheduledJob(mContext, this); } return; } if (serviceMessenger == null) { throw new RemoteException("The BeaconManager is not bound to the service. Call beaconManager.bind(BeaconConsumer consumer) and wait for a callback to onBeaconServiceConnect()"); } Message msg = Message.obtain(null, type, 0, 0); if (type == BeaconService.MSG_SET_SCAN_PERIODS) { msg.setData(new StartRMData(this.getScanPeriod(), this.getBetweenScanPeriod(), this.mBackgroundMode).toBundle()); } else if (type == BeaconService.MSG_SYNC_SETTINGS) { msg.setData(new SettingsData().collect(mContext).toBundle()); } else { msg.setData(new StartRMData(region, callbackPackageName(), getScanPeriod(), getBetweenScanPeriod(), mBackgroundMode).toBundle()); } serviceMessenger.send(msg); }
public synchronized IOdysseyPlaybackService getPBS() throws RemoteException { if (mPlaybackService != null) { return mPlaybackService; } else { throw new RemoteException(); } }
@Override public Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type, String developerPayload) throws RemoteException { throw new RemoteException(); }
public IOdysseyPlaybackService getPlaybackService() throws RemoteException { if (mServiceConnection != null) { return mServiceConnection.getPBS(); } else { throw new RemoteException(); } }
public void registerPartnerRowClient(IRecommendationsClient client, int version) throws RemoteException { if (version < 1) { throw new RemoteException("Unsupported client version: " + version); } registerRecommendationsClient(client, true); }
public void registerPartnerRowClient(IRecommendationsClient client, int version) throws RemoteException { if (version < 1) { throw new RemoteException("Unsupported client version: " + version); } registerRecommendationsClient(client, true); }
@Override public Bundle getSkuDetails(int apiVersion, String packageName, String type, Bundle skusBundle) throws RemoteException { throw new RemoteException(); }
@Override public Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken) throws RemoteException { if (bundle.getBoolean(THROW_REMOTE_EXCEPTION_ON_GET_ACTIONS, false)) { throw new RemoteException(); } return bundle.getParcelable(GET_PURCHASES); }
@Override public Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type, String developerPayload) throws RemoteException { if (bundle.getBoolean(THROW_REMOTE_EXCEPTION_ON_GET_ACTIONS, false)) { throw new RemoteException(); } return bundle.getParcelable(GET_BUY_INTENT); }
@Override public int isBillingSupported(int apiVersion, String packageName, String type) throws RemoteException { if (bundle.getBoolean(THROW_REMOTE_EXCEPTION_ON_BILLING_SUPPORTED, false)) { throw new RemoteException(); } return bundle.getInt(IN_APP_BILLING_SUPPORTED, 0); }
@Override public Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type, String developerPayload) throws RemoteException { if (bundle.getBoolean(THROW_REMOTE_EXCEPTION_ON_GET_ACTIONS, false)) { throw new RemoteException(); } return bundle.getParcelable(GET_BUY_INTENT); }
@Override public Bundle getSkuDetails(int apiVersion, String packageName, String type, Bundle skusBundle) throws RemoteException { if (bundle.getBoolean(THROW_REMOTE_EXCEPTION_ON_GET_ACTIONS, false)) { throw new RemoteException(); } return bundle.getParcelable(GET_SKU_DETAILS); }
@Override public Bundle getSkuDetails(int apiVersion, String packageName, String type, Bundle skusBundle) throws RemoteException { if (bundle.getBoolean(THROW_REMOTE_EXCEPTION_ON_GET_ACTIONS, false)) { throw new RemoteException(); } return bundle.getParcelable(GET_SKU_DETAILS); }
@Override public int isBillingSupported(int apiVersion, String packageName, String type) throws RemoteException { if (bundle.getBoolean(THROW_REMOTE_EXCEPTION_ON_BILLING_SUPPORTED, false)) { throw new RemoteException(); } return bundle.getInt(IN_APP_BILLING_SUPPORTED, 0); }
public static ContentProviderClient acquireUnstableProviderOrThrow( ContentResolver resolver, String authority) throws RemoteException { final ContentProviderClient client = ContentProviderClientCompat.acquireUnstableContentProviderClient(resolver, authority); if (client == null) { throw new RemoteException("Failed to acquire provider for " + authority); } ContentProviderClientCompat.setDetectNotResponding(client, PROVIDER_ANR_TIMEOUT); return client; }
private Context createPackageContext(String packageName) { try { Context hostContext = VirtualCore.get().getContext(); return hostContext.createPackageContext(packageName, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); VirtualRuntime.crash(new RemoteException()); } throw new RuntimeException(); }
private Context createPackageContext(String packageName) { try { Context hostContext = VirtualCore.get().getContext(); return hostContext.createPackageContext(packageName, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); VirtualRuntime.crash(new RemoteException()); } throw new RuntimeException(); }