android.content.IIntentSender Java Examples
The following examples show how to use
android.content.IIntentSender.
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 File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * @hide * Note that UserHandle.CURRENT will be interpreted at the time the * activity is started, not when the pending intent is created. */ public static PendingIntent getActivityAsUser(Context context, int requestCode, @NonNull Intent intent, int flags, Bundle options, UserHandle user) { String packageName = context.getPackageName(); String resolvedType = intent != null ? intent.resolveTypeIfNeeded( context.getContentResolver()) : null; try { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(context); IIntentSender target = ActivityManager.getService().getIntentSender( ActivityManager.INTENT_SENDER_ACTIVITY, packageName, null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, flags, options, user.getIdentifier()); return target != null ? new PendingIntent(target) : null; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #2
Source File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * @hide * Note that UserHandle.CURRENT will be interpreted at the time the * activity is started, not when the pending intent is created. */ public static PendingIntent getActivitiesAsUser(Context context, int requestCode, @NonNull Intent[] intents, int flags, Bundle options, UserHandle user) { String packageName = context.getPackageName(); String[] resolvedTypes = new String[intents.length]; for (int i=0; i<intents.length; i++) { intents[i].migrateExtraStreamToClipData(); intents[i].prepareToLeaveProcess(context); resolvedTypes[i] = intents[i].resolveTypeIfNeeded(context.getContentResolver()); } try { IIntentSender target = ActivityManager.getService().getIntentSender( ActivityManager.INTENT_SENDER_ACTIVITY, packageName, null, null, requestCode, intents, resolvedTypes, flags, options, user.getIdentifier()); return target != null ? new PendingIntent(target) : null; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #3
Source File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * @hide * Note that UserHandle.CURRENT will be interpreted at the time the * broadcast is sent, not when the pending intent is created. */ public static PendingIntent getBroadcastAsUser(Context context, int requestCode, Intent intent, int flags, UserHandle userHandle) { String packageName = context.getPackageName(); String resolvedType = intent != null ? intent.resolveTypeIfNeeded( context.getContentResolver()) : null; try { intent.prepareToLeaveProcess(context); IIntentSender target = ActivityManager.getService().getIntentSender( ActivityManager.INTENT_SENDER_BROADCAST, packageName, null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, flags, null, userHandle.getIdentifier()); return target != null ? new PendingIntent(target) : null; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #4
Source File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private static PendingIntent buildServicePendingIntent(Context context, int requestCode, Intent intent, int flags, int serviceKind) { String packageName = context.getPackageName(); String resolvedType = intent != null ? intent.resolveTypeIfNeeded( context.getContentResolver()) : null; try { intent.prepareToLeaveProcess(context); IIntentSender target = ActivityManager.getService().getIntentSender( serviceKind, packageName, null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, flags, null, context.getUserId()); return target != null ? new PendingIntent(target) : null; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #5
Source File: ActivityStartInterceptor.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private IntentSender createIntentSenderForOriginalIntent(int callingUid, int flags) { Bundle activityOptions = deferCrossProfileAppsAnimationIfNecessary(); final IIntentSender target = mService.getIntentSenderLocked( INTENT_SENDER_ACTIVITY, mCallingPackage, callingUid, mUserId, null /*token*/, null /*resultCode*/, 0 /*requestCode*/, new Intent[] { mIntent }, new String[] { mResolvedType }, flags, activityOptions); return new IntentSender(target); }
Example #6
Source File: ActivityManagerNativeWorker.java From GPT with Apache License 2.0 | 5 votes |
public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent intent, String resolvedType, int flags) { Intent intents[] = {intent}; remapIntents(mHostContext, intents, false); return mTarget.getIntentSender(type, mHostContext.getPackageName(), token, resultWho, requestCode, intent, resolvedType, flags); }
Example #7
Source File: ActivityManagerNativeWorker.java From GPT with Apache License 2.0 | 5 votes |
public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle options, int userId) throws RemoteException { remapIntents(mHostContext, intents, false); return mTarget.getIntentSender(type, mHostContext.getPackageName(), token, resultWho, requestCode, intents, resolvedTypes, flags, options, userId); }
Example #8
Source File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
PendingIntent(IBinder target, Object cookie) { mTarget = IIntentSender.Stub.asInterface(target); if (cookie != null) { mWhitelistToken = (IBinder)cookie; } }
Example #9
Source File: IActivityManager.java From GPT with Apache License 2.0 | 4 votes |
/** * 4.4 5.x 6.0 */ public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle options, int userId) throws RemoteException;
Example #10
Source File: IActivityManager.java From GPT with Apache License 2.0 | 4 votes |
/** * 4.1 */ public IIntentSender getIntentSender(int type, String packageName, IBinder token, String reesultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle options) throws RemoteException;
Example #11
Source File: IActivityManager.java From GPT with Apache License 2.0 | 4 votes |
/** * 2.x */ public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent intent, String resolvedType, int flags);
Example #12
Source File: ActivityManagerNativeWorker.java From GPT with Apache License 2.0 | 4 votes |
public IIntentSender getIntentSender(int type, String packageName, IBinder token, String reesultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle bundle) throws RemoteException { remapIntents(mHostContext, intents, false); return mTarget.getIntentSender(type, mHostContext.getPackageName(), token, reesultWho, requestCode, intents, resolvedTypes, flags, bundle); }
Example #13
Source File: ActivityManagerNativeWorker.java From GPT with Apache License 2.0 | 4 votes |
public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags) throws RemoteException { remapIntents(mHostContext, intents, false); return mTarget.getIntentSender(type, mHostContext.getPackageName(), token, resultWho, requestCode, intents, resolvedTypes, flags); }
Example #14
Source File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** @hide */ public IIntentSender getTarget() { return mTarget; }
Example #15
Source File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
PendingIntent(IIntentSender target) { mTarget = target; }
Example #16
Source File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * Like {@link #getActivity(Context, int, Intent, int)}, but allows an * array of Intents to be supplied. The last Intent in the array is * taken as the primary key for the PendingIntent, like the single Intent * given to {@link #getActivity(Context, int, Intent, int)}. Upon sending * the resulting PendingIntent, all of the Intents are started in the same * way as they would be by passing them to {@link Context#startActivities(Intent[])}. * * <p class="note"> * The <em>first</em> intent in the array will be started outside of the context of an * existing activity, so you must use the {@link Intent#FLAG_ACTIVITY_NEW_TASK * Intent.FLAG_ACTIVITY_NEW_TASK} launch flag in the Intent. (Activities after * the first in the array are started in the context of the previous activity * in the array, so FLAG_ACTIVITY_NEW_TASK is not needed nor desired for them.) * </p> * * <p class="note"> * The <em>last</em> intent in the array represents the key for the * PendingIntent. In other words, it is the significant element for matching * (as done with the single intent given to {@link #getActivity(Context, int, Intent, int)}, * its content will be the subject of replacement by * {@link #send(Context, int, Intent)} and {@link #FLAG_UPDATE_CURRENT}, etc. * This is because it is the most specific of the supplied intents, and the * UI the user actually sees when the intents are started. * </p> * * <p class="note">For security reasons, the {@link android.content.Intent} objects * you supply here should almost always be <em>explicit intents</em>, * that is specify an explicit component to be delivered to through * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p> * * @param context The Context in which this PendingIntent should start * the activity. * @param requestCode Private request code for the sender * @param intents Array of Intents of the activities to be launched. * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE}, * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT}, * {@link #FLAG_IMMUTABLE} or any of the flags as supported by * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts * of the intent that can be supplied when the actual send happens. * * @return Returns an existing or new PendingIntent matching the given * parameters. May return null only if {@link #FLAG_NO_CREATE} has been * supplied. */ public static PendingIntent getActivities(Context context, int requestCode, @NonNull Intent[] intents, @Flags int flags, @Nullable Bundle options) { String packageName = context.getPackageName(); String[] resolvedTypes = new String[intents.length]; for (int i=0; i<intents.length; i++) { intents[i].migrateExtraStreamToClipData(); intents[i].prepareToLeaveProcess(context); resolvedTypes[i] = intents[i].resolveTypeIfNeeded(context.getContentResolver()); } try { IIntentSender target = ActivityManager.getService().getIntentSender( ActivityManager.INTENT_SENDER_ACTIVITY, packageName, null, null, requestCode, intents, resolvedTypes, flags, options, context.getUserId()); return target != null ? new PendingIntent(target) : null; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #17
Source File: PendingIntent.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * Retrieve a PendingIntent that will start a new activity, like calling * {@link Context#startActivity(Intent) Context.startActivity(Intent)}. * Note that the activity will be started outside of the context of an * existing activity, so you must use the {@link Intent#FLAG_ACTIVITY_NEW_TASK * Intent.FLAG_ACTIVITY_NEW_TASK} launch flag in the Intent. * * <p class="note">For security reasons, the {@link android.content.Intent} * you supply here should almost always be an <em>explicit intent</em>, * that is specify an explicit component to be delivered to through * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p> * * @param context The Context in which this PendingIntent should start * the activity. * @param requestCode Private request code for the sender * @param intent Intent of the activity to be launched. * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE}, * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT}, * or any of the flags as supported by * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts * of the intent that can be supplied when the actual send happens. * @param options Additional options for how the Activity should be started. * May be null if there are no options. * * @return Returns an existing or new PendingIntent matching the given * parameters. May return null only if {@link #FLAG_NO_CREATE} has been * supplied. */ public static PendingIntent getActivity(Context context, int requestCode, @NonNull Intent intent, @Flags int flags, @Nullable Bundle options) { String packageName = context.getPackageName(); String resolvedType = intent != null ? intent.resolveTypeIfNeeded( context.getContentResolver()) : null; try { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(context); IIntentSender target = ActivityManager.getService().getIntentSender( ActivityManager.INTENT_SENDER_ACTIVITY, packageName, null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, flags, options, context.getUserId()); return target != null ? new PendingIntent(target) : null; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #18
Source File: ActiveServices.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private boolean requestStartTargetPermissionsReviewIfNeededLocked(ServiceRecord r, String callingPackage, int callingUid, Intent service, boolean callerFg, final int userId) { if (mAm.getPackageManagerInternalLocked().isPermissionsReviewRequired( r.packageName, r.userId)) { // Show a permission review UI only for starting from a foreground app if (!callerFg) { Slog.w(TAG, "u" + r.userId + " Starting a service in package" + r.packageName + " requires a permissions review"); return false; } IIntentSender target = mAm.getIntentSenderLocked( ActivityManager.INTENT_SENDER_SERVICE, callingPackage, callingUid, userId, null, null, 0, new Intent[]{service}, new String[]{service.resolveType(mAm.mContext.getContentResolver())}, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE, null); final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSIONS); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); intent.putExtra(Intent.EXTRA_PACKAGE_NAME, r.packageName); intent.putExtra(Intent.EXTRA_INTENT, new IntentSender(target)); if (DEBUG_PERMISSIONS_REVIEW) { Slog.i(TAG, "u" + r.userId + " Launching permission review for package " + r.packageName); } mAm.mHandler.post(new Runnable() { @Override public void run() { mAm.mContext.startActivityAsUser(intent, new UserHandle(userId)); } }); return false; } return true; }
Example #19
Source File: PackageManagerShellCommand.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
public IntentSender getIntentSender() { return new IntentSender((IIntentSender) mLocalSender); }
Example #20
Source File: ActivityManagerInternal.java From android_9.0.0_r45 with Apache License 2.0 | 2 votes |
/** * Sets how long a {@link PendingIntent} can be temporarily whitelist to by bypass restrictions * such as Power Save mode. */ public abstract void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken, long duration);
Example #21
Source File: ActivityManagerInternal.java From AndroidComponentPlugin with Apache License 2.0 | 2 votes |
/** * Sets how long a {@link PendingIntent} can be temporarily whitelist to by bypass restrictions * such as Power Save mode. */ public abstract void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken, long duration);
Example #22
Source File: IActivityManager.java From GPT with Apache License 2.0 | 2 votes |
/** * 4.0 */ public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags) throws RemoteException;