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

Commit 3267035b authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Deferring cross-profile animation after the dialog

The animation is deferred until a cross-profile activity
is started from the dialog.

Test: Manual:
1. Install any app that uses cross profile API
2. Suspend the app in one profile only
3. Navigate to the profile instance from within the app

Fixes: 144840723
Change-Id: Ia86708c1c4d708e2bae454b4cfe1ba8d4b413c5c
parent 960a8cf9
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -45,12 +45,14 @@ public class SuspendedAppActivity extends AlertActivity
    public static final String 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_ACTIVITY_OPTIONS = PACKAGE_NAME + ".extra.ACTIVITY_OPTIONS";

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

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

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

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