Java Code Examples for android.os.RemoteException#rethrowFromSystemServer()
The following examples show how to use
android.os.RemoteException#rethrowFromSystemServer() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: android_9.0.0_r45 File: AlarmManager.java License: Apache License 2.0 | 6 votes |
/** * Sets the system's persistent default time zone. This is the time zone for all apps, even * after a reboot. Use {@link java.util.TimeZone#setDefault} if you just want to change the * time zone within your app, and even then prefer to pass an explicit * {@link java.util.TimeZone} to APIs that require it rather than changing the time zone for * all threads. * * <p> On android M and above, it is an error to pass in a non-Olson timezone to this * function. Note that this is a bad idea on all Android releases because POSIX and * the {@code TimeZone} class have opposite interpretations of {@code '+'} and {@code '-'} * in the same non-Olson ID. * * @param timeZone one of the Olson ids from the list returned by * {@link java.util.TimeZone#getAvailableIDs} */ public void setTimeZone(String timeZone) { if (TextUtils.isEmpty(timeZone)) { return; } // Reject this timezone if it isn't an Olson zone we recognize. if (mTargetSdkVersion >= Build.VERSION_CODES.M) { boolean hasTimeZone = false; try { hasTimeZone = ZoneInfoDB.getInstance().hasTimeZone(timeZone); } catch (IOException ignored) { } if (!hasTimeZone) { throw new IllegalArgumentException("Timezone: " + timeZone + " is not an Olson ID"); } } try { mService.setTimeZone(timeZone); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } }
Example 2
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 6 votes |
/** @hide Same as above but for a specific user */ @Override @SuppressWarnings("unchecked") public List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId) { try { ParceledListSlice<ResolveInfo> parceledList = mPM.queryIntentActivities(intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), flags, userId); if (parceledList == null) { return Collections.emptyList(); } return parceledList.getList(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 3
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public List<PermissionInfo> queryPermissionsByGroup(String group, int flags) throws NameNotFoundException { try { ParceledListSlice<PermissionInfo> parceledList = mPM.queryPermissionsByGroup(group, flags); if (parceledList != null) { List<PermissionInfo> pi = parceledList.getList(); if (pi != null) { return pi; } } } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } throw new NameNotFoundException(group); }
Example 4
Source Project: android_9.0.0_r45 File: PrintManager.java License: Apache License 2.0 | 6 votes |
/** * Gets a print job given its id. * * @param printJobId The id of the print job. * @return The print job list. * @see PrintJob * @hide */ public PrintJob getPrintJob(PrintJobId printJobId) { if (mService == null) { Log.w(LOG_TAG, "Feature android.software.print not available"); return null; } try { PrintJobInfo printJob = mService.getPrintJobInfo(printJobId, mAppId, mUserId); if (printJob != null) { return new PrintJob(printJob, this); } } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } return null; }
Example 5
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
@Override public boolean hasSigningCertificate( int uid, byte[] certificate, @PackageManager.CertificateInputType int type) { try { return mPM.hasUidSigningCertificate(uid, certificate, type); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 6
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
@Override public void addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity) { try { mPM.addPreferredActivity(filter, match, set, activity, mContext.getUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 7
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
private void installCommon(Uri packageURI, PackageInstallObserver observer, int flags, String installerPackageName, int userId) { if (!"file".equals(packageURI.getScheme())) { throw new UnsupportedOperationException("Only file:// URIs are supported"); } final String originPath = packageURI.getPath(); try { mPM.installPackageAsUser(originPath, observer.getBinder(), flags, installerPackageName, userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 8
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
/** * @hide */ public @NonNull String getSharedSystemSharedLibraryPackageName() { try { return mPM.getSharedSystemSharedLibraryPackageName(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 9
Source Project: android_9.0.0_r45 File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
@Override public int getPreferredActivities(List<IntentFilter> outFilters, List<ComponentName> outActivities, String packageName) { try { return mPM.getPreferredActivities(outFilters, outActivities, packageName); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 10
Source Project: android_9.0.0_r45 File: TrafficStats.java License: Apache License 2.0 | 5 votes |
/** {@hide} */ public static long getMobileTcpRxPackets() { long total = 0; for (String iface : getMobileIfaces()) { long stat = UNSUPPORTED; try { stat = getStatsService().getIfaceStats(iface, TYPE_TCP_RX_PACKETS); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } total += addIfSupported(stat); } return total; }
Example 11
Source Project: AndroidComponentPlugin File: ContextImpl.java License: Apache License 2.0 | 5 votes |
void sendOrderedBroadcast(Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras, Bundle options) { warnIfCallingFromSystemProcess(); IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = mPackageInfo.getReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, mMainThread.getInstrumentation(), false); } else { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = new LoadedApk.ReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver(); } } String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); String[] receiverPermissions = receiverPermission == null ? null : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, receiverPermissions, appOp, options, true, false, getUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 12
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
@Override public ArtManager getArtManager() { synchronized (mLock) { if (mArtManager == null) { try { mArtManager = new ArtManager(mContext, mPM.getArtManager()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return mArtManager; } }
Example 13
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
/** @hide */ @Override public Drawable getInstantAppIcon(String packageName) { try { Bitmap bitmap = mPM.getInstantAppIcon(packageName, getUserId()); if (bitmap != null) { return new BitmapDrawable(null, bitmap); } return null; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 14
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
@Override public void deleteApplicationCacheFiles(String packageName, IPackageDataObserver observer) { try { mPM.deleteApplicationCacheFiles(packageName, observer); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 15
Source Project: android_9.0.0_r45 File: NotificationManager.java License: Apache License 2.0 | 5 votes |
/** @hide */ public void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId, boolean granted) { INotificationManager service = getService(); try { service.setNotificationListenerAccessGrantedForUser(listener, userId, granted); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 16
Source Project: AndroidComponentPlugin File: ApplicationPackageManager.java License: Apache License 2.0 | 5 votes |
/** * @hide */ @Override public void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, int targetUserId, int flags) { try { mPM.addCrossProfileIntentFilter(filter, mContext.getOpPackageName(), sourceUserId, targetUserId, flags); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 17
Source Project: android_9.0.0_r45 File: InputMethodManager.java License: Apache License 2.0 | 5 votes |
/** * @hide */ public void hideStatusIconInternal(IBinder imeToken) { try { mService.updateStatusIcon(imeToken, null, 0); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 18
Source Project: android_9.0.0_r45 File: AppOpsManager.java License: Apache License 2.0 | 5 votes |
/** * Like {@link #noteProxyOp(int, String)} but instead * of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. * @hide */ public int noteProxyOpNoThrow(int op, String proxiedPackageName) { try { return mService.noteProxyOperation(op, mContext.getOpPackageName(), Binder.getCallingUid(), proxiedPackageName); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 19
Source Project: android_9.0.0_r45 File: WallpaperManager.java License: Apache License 2.0 | 5 votes |
/** * Return whether any users are currently set to use the wallpaper * with the given resource ID. That is, their wallpaper has been * set through {@link #setResource(int)} with the same resource id. */ public boolean hasResourceWallpaper(@RawRes int resid) { if (sGlobals.mService == null) { Log.w(TAG, "WallpaperService not running"); throw new RuntimeException(new DeadSystemException()); } try { Resources resources = mContext.getResources(); String name = "res:" + resources.getResourceName(resid); return sGlobals.mService.hasNamedWallpaper(name); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 20
Source Project: android_9.0.0_r45 File: AppWidgetManager.java License: Apache License 2.0 | 3 votes |
/** * Update the extras for a given widget instance. * <p> * The extras can be used to embed additional information about this widget to be accessed * by the associated widget's AppWidgetProvider. * * @see #getAppWidgetOptions(int) * * @param appWidgetId The AppWidget instances for which to set the RemoteViews. * @param options The options to associate with this widget */ public void updateAppWidgetOptions(int appWidgetId, Bundle options) { if (mService == null) { return; } try { mService.updateAppWidgetOptions(mPackageName, appWidgetId, options); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }