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

Commit 0baee10f authored by Rohit Goyal's avatar Rohit Goyal
Browse files

Update interception for archived apps in ActivityStarter to abort bundle...

Update interception for archived apps in ActivityStarter to abort bundle options and cancel remote animations during unarchival.

* As part of unarchival, we return early in ActivityStarter. We should abort all the user provided options since no resultant activity is to be started.
* We should also cancel any pending remote animations so that Launchers are not needlessly blocked for activity launch animation feedback during unarchival.

Test: atest PackageInstallerArchiveTest
Bug: 318394698
Bug: 313074449
Change-Id: Ie2c8bb2f9939697774ff8ed23eeb3007031b32df
parent d707002e
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.server.pm;
import static android.app.ActivityManager.START_ABORTED;
import static android.app.ActivityManager.START_CLASS_NOT_FOUND;
import static android.app.ActivityManager.START_PERMISSION_DENIED;
import static android.app.ActivityManager.START_SUCCESS;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.MODE_IGNORED;
import static android.app.ComponentOptions.MODE_BACKGROUND_ACTIVITY_START_DENIED;
@@ -286,10 +285,16 @@ public class PackageArchiver {
            Slog.e(TAG, TextUtils.formatSimple(
                    "Unexpected error occurred while unarchiving package %s: %s.", packageName,
                    t.getLocalizedMessage()));
            return START_ABORTED;
        }

        return START_SUCCESS;
        // We return STATUS_ABORTED because:
        // 1. Archived App is not actually present during activity start. Hence the unarchival
        // start should be treated as an error code.
        // 2. STATUS_ABORTED is not visible to the end consumers. Hence, it will not change user
        // experience.
        // 3. Returning STATUS_ABORTED helps us avoid manually handling of different cases like
        // aborting activity options, animations etc in the Windows Manager.
        return START_ABORTED;
    }

    /**
+4 −5
Original line number Diff line number Diff line
@@ -1034,20 +1034,19 @@ class ActivityStarter {
        }

        if (err == ActivityManager.START_SUCCESS && aInfo == null) {
            // We couldn't find the specific class specified in the Intent.
            err = ActivityManager.START_CLASS_NOT_FOUND;

            if (isArchivingEnabled()) {
                PackageArchiver packageArchiver = mService
                        .getPackageManagerInternalLocked()
                        .getPackageArchiver();
                if (packageArchiver.isIntentResolvedToArchivedApp(intent, mRequest.userId)) {
                    return packageArchiver
                    err = packageArchiver
                            .requestUnarchiveOnActivityStart(
                                    intent, callingPackage, mRequest.userId, realCallingUid);
                }
            }

            // We couldn't find the specific class specified in the Intent.
            // Also the end of the line.
            err = ActivityManager.START_CLASS_NOT_FOUND;
        }

        if (err == ActivityManager.START_SUCCESS && sourceRecord != null