Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License |
| 15 | */ |
| 16 | |
| 17 | package com.android.server.wm; |
| 18 | |
Jorim Jaggi | ab20e16 | 2018-03-27 13:06:09 +0200 | [diff] [blame] | 19 | import static com.android.server.wm.AnimationAdapterProto.REMOTE; |
| 20 | import static com.android.server.wm.RemoteAnimationAdapterWrapperProto.TARGET; |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 21 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 22 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; |
| 23 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; |
| 24 | |
| 25 | import android.graphics.Point; |
| 26 | import android.graphics.Rect; |
Jorim Jaggi | ab20e16 | 2018-03-27 13:06:09 +0200 | [diff] [blame] | 27 | import android.os.Binder; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 28 | import android.os.Handler; |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 29 | import android.os.IBinder.DeathRecipient; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 30 | import android.os.RemoteException; |
| 31 | import android.os.SystemClock; |
| 32 | import android.util.Slog; |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 33 | import android.util.proto.ProtoOutputStream; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 34 | import android.view.IRemoteAnimationFinishedCallback; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 35 | import android.view.RemoteAnimationAdapter; |
| 36 | import android.view.RemoteAnimationTarget; |
| 37 | import android.view.SurfaceControl; |
| 38 | import android.view.SurfaceControl.Transaction; |
| 39 | |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 40 | import com.android.internal.util.FastPrintWriter; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 41 | import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback; |
Jorim Jaggi | 817ebdd | 2018-03-26 15:46:01 +0200 | [diff] [blame] | 42 | import com.android.server.wm.utils.InsetUtils; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 43 | |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 44 | import java.io.PrintWriter; |
| 45 | import java.io.StringWriter; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 46 | import java.util.ArrayList; |
| 47 | |
| 48 | /** |
| 49 | * Helper class to run app animations in a remote process. |
| 50 | */ |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 51 | class RemoteAnimationController implements DeathRecipient { |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 52 | private static final String TAG = TAG_WITH_CLASS_NAME ? "RemoteAnimationController" : TAG_WM; |
| 53 | private static final long TIMEOUT_MS = 2000; |
| 54 | |
| 55 | private final WindowManagerService mService; |
| 56 | private final RemoteAnimationAdapter mRemoteAnimationAdapter; |
| 57 | private final ArrayList<RemoteAnimationAdapterWrapper> mPendingAnimations = new ArrayList<>(); |
| 58 | private final Rect mTmpRect = new Rect(); |
| 59 | private final Handler mHandler; |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 60 | private final Runnable mTimeoutRunnable = this::cancelAnimation; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 61 | |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 62 | private FinishedCallback mFinishedCallback; |
| 63 | private boolean mCanceled; |
Adrian Roos | 653c6c1 | 2018-04-09 14:12:46 -0700 | [diff] [blame^] | 64 | private boolean mLinkedToDeathOfRunner; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 65 | |
| 66 | RemoteAnimationController(WindowManagerService service, |
| 67 | RemoteAnimationAdapter remoteAnimationAdapter, Handler handler) { |
| 68 | mService = service; |
| 69 | mRemoteAnimationAdapter = remoteAnimationAdapter; |
| 70 | mHandler = handler; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Creates an animation for each individual {@link AppWindowToken}. |
| 75 | * |
| 76 | * @param appWindowToken The app to animate. |
| 77 | * @param position The position app bounds, in screen coordinates. |
| 78 | * @param stackBounds The stack bounds of the app. |
| 79 | * @return The adapter to be run on the app. |
| 80 | */ |
| 81 | AnimationAdapter createAnimationAdapter(AppWindowToken appWindowToken, Point position, |
| 82 | Rect stackBounds) { |
| 83 | final RemoteAnimationAdapterWrapper adapter = new RemoteAnimationAdapterWrapper( |
| 84 | appWindowToken, position, stackBounds); |
| 85 | mPendingAnimations.add(adapter); |
| 86 | return adapter; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Called when the transition is ready to be started, and all leashes have been set up. |
| 91 | */ |
| 92 | void goodToGo() { |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 93 | if (mPendingAnimations.isEmpty() || mCanceled) { |
Jorim Jaggi | 93f9fe3 | 2018-01-25 15:06:13 +0100 | [diff] [blame] | 94 | onAnimationFinished(); |
| 95 | return; |
| 96 | } |
Jorim Jaggi | a19d781 | 2018-02-01 15:03:59 +0100 | [diff] [blame] | 97 | |
| 98 | // Scale the timeout with the animator scale the controlling app is using. |
| 99 | mHandler.postDelayed(mTimeoutRunnable, |
| 100 | (long) (TIMEOUT_MS * mService.getCurrentAnimatorScale())); |
Jorim Jaggi | 91f9f348 | 2018-02-14 10:58:26 -0800 | [diff] [blame] | 101 | mFinishedCallback = new FinishedCallback(this); |
Chavi Weingarten | 16d0d07 | 2018-02-12 23:50:28 +0000 | [diff] [blame] | 102 | |
| 103 | final RemoteAnimationTarget[] animations = createAnimations(); |
Jorim Jaggi | c4d29f2 | 2018-03-22 16:30:56 +0100 | [diff] [blame] | 104 | if (animations.length == 0) { |
| 105 | onAnimationFinished(); |
| 106 | return; |
| 107 | } |
Chavi Weingarten | 16d0d07 | 2018-02-12 23:50:28 +0000 | [diff] [blame] | 108 | mService.mAnimator.addAfterPrepareSurfacesRunnable(() -> { |
| 109 | try { |
Adrian Roos | 653c6c1 | 2018-04-09 14:12:46 -0700 | [diff] [blame^] | 110 | linkToDeathOfRunner(); |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 111 | mRemoteAnimationAdapter.getRunner().onAnimationStart(animations, mFinishedCallback); |
Chavi Weingarten | 16d0d07 | 2018-02-12 23:50:28 +0000 | [diff] [blame] | 112 | } catch (RemoteException e) { |
| 113 | Slog.e(TAG, "Failed to start remote animation", e); |
| 114 | onAnimationFinished(); |
| 115 | } |
| 116 | }); |
Jorim Jaggi | bc2aabe | 2018-03-08 17:27:43 +0100 | [diff] [blame] | 117 | sendRunningRemoteAnimation(true); |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 118 | if (DEBUG_APP_TRANSITIONS) { |
| 119 | writeStartDebugStatement(); |
| 120 | } |
| 121 | } |
| 122 | |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 123 | private void cancelAnimation() { |
| 124 | synchronized (mService.getWindowManagerLock()) { |
| 125 | if (mCanceled) { |
| 126 | return; |
| 127 | } |
| 128 | mCanceled = true; |
| 129 | } |
| 130 | onAnimationFinished(); |
| 131 | invokeAnimationCancelled(); |
| 132 | } |
| 133 | |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 134 | private void writeStartDebugStatement() { |
| 135 | Slog.i(TAG, "Starting remote animation"); |
| 136 | final StringWriter sw = new StringWriter(); |
| 137 | final FastPrintWriter pw = new FastPrintWriter(sw); |
| 138 | for (int i = mPendingAnimations.size() - 1; i >= 0; i--) { |
| 139 | mPendingAnimations.get(i).dump(pw, ""); |
| 140 | } |
| 141 | pw.close(); |
| 142 | Slog.i(TAG, sw.toString()); |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | private RemoteAnimationTarget[] createAnimations() { |
Jorim Jaggi | 1777021 | 2018-01-22 20:01:21 +0100 | [diff] [blame] | 146 | final ArrayList<RemoteAnimationTarget> targets = new ArrayList<>(); |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 147 | for (int i = mPendingAnimations.size() - 1; i >= 0; i--) { |
Jorim Jaggi | b8a9cbe | 2018-03-27 18:02:18 +0200 | [diff] [blame] | 148 | final RemoteAnimationAdapterWrapper wrapper = mPendingAnimations.get(i); |
Jorim Jaggi | 1777021 | 2018-01-22 20:01:21 +0100 | [diff] [blame] | 149 | final RemoteAnimationTarget target = |
| 150 | mPendingAnimations.get(i).createRemoteAppAnimation(); |
| 151 | if (target != null) { |
| 152 | targets.add(target); |
Jorim Jaggi | c4d29f2 | 2018-03-22 16:30:56 +0100 | [diff] [blame] | 153 | } else { |
Jorim Jaggi | b8a9cbe | 2018-03-27 18:02:18 +0200 | [diff] [blame] | 154 | |
| 155 | // We can't really start an animation but we still need to make sure to finish the |
| 156 | // pending animation that was started by SurfaceAnimator |
| 157 | if (wrapper.mCapturedFinishCallback != null) { |
| 158 | wrapper.mCapturedFinishCallback.onAnimationFinished(wrapper); |
| 159 | } |
Jorim Jaggi | c4d29f2 | 2018-03-22 16:30:56 +0100 | [diff] [blame] | 160 | mPendingAnimations.remove(i); |
Jorim Jaggi | 1777021 | 2018-01-22 20:01:21 +0100 | [diff] [blame] | 161 | } |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 162 | } |
Jorim Jaggi | 1777021 | 2018-01-22 20:01:21 +0100 | [diff] [blame] | 163 | return targets.toArray(new RemoteAnimationTarget[targets.size()]); |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | private void onAnimationFinished() { |
| 167 | mHandler.removeCallbacks(mTimeoutRunnable); |
| 168 | synchronized (mService.mWindowMap) { |
Adrian Roos | 653c6c1 | 2018-04-09 14:12:46 -0700 | [diff] [blame^] | 169 | unlinkToDeathOfRunner(); |
Jorim Jaggi | 91f9f348 | 2018-02-14 10:58:26 -0800 | [diff] [blame] | 170 | releaseFinishedCallback(); |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 171 | mService.openSurfaceTransaction(); |
| 172 | try { |
| 173 | for (int i = mPendingAnimations.size() - 1; i >= 0; i--) { |
| 174 | final RemoteAnimationAdapterWrapper adapter = mPendingAnimations.get(i); |
| 175 | adapter.mCapturedFinishCallback.onAnimationFinished(adapter); |
| 176 | } |
| 177 | } finally { |
| 178 | mService.closeSurfaceTransaction("RemoteAnimationController#finished"); |
| 179 | } |
| 180 | } |
Jorim Jaggi | bc2aabe | 2018-03-08 17:27:43 +0100 | [diff] [blame] | 181 | sendRunningRemoteAnimation(false); |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 182 | if (DEBUG_APP_TRANSITIONS) Slog.i(TAG, "Finishing remote animation"); |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | private void invokeAnimationCancelled() { |
| 186 | try { |
| 187 | mRemoteAnimationAdapter.getRunner().onAnimationCancelled(); |
| 188 | } catch (RemoteException e) { |
| 189 | Slog.e(TAG, "Failed to notify cancel", e); |
| 190 | } |
| 191 | } |
| 192 | |
Jorim Jaggi | 91f9f348 | 2018-02-14 10:58:26 -0800 | [diff] [blame] | 193 | private void releaseFinishedCallback() { |
| 194 | if (mFinishedCallback != null) { |
| 195 | mFinishedCallback.release(); |
| 196 | mFinishedCallback = null; |
| 197 | } |
| 198 | } |
| 199 | |
Jorim Jaggi | bc2aabe | 2018-03-08 17:27:43 +0100 | [diff] [blame] | 200 | private void sendRunningRemoteAnimation(boolean running) { |
| 201 | final int pid = mRemoteAnimationAdapter.getCallingPid(); |
| 202 | if (pid == 0) { |
| 203 | throw new RuntimeException("Calling pid of remote animation was null"); |
| 204 | } |
| 205 | mService.sendSetRunningRemoteAnimation(pid, running); |
| 206 | } |
| 207 | |
Adrian Roos | 653c6c1 | 2018-04-09 14:12:46 -0700 | [diff] [blame^] | 208 | private void linkToDeathOfRunner() throws RemoteException { |
| 209 | if (!mLinkedToDeathOfRunner) { |
| 210 | mRemoteAnimationAdapter.getRunner().asBinder().linkToDeath(this, 0); |
| 211 | mLinkedToDeathOfRunner = true; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | private void unlinkToDeathOfRunner() { |
| 216 | if (mLinkedToDeathOfRunner) { |
| 217 | mRemoteAnimationAdapter.getRunner().asBinder().unlinkToDeath(this, 0); |
| 218 | mLinkedToDeathOfRunner = false; |
| 219 | } |
| 220 | } |
| 221 | |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 222 | @Override |
| 223 | public void binderDied() { |
| 224 | cancelAnimation(); |
| 225 | } |
| 226 | |
Jorim Jaggi | 91f9f348 | 2018-02-14 10:58:26 -0800 | [diff] [blame] | 227 | private static final class FinishedCallback extends IRemoteAnimationFinishedCallback.Stub { |
| 228 | |
| 229 | RemoteAnimationController mOuter; |
| 230 | |
| 231 | FinishedCallback(RemoteAnimationController outer) { |
| 232 | mOuter = outer; |
| 233 | } |
| 234 | |
| 235 | @Override |
| 236 | public void onAnimationFinished() throws RemoteException { |
Jorim Jaggi | ab20e16 | 2018-03-27 13:06:09 +0200 | [diff] [blame] | 237 | final long token = Binder.clearCallingIdentity(); |
| 238 | try { |
| 239 | if (mOuter != null) { |
| 240 | mOuter.onAnimationFinished(); |
Jorim Jaggi | 91f9f348 | 2018-02-14 10:58:26 -0800 | [diff] [blame] | 241 | |
Jorim Jaggi | ab20e16 | 2018-03-27 13:06:09 +0200 | [diff] [blame] | 242 | // In case the client holds on to the finish callback, make sure we don't leak |
| 243 | // RemoteAnimationController which in turn would leak the runner on the client. |
| 244 | mOuter = null; |
| 245 | } |
| 246 | } finally { |
| 247 | Binder.restoreCallingIdentity(token); |
Jorim Jaggi | 91f9f348 | 2018-02-14 10:58:26 -0800 | [diff] [blame] | 248 | } |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Marks this callback as not be used anymore by releasing the reference to the outer class |
| 253 | * to prevent memory leak. |
| 254 | */ |
| 255 | void release() { |
| 256 | mOuter = null; |
| 257 | } |
| 258 | }; |
| 259 | |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 260 | private class RemoteAnimationAdapterWrapper implements AnimationAdapter { |
| 261 | |
| 262 | private final AppWindowToken mAppWindowToken; |
| 263 | private SurfaceControl mCapturedLeash; |
| 264 | private OnAnimationFinishedCallback mCapturedFinishCallback; |
| 265 | private final Point mPosition = new Point(); |
| 266 | private final Rect mStackBounds = new Rect(); |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 267 | private RemoteAnimationTarget mTarget; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 268 | |
| 269 | RemoteAnimationAdapterWrapper(AppWindowToken appWindowToken, Point position, |
| 270 | Rect stackBounds) { |
| 271 | mAppWindowToken = appWindowToken; |
| 272 | mPosition.set(position.x, position.y); |
| 273 | mStackBounds.set(stackBounds); |
| 274 | } |
| 275 | |
| 276 | RemoteAnimationTarget createRemoteAppAnimation() { |
Jorim Jaggi | 1777021 | 2018-01-22 20:01:21 +0100 | [diff] [blame] | 277 | final Task task = mAppWindowToken.getTask(); |
| 278 | final WindowState mainWindow = mAppWindowToken.findMainWindow(); |
Jorim Jaggi | c4d29f2 | 2018-03-22 16:30:56 +0100 | [diff] [blame] | 279 | if (task == null || mainWindow == null || mCapturedFinishCallback == null |
| 280 | || mCapturedLeash == null) { |
Jorim Jaggi | 1777021 | 2018-01-22 20:01:21 +0100 | [diff] [blame] | 281 | return null; |
| 282 | } |
Jorim Jaggi | 817ebdd | 2018-03-26 15:46:01 +0200 | [diff] [blame] | 283 | final Rect insets = new Rect(mainWindow.mContentInsets); |
| 284 | InsetUtils.addInsets(insets, mAppWindowToken.getLetterboxInsets()); |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 285 | mTarget = new RemoteAnimationTarget(task.mTaskId, getMode(), |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 286 | mCapturedLeash, !mAppWindowToken.fillsParent(), |
Jorim Jaggi | 817ebdd | 2018-03-26 15:46:01 +0200 | [diff] [blame] | 287 | mainWindow.mWinAnimator.mLastClipRect, insets, |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 288 | mAppWindowToken.getPrefixOrderIndex(), mPosition, mStackBounds, |
Vadim Tryshev | 593e956 | 2018-03-08 17:15:45 -0800 | [diff] [blame] | 289 | task.getWindowConfiguration(), false /*isNotInRecents*/); |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 290 | return mTarget; |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | private int getMode() { |
| 294 | if (mService.mOpeningApps.contains(mAppWindowToken)) { |
| 295 | return RemoteAnimationTarget.MODE_OPENING; |
| 296 | } else { |
| 297 | return RemoteAnimationTarget.MODE_CLOSING; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | @Override |
| 302 | public boolean getDetachWallpaper() { |
| 303 | return false; |
| 304 | } |
| 305 | |
| 306 | @Override |
Jorim Jaggi | 82c1786 | 2018-02-21 17:50:18 +0100 | [diff] [blame] | 307 | public boolean getShowWallpaper() { |
| 308 | return false; |
| 309 | } |
| 310 | |
| 311 | @Override |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 312 | public int getBackgroundColor() { |
| 313 | return 0; |
| 314 | } |
| 315 | |
| 316 | @Override |
| 317 | public void startAnimation(SurfaceControl animationLeash, Transaction t, |
| 318 | OnAnimationFinishedCallback finishCallback) { |
| 319 | |
| 320 | // Restore z-layering, position and stack crop until client has a chance to modify it. |
| 321 | t.setLayer(animationLeash, mAppWindowToken.getPrefixOrderIndex()); |
| 322 | t.setPosition(animationLeash, mPosition.x, mPosition.y); |
| 323 | mTmpRect.set(mStackBounds); |
| 324 | mTmpRect.offsetTo(0, 0); |
| 325 | t.setWindowCrop(animationLeash, mTmpRect); |
| 326 | mCapturedLeash = animationLeash; |
| 327 | mCapturedFinishCallback = finishCallback; |
| 328 | } |
| 329 | |
| 330 | @Override |
| 331 | public void onAnimationCancelled(SurfaceControl animationLeash) { |
| 332 | mPendingAnimations.remove(this); |
| 333 | if (mPendingAnimations.isEmpty()) { |
| 334 | mHandler.removeCallbacks(mTimeoutRunnable); |
Jorim Jaggi | 91f9f348 | 2018-02-14 10:58:26 -0800 | [diff] [blame] | 335 | releaseFinishedCallback(); |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 336 | invokeAnimationCancelled(); |
Jorim Jaggi | bc2aabe | 2018-03-08 17:27:43 +0100 | [diff] [blame] | 337 | sendRunningRemoteAnimation(false); |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 338 | } |
| 339 | } |
| 340 | |
| 341 | @Override |
| 342 | public long getDurationHint() { |
| 343 | return mRemoteAnimationAdapter.getDuration(); |
| 344 | } |
| 345 | |
| 346 | @Override |
| 347 | public long getStatusBarTransitionsStartTime() { |
| 348 | return SystemClock.uptimeMillis() |
| 349 | + mRemoteAnimationAdapter.getStatusBarTransitionDelay(); |
| 350 | } |
Jorim Jaggi | f75d161 | 2018-02-27 15:05:21 +0100 | [diff] [blame] | 351 | |
| 352 | @Override |
| 353 | public void dump(PrintWriter pw, String prefix) { |
| 354 | pw.print(prefix); pw.print("token="); pw.println(mAppWindowToken); |
| 355 | if (mTarget != null) { |
| 356 | pw.print(prefix); pw.println("Target:"); |
| 357 | mTarget.dump(pw, prefix + " "); |
| 358 | } else { |
| 359 | pw.print(prefix); pw.println("Target: null"); |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | @Override |
| 364 | public void writeToProto(ProtoOutputStream proto) { |
| 365 | final long token = proto.start(REMOTE); |
| 366 | if (mTarget != null) { |
| 367 | mTarget.writeToProto(proto, TARGET); |
| 368 | } |
| 369 | proto.end(token); |
| 370 | } |
Jorim Jaggi | 33a701a | 2017-12-01 14:58:18 +0100 | [diff] [blame] | 371 | } |
| 372 | } |