diff options
5 files changed, 5 insertions, 248 deletions
diff --git a/core/java/android/window/IWindowOrganizerController.aidl b/core/java/android/window/IWindowOrganizerController.aidl index 6f4dd4e3c5ed..0b84070c8d26 100644 --- a/core/java/android/window/IWindowOrganizerController.aidl +++ b/core/java/android/window/IWindowOrganizerController.aidl @@ -66,17 +66,6 @@ interface IWindowOrganizerController { void startTransition(IBinder transitionToken, in @nullable WindowContainerTransaction t); /** - * Starts a legacy transition. - * @param type The transition type. - * @param adapter The animation to use. - * @param syncCallback A sync callback for the contents of `t` - * @param t Operations that are part of the transition. - * @return sync-id or -1 if this no-op'd because a transition is already running. - */ - int startLegacyTransition(int type, in RemoteAnimationAdapter adapter, - in IWindowContainerTransactionCallback syncCallback, in WindowContainerTransaction t); - - /** * Finishes a transition. This must be called for all created transitions. * @param transitionToken Which transition to finish * @param t Changes to make before finishing but in the same SF Transaction. Can be null. diff --git a/core/java/android/window/WindowOrganizer.java b/core/java/android/window/WindowOrganizer.java index 5c5da49fe543..6e56b6318727 100644 --- a/core/java/android/window/WindowOrganizer.java +++ b/core/java/android/window/WindowOrganizer.java @@ -130,27 +130,6 @@ public class WindowOrganizer { } /** - * Start a legacy transition. - * @param type The type of the transition. This is ignored if a transitionToken is provided. - * @param adapter An existing transition to start. If null, a new transition is created. - * @param t The set of window operations that are part of this transition. - * @return true on success, false if a transition was already running. - * @hide - */ - @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) - @NonNull - public int startLegacyTransition(int type, @NonNull RemoteAnimationAdapter adapter, - @NonNull WindowContainerTransactionCallback syncCallback, - @NonNull WindowContainerTransaction t) { - try { - return getWindowOrganizerController().startLegacyTransition( - type, adapter, syncCallback.mInterface, t); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - - /** * Register an ITransitionPlayer to handle transition animations. * @hide */ 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); - } - } -} diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java index ea1f35a130b0..b40418de8fdf 100644 --- a/services/core/java/com/android/server/wm/WindowOrganizerController.java +++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java @@ -472,35 +472,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub transition.setAllReady(); } - // TODO(b/365884835): remove this method and callers. - @Override - public int startLegacyTransition(int type, @NonNull RemoteAnimationAdapter adapter, - @NonNull IWindowContainerTransactionCallback callback, - @NonNull WindowContainerTransaction t) { - enforceTaskPermission("startLegacyTransition()"); - final CallerInfo caller = new CallerInfo(); - final long ident = Binder.clearCallingIdentity(); - int syncId; - try { - synchronized (mGlobalLock) { - if (type < 0) { - throw new IllegalArgumentException("Can't create transition with no type"); - } - if (mTransitionController.getTransitionPlayer() != null) { - throw new IllegalArgumentException("Can't use legacy transitions in" - + " when shell transitions are enabled."); - } - syncId = startSyncWithOrganizer(callback); - applyTransaction(t, syncId, mService.mChainTracker.startLegacy("legacyTransit"), - caller); - setSyncReady(syncId); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - return syncId; - } - @Override public void finishTransition(@NonNull IBinder transitionToken, @Nullable WindowContainerTransaction t) { |