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

Commit 97f7858b authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Reduce lock contention of setting running shell remote transition" into...

Merge "Reduce lock contention of setting running shell remote transition" into tm-qpr-dev am: 86725073

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19459469



Change-Id: I74d6b125ef9ad1b6176254f1b36ebbe13cbcbcd9
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b9cf8d6a 86725073
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.app.PendingIntent;
import android.app.WindowConfiguration;
import android.content.Context;
@@ -522,14 +521,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                                finishedCallback.onAnimationFinished();
                            }
                        };
                Transitions.setRunningRemoteTransitionDelegate(adapter.getCallingApplication());
                try {
                    try {
                        ActivityTaskManager.getService().setRunningRemoteTransitionDelegate(
                                adapter.getCallingApplication());
                    } catch (SecurityException e) {
                        Slog.e(TAG, "Unable to boost animation thread. This should only happen"
                                + " during unit tests");
                    }
                    adapter.getRunner().onAnimationStart(transit, apps, wallpapers,
                            augmentedNonApps, wrapCallback);
                } catch (RemoteException e) {
+1 −9
Original line number Diff line number Diff line
@@ -18,11 +18,9 @@ package com.android.wm.shell.transition;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityTaskManager;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.util.Slog;
import android.view.SurfaceControl;
import android.window.IRemoteTransition;
import android.window.IRemoteTransitionFinishedCallback;
@@ -87,17 +85,11 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {
                });
            }
        };
        Transitions.setRunningRemoteTransitionDelegate(mRemote.getAppThread());
        try {
            if (mRemote.asBinder() != null) {
                mRemote.asBinder().linkToDeath(remoteDied, 0 /* flags */);
            }
            try {
                ActivityTaskManager.getService().setRunningRemoteTransitionDelegate(
                        mRemote.getAppThread());
            } catch (SecurityException e) {
                Slog.e(Transitions.TAG, "Unable to boost animation thread. This should only happen"
                        + " during unit tests");
            }
            mRemote.getRemoteTransition().startAnimation(transition, info, startTransaction, cb);
            // assume that remote will apply the start transaction.
            startTransaction.clear();
+1 −8
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.wm.shell.transition;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityTaskManager;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.ArrayMap;
@@ -129,15 +128,9 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
                });
            }
        };
        Transitions.setRunningRemoteTransitionDelegate(remote.getAppThread());
        try {
            handleDeath(remote.asBinder(), finishCallback);
            try {
                ActivityTaskManager.getService().setRunningRemoteTransitionDelegate(
                        remote.getAppThread());
            } catch (SecurityException e) {
                Log.e(Transitions.TAG, "Unable to boost animation thread. This should only happen"
                        + " during unit tests");
            }
            remote.getRemoteTransition().startAnimation(transition, info, startTransaction, cb);
            // assume that remote will apply the start transaction.
            startTransaction.clear();
+15 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTas

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityTaskManager;
import android.app.IApplicationThread;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
@@ -234,6 +236,19 @@ public class Transitions implements RemoteCallable<Transitions> {
        mRemoteTransitionHandler.removeFiltered(remoteTransition);
    }

    /** Boosts the process priority of remote animation player. */
    public static void setRunningRemoteTransitionDelegate(IApplicationThread appThread) {
        if (appThread == null) return;
        try {
            ActivityTaskManager.getService().setRunningRemoteTransitionDelegate(appThread);
        } catch (SecurityException e) {
            Log.e(TAG, "Unable to boost animation process. This should only happen"
                    + " during unit tests");
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
    }

    /**
     * Runs the given {@code runnable} when the last active transition has finished, or immediately
     * if there are currently no active transitions.
+0 −3
Original line number Diff line number Diff line
@@ -1661,9 +1661,6 @@ class ActivityStarter {
                && transitionController.getTransitionPlayer() != null)
                ? transitionController.createTransition(TRANSIT_OPEN) : null;
        RemoteTransition remoteTransition = r.takeRemoteTransition();
        if (newTransition != null && remoteTransition != null) {
            newTransition.setRemoteTransition(remoteTransition);
        }
        transitionController.collect(r);
        try {
            mService.deferWindowLayout();
Loading