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