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

Commit 64702da9 authored by Rohit Goyal's avatar Rohit Goyal Committed by Android (Google) Code Review
Browse files

Merge "Update interception for archived apps in ActivityStarter to abort...

Merge "Update interception for archived apps in ActivityStarter to abort bundle options and cancel remote animations during unarchival." into main
parents afb71d71 0baee10f
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