Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8babe474 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Deferring cross-profile animation after the dialog"

parents e0ef4d91 3267035b
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -45,12 +45,14 @@ public class SuspendedAppActivity extends AlertActivity
    public static final String EXTRA_SUSPENDING_PACKAGE =
    public static final String EXTRA_SUSPENDING_PACKAGE =
            PACKAGE_NAME + ".extra.SUSPENDING_PACKAGE";
            PACKAGE_NAME + ".extra.SUSPENDING_PACKAGE";
    public static final String EXTRA_DIALOG_INFO = PACKAGE_NAME + ".extra.DIALOG_INFO";
    public static final String EXTRA_DIALOG_INFO = PACKAGE_NAME + ".extra.DIALOG_INFO";
    public static final String EXTRA_ACTIVITY_OPTIONS = PACKAGE_NAME + ".extra.ACTIVITY_OPTIONS";


    private Intent mMoreDetailsIntent;
    private Intent mMoreDetailsIntent;
    private int mUserId;
    private int mUserId;
    private PackageManager mPm;
    private PackageManager mPm;
    private Resources mSuspendingAppResources;
    private Resources mSuspendingAppResources;
    private SuspendDialogInfo mSuppliedDialogInfo;
    private SuspendDialogInfo mSuppliedDialogInfo;
    private Bundle mOptions;


    private CharSequence getAppLabel(String packageName) {
    private CharSequence getAppLabel(String packageName) {
        try {
        try {
@@ -143,6 +145,7 @@ public class SuspendedAppActivity extends AlertActivity
        getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
        getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);


        final Intent intent = getIntent();
        final Intent intent = getIntent();
        mOptions = intent.getBundleExtra(EXTRA_ACTIVITY_OPTIONS);
        mUserId = intent.getIntExtra(Intent.EXTRA_USER_ID, -1);
        mUserId = intent.getIntExtra(Intent.EXTRA_USER_ID, -1);
        if (mUserId < 0) {
        if (mUserId < 0) {
            Slog.wtf(TAG, "Invalid user: " + mUserId);
            Slog.wtf(TAG, "Invalid user: " + mUserId);
@@ -178,20 +181,22 @@ public class SuspendedAppActivity extends AlertActivity
    public void onClick(DialogInterface dialog, int which) {
    public void onClick(DialogInterface dialog, int which) {
        switch (which) {
        switch (which) {
            case AlertDialog.BUTTON_NEUTRAL:
            case AlertDialog.BUTTON_NEUTRAL:
                startActivityAsUser(mMoreDetailsIntent, UserHandle.of(mUserId));
                startActivityAsUser(mMoreDetailsIntent, mOptions, UserHandle.of(mUserId));
                Slog.i(TAG, "Started more details activity");
                Slog.i(TAG, "Started activity: " + mMoreDetailsIntent.getAction()
                        + " in user " + mUserId);
                break;
                break;
        }
        }
        finish();
        finish();
    }
    }


    public static Intent createSuspendedAppInterceptIntent(String suspendedPackage,
    public static Intent createSuspendedAppInterceptIntent(String suspendedPackage,
            String suspendingPackage, SuspendDialogInfo dialogInfo, int userId) {
            String suspendingPackage, SuspendDialogInfo dialogInfo, Bundle options, int userId) {
        return new Intent()
        return new Intent()
                .setClassName("android", SuspendedAppActivity.class.getName())
                .setClassName("android", SuspendedAppActivity.class.getName())
                .putExtra(EXTRA_SUSPENDED_PACKAGE, suspendedPackage)
                .putExtra(EXTRA_SUSPENDED_PACKAGE, suspendedPackage)
                .putExtra(EXTRA_DIALOG_INFO, dialogInfo)
                .putExtra(EXTRA_DIALOG_INFO, dialogInfo)
                .putExtra(EXTRA_SUSPENDING_PACKAGE, suspendingPackage)
                .putExtra(EXTRA_SUSPENDING_PACKAGE, suspendingPackage)
                .putExtra(EXTRA_ACTIVITY_OPTIONS, options)
                .putExtra(Intent.EXTRA_USER_ID, userId)
                .putExtra(Intent.EXTRA_USER_ID, userId)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                        | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+1 −1
Original line number Original line Diff line number Diff line
@@ -635,7 +635,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                            mPackageManagerInternal.getSuspendedDialogInfo(providerPackage,
                            mPackageManagerInternal.getSuspendedDialogInfo(providerPackage,
                                    suspendingPackage, providerUserId);
                                    suspendingPackage, providerUserId);
                    onClickIntent = SuspendedAppActivity.createSuspendedAppInterceptIntent(
                    onClickIntent = SuspendedAppActivity.createSuspendedAppInterceptIntent(
                            providerPackage, suspendingPackage, dialogInfo, providerUserId);
                            providerPackage, suspendingPackage, dialogInfo, null, providerUserId);
                }
                }
            } else if (provider.maskedByQuietProfile) {
            } else if (provider.maskedByQuietProfile) {
                showBadge = true;
                showBadge = true;
+2 −1
Original line number Original line Diff line number Diff line
@@ -252,7 +252,8 @@ class ActivityStartInterceptor {
        final SuspendDialogInfo dialogInfo = pmi.getSuspendedDialogInfo(suspendedPackage,
        final SuspendDialogInfo dialogInfo = pmi.getSuspendedDialogInfo(suspendedPackage,
                suspendingPackage, mUserId);
                suspendingPackage, mUserId);
        mIntent = SuspendedAppActivity.createSuspendedAppInterceptIntent(suspendedPackage,
        mIntent = SuspendedAppActivity.createSuspendedAppInterceptIntent(suspendedPackage,
                suspendingPackage, dialogInfo, mUserId);
                suspendingPackage, dialogInfo, deferCrossProfileAppsAnimationIfNecessary(),
                mUserId);
        mCallingPid = mRealCallingPid;
        mCallingPid = mRealCallingPid;
        mCallingUid = mRealCallingUid;
        mCallingUid = mRealCallingUid;
        mResolvedType = null;
        mResolvedType = null;