diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/SyncTransactionQueue.java | 53 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/transition/LegacyTransitions.java | 139 |
2 files changed, 5 insertions, 187 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SyncTransactionQueue.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SyncTransactionQueue.java index c4696d5f44f4..a8e6b593f20d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SyncTransactionQueue.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SyncTransactionQueue.java @@ -20,17 +20,14 @@ import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL; import android.annotation.BinderThread; import android.annotation.NonNull; -import android.os.RemoteException; import android.util.Slog; import android.view.SurfaceControl; -import android.view.WindowManager; import android.window.WindowContainerTransaction; import android.window.WindowContainerTransactionCallback; import android.window.WindowOrganizer; import com.android.internal.protolog.ProtoLog; import com.android.wm.shell.shared.TransactionPool; -import com.android.wm.shell.transition.LegacyTransitions; import java.util.ArrayList; @@ -87,25 +84,6 @@ public final class SyncTransactionQueue { } /** - * Queues a legacy transition to be sent serially to WM - */ - public void queue(LegacyTransitions.ILegacyTransition transition, - @WindowManager.TransitionType int type, WindowContainerTransaction wct) { - if (wct.isEmpty()) { - if (DEBUG) Slog.d(TAG, "Skip queue due to transaction change is empty"); - return; - } - SyncCallback cb = new SyncCallback(transition, type, wct); - synchronized (mQueue) { - if (DEBUG) Slog.d(TAG, "Queueing up legacy transition " + wct); - mQueue.add(cb); - if (mQueue.size() == 1) { - cb.send(); - } - } - } - - /** * Queues a sync transaction only if there are already sync transaction(s) queued or in flight. * Otherwise just returns without queueing. * @return {@code true} if queued, {@code false} if not. @@ -168,17 +146,9 @@ public final class SyncTransactionQueue { private class SyncCallback extends WindowContainerTransactionCallback { int mId = -1; final WindowContainerTransaction mWCT; - final LegacyTransitions.LegacyTransition mLegacyTransition; SyncCallback(WindowContainerTransaction wct) { mWCT = wct; - mLegacyTransition = null; - } - - SyncCallback(LegacyTransitions.ILegacyTransition legacyTransition, - @WindowManager.TransitionType int type, WindowContainerTransaction wct) { - mWCT = wct; - mLegacyTransition = new LegacyTransitions.LegacyTransition(type, legacyTransition); } // Must be sychronized on mQueue @@ -194,12 +164,7 @@ public final class SyncTransactionQueue { } if (DEBUG) Slog.d(TAG, "Sending sync transaction: " + mWCT); try { - if (mLegacyTransition != null) { - mId = new WindowOrganizer().startLegacyTransition(mLegacyTransition.getType(), - mLegacyTransition.getAdapter(), this, mWCT); - } else { - mId = new WindowOrganizer().applySyncTransaction(mWCT, this); - } + mId = new WindowOrganizer().applySyncTransaction(mWCT, this); } catch (RuntimeException e) { Slog.e(TAG, "Send failed", e); // Finish current sync callback immediately. @@ -228,18 +193,10 @@ public final class SyncTransactionQueue { if (DEBUG) Slog.d(TAG, "onTransactionReady id=" + mId); mQueue.remove(this); onTransactionReceived(t); - if (mLegacyTransition != null) { - try { - mLegacyTransition.getSyncCallback().onTransactionReady(mId, t); - } catch (RemoteException e) { - Slog.e(TAG, "Error sending callback to legacy transition: " + mId, e); - } - } else { - ProtoLog.v(WM_SHELL, - "SyncTransactionQueue.onTransactionReady(): syncId=%d apply", id); - t.apply(); - t.close(); - } + ProtoLog.v(WM_SHELL, + "SyncTransactionQueue.onTransactionReady(): syncId=%d apply", id); + t.apply(); + t.close(); if (!mQueue.isEmpty()) { mQueue.get(0).send(); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/LegacyTransitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/LegacyTransitions.java deleted file mode 100644 index 978b8da2eb6d..000000000000 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/LegacyTransitions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.wm.shell.transition; - -import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TRANSITIONS; - -import android.annotation.NonNull; -import android.os.RemoteException; -import android.view.IRemoteAnimationFinishedCallback; -import android.view.IRemoteAnimationRunner; -import android.view.RemoteAnimationAdapter; -import android.view.RemoteAnimationTarget; -import android.view.SurfaceControl; -import android.view.WindowManager; -import android.window.IWindowContainerTransactionCallback; - -import com.android.internal.protolog.ProtoLog; - -/** - * Utilities and interfaces for transition-like usage on top of the legacy app-transition and - * synctransaction tools. - */ -public class LegacyTransitions { - - /** - * Interface for a "legacy" transition. Effectively wraps a sync callback + remoteAnimation - * into one callback. - */ - public interface ILegacyTransition { - /** - * Called when both the associated sync transaction finishes and the remote animation is - * ready. - */ - void onAnimationStart(int transit, RemoteAnimationTarget[] apps, - RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, - IRemoteAnimationFinishedCallback finishedCallback, SurfaceControl.Transaction t); - } - - /** - * Makes sure that a remote animation and corresponding sync callback are called together - * such that the sync callback is called first. This assumes that both the callback receiver - * and the remoteanimation are in the same process so that order is preserved on both ends. - */ - public static class LegacyTransition { - private final ILegacyTransition mLegacyTransition; - private int mSyncId = -1; - private SurfaceControl.Transaction mTransaction; - private int mTransit; - private RemoteAnimationTarget[] mApps; - private RemoteAnimationTarget[] mWallpapers; - private RemoteAnimationTarget[] mNonApps; - private IRemoteAnimationFinishedCallback mFinishCallback = null; - private boolean mCancelled = false; - private final SyncCallback mSyncCallback = new SyncCallback(); - private final RemoteAnimationAdapter mAdapter = - new RemoteAnimationAdapter(new RemoteAnimationWrapper(), 0, 0); - - public LegacyTransition(@WindowManager.TransitionType int type, - @NonNull ILegacyTransition legacyTransition) { - mLegacyTransition = legacyTransition; - mTransit = type; - } - - public @WindowManager.TransitionType int getType() { - return mTransit; - } - - public IWindowContainerTransactionCallback getSyncCallback() { - return mSyncCallback; - } - - public RemoteAnimationAdapter getAdapter() { - return mAdapter; - } - - private class SyncCallback extends IWindowContainerTransactionCallback.Stub { - @Override - public void onTransactionReady(int id, SurfaceControl.Transaction t) - throws RemoteException { - ProtoLog.v(WM_SHELL_TRANSITIONS, - "LegacyTransitions.onTransactionReady(): syncId=%d", id); - mSyncId = id; - mTransaction = t; - checkApply(true /* log */); - } - } - - private class RemoteAnimationWrapper extends IRemoteAnimationRunner.Stub { - @Override - public void onAnimationStart(int transit, RemoteAnimationTarget[] apps, - RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, - IRemoteAnimationFinishedCallback finishedCallback) throws RemoteException { - mTransit = transit; - mApps = apps; - mWallpapers = wallpapers; - mNonApps = nonApps; - mFinishCallback = finishedCallback; - checkApply(false /* log */); - } - - @Override - public void onAnimationCancelled() throws RemoteException { - mCancelled = true; - mApps = mWallpapers = mNonApps = null; - checkApply(false /* log */); - } - } - - - private void checkApply(boolean log) throws RemoteException { - if (mSyncId < 0 || (mFinishCallback == null && !mCancelled)) { - if (log) { - ProtoLog.v(WM_SHELL_TRANSITIONS, "\tSkipping hasFinishedCb=%b canceled=%b", - mFinishCallback != null, mCancelled); - } - return; - } - if (log) { - ProtoLog.v(WM_SHELL_TRANSITIONS, "\tapply"); - } - mLegacyTransition.onAnimationStart(mTransit, mApps, mWallpapers, - mNonApps, mFinishCallback, mTransaction); - } - } -} |