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

Commit dde76dd5 authored by Evan Rosky's avatar Evan Rosky Committed by Android (Google) Code Review
Browse files

Merge "Share apply token between WMCore and WMShell"

parents 5a12f60b 9071563b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -105,4 +105,7 @@ interface IWindowOrganizerController {

    /** @return An interface enabling the transition players to report its metrics. */
    ITransitionMetricsReporter getTransitionMetricsReporter();

    /** @return The transaction queue token used by WM. */
    IBinder getApplyToken();
}
+21 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.util.Singleton;
import android.view.RemoteAnimationAdapter;
import android.view.SurfaceControl;

/**
 * Base class for organizing specific types of windows like Tasks and DisplayAreas
@@ -184,6 +185,26 @@ public class WindowOrganizer {
        }
    }

    /**
     * Use WM's transaction-queue instead of Shell's independent one. This is necessary
     * if WM and Shell need to coordinate transactions (eg. for shell transitions).
     * @return true if successful, false otherwise.
     * @hide
     */
    public boolean shareTransactionQueue() {
        final IBinder wmApplyToken;
        try {
            wmApplyToken = getWindowOrganizerController().getApplyToken();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
        if (wmApplyToken == null) {
            return false;
        }
        SurfaceControl.Transaction.setDefaultApplyToken(wmApplyToken);
        return true;
    }

    static IWindowOrganizerController getWindowOrganizerController() {
        return IWindowOrganizerControllerSingleton.get();
    }
+3 −0
Original line number Diff line number Diff line
@@ -175,6 +175,9 @@ public class Transitions implements RemoteCallable<Transitions> {
    }

    private void onInit() {
        if (Transitions.ENABLE_SHELL_TRANSITIONS) {
            mOrganizer.shareTransactionQueue();
        }
        mShellController.addExternalInterface(KEY_EXTRA_SHELL_SHELL_TRANSITIONS,
                this::createExternalInterface, this);

+6 −0
Original line number Diff line number Diff line
@@ -1547,6 +1547,12 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
        return mTransitionController.mTransitionMetricsReporter;
    }

    @Override
    public IBinder getApplyToken() {
        enforceTaskPermission("getApplyToken()");
        return SurfaceControl.Transaction.getDefaultApplyToken();
    }

    /** Whether the configuration changes are important to report back to an organizer. */
    static boolean configurationsAreEqualForOrganizer(
            Configuration newConfig, @Nullable Configuration oldConfig) {