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

Commit bee66a36 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Don't take activity options that contain remote animation" into qt-dev

parents b60e6192 346702ad
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SAVED_STATE;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_STATES;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SWITCH;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_TRANSITION;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_CONFIGURATION;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_FOCUS;
@@ -1631,6 +1632,7 @@ final class ActivityRecord extends ConfigurationContainer {

    void updateOptionsLocked(ActivityOptions options) {
        if (options != null) {
            if (DEBUG_TRANSITION) Slog.i(TAG, "Update options for " + this);
            if (pendingOptions != null) {
                pendingOptions.abort();
            }
@@ -1641,6 +1643,7 @@ final class ActivityRecord extends ConfigurationContainer {
    void applyOptionsLocked() {
        if (pendingOptions != null
                && pendingOptions.getAnimationType() != ANIM_SCENE_TRANSITION) {
            if (DEBUG_TRANSITION) Slog.i(TAG, "Applying options for " + this);
            applyOptionsLocked(pendingOptions, intent);
            if (task == null) {
                clearOptionsLocked(false /* withAbort */);
@@ -1762,9 +1765,19 @@ final class ActivityRecord extends ConfigurationContainer {
        pendingOptions = null;
    }

    ActivityOptions takeOptionsLocked() {
    ActivityOptions takeOptionsLocked(boolean fromClient) {
        if (DEBUG_TRANSITION) Slog.i(TAG, "Taking options for " + this + " callers="
                + Debug.getCallers(6));
        ActivityOptions opts = pendingOptions;

        // If we are trying to take activity options from the client, do not null it out if it's a
        // remote animation as the client doesn't need it ever. This is a workaround when client is
        // faster to take the options than we are to resume the next activity.
        // TODO (b/132432864): Fix the root cause of these transition preparing/applying options
        // timing somehow
        if (!fromClient || opts == null || opts.getRemoteAnimationAdapter() == null) {
            pendingOptions = null;
        }
        return opts;
    }

+2 −2
Original line number Diff line number Diff line
@@ -3379,7 +3379,7 @@ class ActivityStack extends ConfigurationContainer {

                    canMoveOptions = false;
                    if (noOptions && topOptions == null) {
                        topOptions = p.takeOptionsLocked();
                        topOptions = p.takeOptionsLocked(false /* fromClient */);
                        if (topOptions != null) {
                            noOptions = false;
                        }
@@ -3418,7 +3418,7 @@ class ActivityStack extends ConfigurationContainer {
                    }
                    canMoveOptions = false;
                    if (noOptions && topOptions == null) {
                        topOptions = p.takeOptionsLocked();
                        topOptions = p.takeOptionsLocked(false /* fromClient */);
                        if (topOptions != null) {
                            noOptions = false;
                        }
+2 −1
Original line number Diff line number Diff line
@@ -2934,7 +2934,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                if (r != null) {
                    final ActivityOptions activityOptions = r.takeOptionsLocked();
                    final ActivityOptions activityOptions = r.takeOptionsLocked(
                            true /* fromClient */);
                    return activityOptions == null ? null : activityOptions.toBundle();
                }
                return null;
+2 −0
Original line number Diff line number Diff line
@@ -1909,6 +1909,8 @@ public class AppTransition implements Dump {
    }

    void overridePendingAppTransitionRemote(RemoteAnimationAdapter remoteAnimationAdapter) {
        if (DEBUG_APP_TRANSITIONS) Slog.i(TAG, "Override pending remote transitionSet="
                + isTransitionSet() + " adapter=" + remoteAnimationAdapter);
        if (isTransitionSet()) {
            clear();
            mNextAppTransitionType = NEXT_TRANSIT_TYPE_REMOTE;
+1 −1
Original line number Diff line number Diff line
@@ -1493,7 +1493,7 @@ class TaskRecord extends ConfigurationContainer {
                    if (r.finishing) {
                        continue;
                    }
                    ActivityOptions opts = r.takeOptionsLocked();
                    ActivityOptions opts = r.takeOptionsLocked(false /* fromClient */);
                    if (opts != null) {
                        ret.updateOptionsLocked(opts);
                    }
Loading