Search in sources :

Example 86 with IIntentSender

use of android.content.IIntentSender in project android_frameworks_base by AOSPA.

the class ActivityStartInterceptor method interceptQuietProfileIfNeeded.

private boolean interceptQuietProfileIfNeeded() {
    // Do not intercept if the user has not turned off the profile
    if (!mUserManager.isQuietModeEnabled(UserHandle.of(mUserId))) {
        return false;
    }
    IIntentSender target = mService.getIntentSenderLocked(INTENT_SENDER_ACTIVITY, mCallingPackage, mCallingUid, mUserId, null, null, 0, new Intent[] { mIntent }, new String[] { mResolvedType }, FLAG_CANCEL_CURRENT | FLAG_ONE_SHOT, null);
    mIntent = UnlaunchableAppActivity.createInQuietModeDialogIntent(mUserId, new IntentSender(target));
    mCallingPid = mRealCallingPid;
    mCallingUid = mRealCallingUid;
    mResolvedType = null;
    final UserInfo parent = mUserManager.getProfileParent(mUserId);
    mRInfo = mSupervisor.resolveIntent(mIntent, mResolvedType, parent.id);
    mAInfo = mSupervisor.resolveActivity(mIntent, mRInfo, mStartFlags, null);
    return true;
}
Also used : IIntentSender(android.content.IIntentSender) UserInfo(android.content.pm.UserInfo) IIntentSender(android.content.IIntentSender) IntentSender(android.content.IntentSender)

Example 87 with IIntentSender

use of android.content.IIntentSender in project android_frameworks_base by AOSPA.

the class ActivityStarter method showConfirmDeviceCredential.

void showConfirmDeviceCredential(int userId) {
    // First, retrieve the stack that we want to resume after credential is confirmed.
    ActivityStack targetStack;
    ActivityStack fullscreenStack = mSupervisor.getStack(FULLSCREEN_WORKSPACE_STACK_ID);
    ActivityStack freeformStack = mSupervisor.getStack(FREEFORM_WORKSPACE_STACK_ID);
    if (fullscreenStack != null && fullscreenStack.getStackVisibilityLocked(null) != ActivityStack.STACK_INVISIBLE) {
        // Single window case and the case that the docked stack is shown with fullscreen stack.
        targetStack = fullscreenStack;
    } else if (freeformStack != null && freeformStack.getStackVisibilityLocked(null) != ActivityStack.STACK_INVISIBLE) {
        targetStack = freeformStack;
    } else {
        // The case that the docked stack is shown with recent.
        targetStack = mSupervisor.getStack(HOME_STACK_ID);
    }
    if (targetStack == null) {
        return;
    }
    final KeyguardManager km = (KeyguardManager) mService.mContext.getSystemService(Context.KEYGUARD_SERVICE);
    final Intent credential = km.createConfirmDeviceCredentialIntent(null, null, userId);
    // For safety, check null here in case users changed the setting after the checking.
    if (credential == null) {
        return;
    }
    final ActivityRecord activityRecord = targetStack.topRunningActivityLocked();
    if (activityRecord != null) {
        final IIntentSender target = mService.getIntentSenderLocked(ActivityManager.INTENT_SENDER_ACTIVITY, activityRecord.launchedFromPackage, activityRecord.launchedFromUid, activityRecord.userId, null, null, 0, new Intent[] { activityRecord.intent }, new String[] { activityRecord.resolvedType }, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE, null);
        credential.putExtra(Intent.EXTRA_INTENT, new IntentSender(target));
        // Show confirm credentials activity.
        startConfirmCredentialIntent(credential);
    }
}
Also used : IIntentSender(android.content.IIntentSender) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) IntentSender(android.content.IntentSender) IIntentSender(android.content.IIntentSender) KeyguardManager(android.app.KeyguardManager)

Example 88 with IIntentSender

use of android.content.IIntentSender in project android_frameworks_base by AOSPA.

the class ActivityManagerProxy method getIntentSender.

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 {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    data.writeInterfaceToken(IActivityManager.descriptor);
    data.writeInt(type);
    data.writeString(packageName);
    data.writeStrongBinder(token);
    data.writeString(resultWho);
    data.writeInt(requestCode);
    if (intents != null) {
        data.writeInt(1);
        data.writeTypedArray(intents, 0);
        data.writeStringArray(resolvedTypes);
    } else {
        data.writeInt(0);
    }
    data.writeInt(flags);
    if (options != null) {
        data.writeInt(1);
        options.writeToParcel(data, 0);
    } else {
        data.writeInt(0);
    }
    data.writeInt(userId);
    mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
    reply.readException();
    IIntentSender res = IIntentSender.Stub.asInterface(reply.readStrongBinder());
    data.recycle();
    reply.recycle();
    return res;
}
Also used : IIntentSender(android.content.IIntentSender) Parcel(android.os.Parcel)

Example 89 with IIntentSender

use of android.content.IIntentSender in project android_frameworks_base by AOSPA.

the class ActiveServices method requestStartTargetPermissionsReviewIfNeededLocked.

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;
}
Also used : IIntentSender(android.content.IIntentSender) UserHandle(android.os.UserHandle) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) IIntentSender(android.content.IIntentSender) IntentSender(android.content.IntentSender)

Example 90 with IIntentSender

use of android.content.IIntentSender in project android_frameworks_base by ResurrectionRemix.

the class ActiveServices method requestStartTargetPermissionsReviewIfNeededLocked.

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;
}
Also used : IIntentSender(android.content.IIntentSender) UserHandle(android.os.UserHandle) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) IIntentSender(android.content.IIntentSender) IntentSender(android.content.IntentSender)

Aggregations

IIntentSender (android.content.IIntentSender)106 RemoteException (android.os.RemoteException)57 IntentSender (android.content.IntentSender)43 Intent (android.content.Intent)38 PendingIntent (android.app.PendingIntent)33 KeyguardManager (android.app.KeyguardManager)10 ResolveInfo (android.content.pm.ResolveInfo)10 UserInfo (android.content.pm.UserInfo)10 UserHandle (android.os.UserHandle)10 Parcel (android.os.Parcel)9 ComponentName (android.content.ComponentName)8 ActivityInfo (android.content.pm.ActivityInfo)8 HeavyWeightSwitcherActivity (com.android.internal.app.HeavyWeightSwitcherActivity)8 ActivityOptions (android.app.ActivityOptions)5 IActivityContainer (android.app.IActivityContainer)5 UserManager (android.os.UserManager)5 PendingActivityLaunch (com.android.server.am.ActivityStackSupervisor.PendingActivityLaunch)5 Point (android.graphics.Point)4 Message (android.os.Message)4