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

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

Merge "Allowing launch cookies to be passed via pending activity starts" into tm-dev

parents 724e51d9 ad594686
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ interface IActivityTaskManager {
     * a short predefined amount of time.
     */
    void registerRemoteAnimationForNextActivityStart(in String packageName,
           in RemoteAnimationAdapter adapter);
            in RemoteAnimationAdapter adapter, in IBinder launchCookie);

    /**
     * Registers remote animations for a display.
+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ class ActivityLaunchAnimator(
        if (packageName != null && animationAdapter != null) {
            try {
                ActivityTaskManager.getService().registerRemoteAnimationForNextActivityStart(
                    packageName, animationAdapter)
                    packageName, animationAdapter, null /* launchCookie */)
            } catch (e: RemoteException) {
                Log.w(TAG, "Unable to register the remote animation", e)
            }
+2 −2
Original line number Diff line number Diff line
@@ -523,8 +523,8 @@ public class ActivityStartController {
    }

    void registerRemoteAnimationForNextActivityStart(String packageName,
            RemoteAnimationAdapter adapter) {
        mPendingRemoteAnimationRegistry.addPendingAnimation(packageName, adapter);
            RemoteAnimationAdapter adapter, @Nullable IBinder launchCookie) {
        mPendingRemoteAnimationRegistry.addPendingAnimation(packageName, adapter, launchCookie);
    }

    PendingRemoteAnimationRegistry getPendingRemoteAnimationRegistry() {
+2 −2
Original line number Diff line number Diff line
@@ -3714,7 +3714,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {

    @Override
    public void registerRemoteAnimationForNextActivityStart(String packageName,
            RemoteAnimationAdapter adapter) {
            RemoteAnimationAdapter adapter, IBinder launchCookie) {
        mAmInternal.enforceCallingPermission(CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS,
                "registerRemoteAnimationForNextActivityStart");
        adapter.setCallingPidUid(Binder.getCallingPid(), Binder.getCallingUid());
@@ -3722,7 +3722,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            final long origId = Binder.clearCallingIdentity();
            try {
                getActivityStartController().registerRemoteAnimationForNextActivityStart(
                        packageName, adapter);
                        packageName, adapter, launchCookie);
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
+12 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.wm;
import android.annotation.Nullable;
import android.app.ActivityOptions;
import android.os.Handler;
import android.os.IBinder;
import android.util.ArrayMap;
import android.view.RemoteAnimationAdapter;

@@ -43,8 +44,9 @@ class PendingRemoteAnimationRegistry {
    /**
     * Adds a remote animation to be run for all activity starts originating from a certain package.
     */
    void addPendingAnimation(String packageName, RemoteAnimationAdapter adapter) {
        mEntries.put(packageName, new Entry(packageName, adapter));
    void addPendingAnimation(String packageName, RemoteAnimationAdapter adapter,
            @Nullable IBinder launchCookie) {
        mEntries.put(packageName, new Entry(packageName, adapter, launchCookie));
    }

    /**
@@ -62,6 +64,10 @@ class PendingRemoteAnimationRegistry {
        } else {
            options.setRemoteAnimationAdapter(entry.adapter);
        }
        IBinder launchCookie = entry.launchCookie;
        if (launchCookie != null) {
            options.setLaunchCookie(launchCookie);
        }
        mEntries.remove(callingPackage);
        return options;
    }
@@ -69,10 +75,13 @@ class PendingRemoteAnimationRegistry {
    private class Entry {
        final String packageName;
        final RemoteAnimationAdapter adapter;
        @Nullable
        final IBinder launchCookie;

        Entry(String packageName, RemoteAnimationAdapter adapter) {
        Entry(String packageName, RemoteAnimationAdapter adapter, @Nullable IBinder launchCookie) {
            this.packageName = packageName;
            this.adapter = adapter;
            this.launchCookie = launchCookie;
            mHandler.postDelayed(() -> {
                synchronized (mLock) {
                    final Entry entry = mEntries.get(packageName);
Loading