Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
Evan Rosky | 35630df | 2018-10-31 10:22:08 -0700 | [diff] [blame] | 19 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; |
| 20 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 21 | |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 22 | import android.app.RemoteAction; |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 23 | import android.content.ComponentName; |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 24 | import android.content.pm.ParceledListSlice; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 25 | import android.content.res.Resources; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 26 | import android.graphics.Rect; |
| 27 | import android.os.Handler; |
| 28 | import android.os.IBinder; |
| 29 | import android.os.RemoteException; |
| 30 | import android.util.DisplayMetrics; |
| 31 | import android.util.Log; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 32 | import android.util.Slog; |
Winson Chung | 14fefc2 | 2016-11-02 10:02:29 -0700 | [diff] [blame] | 33 | import android.view.DisplayInfo; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 34 | import android.view.IPinnedStackController; |
| 35 | import android.view.IPinnedStackListener; |
| 36 | |
Wale Ogunwale | b783fd8 | 2016-11-04 09:51:54 -0700 | [diff] [blame] | 37 | import com.android.server.UiThread; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 38 | |
| 39 | import java.io.PrintWriter; |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 40 | import java.util.ArrayList; |
| 41 | import java.util.List; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 42 | |
| 43 | /** |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 44 | * Holds the common state of the pinned stack between the system and SystemUI. If SystemUI ever |
| 45 | * needs to be restarted, it will be notified with the last known state. |
| 46 | * |
| 47 | * Changes to the pinned stack also flow through this controller, and generally, the system only |
| 48 | * changes the pinned stack bounds through this controller in two ways: |
| 49 | * |
| 50 | * 1) When first entering PiP: the controller returns the valid bounds given, taking aspect ratio |
| 51 | * and IME state into account. |
| 52 | * 2) When rotating the device: the controller calculates the new bounds in the new orientation, |
Hongwei Wang | 85cf41f | 2020-01-15 15:14:47 -0800 | [diff] [blame] | 53 | * taking the IME state into account. In this case, we currently ignore the |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 54 | * SystemUI adjustments (ie. expanded for menu, interaction, etc). |
| 55 | * |
| 56 | * Other changes in the system, including adjustment of IME, configuration change, and more are |
| 57 | * handled by SystemUI (similar to the docked stack divider). |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 58 | */ |
| 59 | class PinnedStackController { |
| 60 | |
| 61 | private static final String TAG = TAG_WITH_CLASS_NAME ? "PinnedStackController" : TAG_WM; |
| 62 | |
| 63 | private final WindowManagerService mService; |
| 64 | private final DisplayContent mDisplayContent; |
Wale Ogunwale | b783fd8 | 2016-11-04 09:51:54 -0700 | [diff] [blame] | 65 | private final Handler mHandler = UiThread.getHandler(); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 66 | |
| 67 | private IPinnedStackListener mPinnedStackListener; |
| 68 | private final PinnedStackListenerDeathHandler mPinnedStackListenerDeathHandler = |
| 69 | new PinnedStackListenerDeathHandler(); |
| 70 | |
| 71 | private final PinnedStackControllerCallback mCallbacks = new PinnedStackControllerCallback(); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 72 | |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 73 | private boolean mIsImeShowing; |
| 74 | private int mImeHeight; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 75 | |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 76 | // The set of actions and aspect-ratio for the that are currently allowed on the PiP activity |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 77 | private ArrayList<RemoteAction> mActions = new ArrayList<>(); |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 78 | private float mAspectRatio = -1f; |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 79 | |
Winson Chung | 14fefc2 | 2016-11-02 10:02:29 -0700 | [diff] [blame] | 80 | // Used to calculate stack bounds across rotations |
| 81 | private final DisplayInfo mDisplayInfo = new DisplayInfo(); |
| 82 | |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 83 | // The aspect ratio bounds of the PIP. |
| 84 | private float mMinAspectRatio; |
| 85 | private float mMaxAspectRatio; |
| 86 | |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 87 | // Temp vars for calculation |
| 88 | private final DisplayMetrics mTmpMetrics = new DisplayMetrics(); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * The callback object passed to listeners for them to notify the controller of state changes. |
| 92 | */ |
| 93 | private class PinnedStackControllerCallback extends IPinnedStackController.Stub { |
Winson Chung | ef4dc81 | 2017-04-11 13:31:44 -0700 | [diff] [blame] | 94 | @Override |
Hongwei Wang | 7759895 | 2019-09-17 16:42:37 +0000 | [diff] [blame] | 95 | public int getDisplayRotation() { |
Hongwei Wang | e3ff139 | 2019-08-06 14:24:43 -0700 | [diff] [blame] | 96 | synchronized (mService.mGlobalLock) { |
Hongwei Wang | 7759895 | 2019-09-17 16:42:37 +0000 | [diff] [blame] | 97 | return mDisplayInfo.rotation; |
Hongwei Wang | e3ff139 | 2019-08-06 14:24:43 -0700 | [diff] [blame] | 98 | } |
| 99 | } |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Handler for the case where the listener dies. |
| 104 | */ |
| 105 | private class PinnedStackListenerDeathHandler implements IBinder.DeathRecipient { |
| 106 | |
| 107 | @Override |
| 108 | public void binderDied() { |
| 109 | // Clean up the state if the listener dies |
Winson Chung | 397967f | 2017-11-01 16:21:35 -0700 | [diff] [blame] | 110 | if (mPinnedStackListener != null) { |
| 111 | mPinnedStackListener.asBinder().unlinkToDeath(mPinnedStackListenerDeathHandler, 0); |
| 112 | } |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 113 | mPinnedStackListener = null; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | PinnedStackController(WindowManagerService service, DisplayContent displayContent) { |
| 118 | mService = service; |
| 119 | mDisplayContent = displayContent; |
Winson Chung | 14fefc2 | 2016-11-02 10:02:29 -0700 | [diff] [blame] | 120 | mDisplayInfo.copyFrom(mDisplayContent.getDisplayInfo()); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 121 | reloadResources(); |
| 122 | } |
| 123 | |
| 124 | void onConfigurationChanged() { |
| 125 | reloadResources(); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Reloads all the resources for the current configuration. |
| 130 | */ |
Wale Ogunwale | 027f475 | 2017-05-12 10:37:16 -0700 | [diff] [blame] | 131 | private void reloadResources() { |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 132 | final Resources res = mService.mContext.getResources(); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 133 | mDisplayContent.getDisplay().getRealMetrics(mTmpMetrics); |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 134 | mMinAspectRatio = res.getFloat( |
| 135 | com.android.internal.R.dimen.config_pictureInPictureMinAspectRatio); |
| 136 | mMaxAspectRatio = res.getFloat( |
| 137 | com.android.internal.R.dimen.config_pictureInPictureMaxAspectRatio); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Registers a pinned stack listener. |
| 142 | */ |
| 143 | void registerPinnedStackListener(IPinnedStackListener listener) { |
| 144 | try { |
| 145 | listener.asBinder().linkToDeath(mPinnedStackListenerDeathHandler, 0); |
| 146 | listener.onListenerRegistered(mCallbacks); |
| 147 | mPinnedStackListener = listener; |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 148 | notifyDisplayInfoChanged(mDisplayInfo); |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 149 | notifyImeVisibilityChanged(mIsImeShowing, mImeHeight); |
Hongwei Wang | 85cf41f | 2020-01-15 15:14:47 -0800 | [diff] [blame] | 150 | notifyMovementBoundsChanged(false /* fromImeAdjustment */); |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 151 | notifyActionsChanged(mActions); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 152 | } catch (RemoteException e) { |
| 153 | Log.e(TAG, "Failed to register pinned stack listener", e); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | /** |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 158 | * @return whether the given {@param aspectRatio} is valid. |
| 159 | */ |
| 160 | public boolean isValidPictureInPictureAspectRatio(float aspectRatio) { |
Winson Chung | bd04196 | 2017-03-06 15:07:25 -0800 | [diff] [blame] | 161 | return Float.compare(mMinAspectRatio, aspectRatio) <= 0 && |
| 162 | Float.compare(aspectRatio, mMaxAspectRatio) <= 0; |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | /** |
Hongwei Wang | 221fe3d | 2020-03-26 13:13:04 -0700 | [diff] [blame] | 166 | * Activity is hidden (either stopped or removed), resets the last saved snap fraction |
| 167 | * so that the default bounds will be returned for the next session. |
Winson Chung | e55c019 | 2017-08-24 14:50:48 -0700 | [diff] [blame] | 168 | */ |
Hongwei Wang | 221fe3d | 2020-03-26 13:13:04 -0700 | [diff] [blame] | 169 | void onActivityHidden(ComponentName componentName) { |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 170 | if (mPinnedStackListener == null) return; |
| 171 | try { |
Hongwei Wang | 221fe3d | 2020-03-26 13:13:04 -0700 | [diff] [blame] | 172 | mPinnedStackListener.onActivityHidden(componentName); |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 173 | } catch (RemoteException e) { |
| 174 | Slog.e(TAG_WM, "Error delivering reset reentry fraction event.", e); |
Winson Chung | e55c019 | 2017-08-24 14:50:48 -0700 | [diff] [blame] | 175 | } |
| 176 | } |
| 177 | |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 178 | private void setDisplayInfo(DisplayInfo displayInfo) { |
| 179 | mDisplayInfo.copyFrom(displayInfo); |
| 180 | notifyDisplayInfoChanged(mDisplayInfo); |
| 181 | } |
| 182 | |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 183 | /** |
Winson Chung | 32c566f | 2017-04-11 18:31:21 -0700 | [diff] [blame] | 184 | * In the case where the display rotation is changed but there is no stack, we can't depend on |
| 185 | * onTaskStackBoundsChanged() to be called. But we still should update our known display info |
| 186 | * with the new state so that we can update SystemUI. |
| 187 | */ |
Hongwei Wang | e79f26a | 2019-11-05 14:38:33 -0800 | [diff] [blame] | 188 | void onDisplayInfoChanged(DisplayInfo displayInfo) { |
| 189 | synchronized (mService.mGlobalLock) { |
| 190 | setDisplayInfo(displayInfo); |
Hongwei Wang | 85cf41f | 2020-01-15 15:14:47 -0800 | [diff] [blame] | 191 | notifyMovementBoundsChanged(false /* fromImeAdjustment */); |
Hongwei Wang | e79f26a | 2019-11-05 14:38:33 -0800 | [diff] [blame] | 192 | } |
Winson Chung | 32c566f | 2017-04-11 18:31:21 -0700 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | /** |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 196 | * Sets the Ime state and height. |
| 197 | */ |
| 198 | void setAdjustedForIme(boolean adjustedForIme, int imeHeight) { |
Winson Chung | 2a35e6d | 2018-01-13 14:27:50 -0800 | [diff] [blame] | 199 | // Due to the order of callbacks from the system, we may receive an ime height even when |
| 200 | // {@param adjustedForIme} is false, and also a zero height when {@param adjustedForIme} |
| 201 | // is true. Instead, ensure that the ime state changes with the height and if the ime is |
| 202 | // showing, then the height is non-zero. |
| 203 | final boolean imeShowing = adjustedForIme && imeHeight > 0; |
| 204 | imeHeight = imeShowing ? imeHeight : 0; |
| 205 | if (imeShowing == mIsImeShowing && imeHeight == mImeHeight) { |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 206 | return; |
| 207 | } |
| 208 | |
Winson Chung | 2a35e6d | 2018-01-13 14:27:50 -0800 | [diff] [blame] | 209 | mIsImeShowing = imeShowing; |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 210 | mImeHeight = imeHeight; |
Winson Chung | 2a35e6d | 2018-01-13 14:27:50 -0800 | [diff] [blame] | 211 | notifyImeVisibilityChanged(imeShowing, imeHeight); |
Hongwei Wang | 85cf41f | 2020-01-15 15:14:47 -0800 | [diff] [blame] | 212 | notifyMovementBoundsChanged(true /* fromImeAdjustment */); |
Tracy Zhou | 4351308 | 2018-03-08 21:58:36 -0800 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | /** |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 216 | * Sets the current aspect ratio. |
| 217 | */ |
| 218 | void setAspectRatio(float aspectRatio) { |
| 219 | if (Float.compare(mAspectRatio, aspectRatio) != 0) { |
| 220 | mAspectRatio = aspectRatio; |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 221 | notifyAspectRatioChanged(aspectRatio); |
Hongwei Wang | 85cf41f | 2020-01-15 15:14:47 -0800 | [diff] [blame] | 222 | notifyMovementBoundsChanged(false /* fromImeAdjustment */); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 223 | } |
| 224 | } |
| 225 | |
| 226 | /** |
Winson Chung | c95ff84 | 2017-03-21 10:20:20 -0700 | [diff] [blame] | 227 | * @return the current aspect ratio. |
| 228 | */ |
| 229 | float getAspectRatio() { |
| 230 | return mAspectRatio; |
| 231 | } |
| 232 | |
| 233 | /** |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 234 | * Sets the current set of actions. |
| 235 | */ |
| 236 | void setActions(List<RemoteAction> actions) { |
| 237 | mActions.clear(); |
Winson Chung | c2baac0 | 2017-01-11 13:34:47 -0800 | [diff] [blame] | 238 | if (actions != null) { |
| 239 | mActions.addAll(actions); |
| 240 | } |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 241 | notifyActionsChanged(mActions); |
| 242 | } |
| 243 | |
| 244 | /** |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 245 | * Notifies listeners that the PIP needs to be adjusted for the IME. |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 246 | */ |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 247 | private void notifyImeVisibilityChanged(boolean imeVisible, int imeHeight) { |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 248 | if (mPinnedStackListener != null) { |
| 249 | try { |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 250 | mPinnedStackListener.onImeVisibilityChanged(imeVisible, imeHeight); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 251 | } catch (RemoteException e) { |
| 252 | Slog.e(TAG_WM, "Error delivering bounds changed event.", e); |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 257 | private void notifyAspectRatioChanged(float aspectRatio) { |
| 258 | if (mPinnedStackListener == null) return; |
| 259 | try { |
| 260 | mPinnedStackListener.onAspectRatioChanged(aspectRatio); |
| 261 | } catch (RemoteException e) { |
| 262 | Slog.e(TAG_WM, "Error delivering aspect ratio changed event.", e); |
| 263 | } |
| 264 | } |
| 265 | |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 266 | /** |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 267 | * Notifies listeners that the PIP actions have changed. |
| 268 | */ |
| 269 | private void notifyActionsChanged(List<RemoteAction> actions) { |
| 270 | if (mPinnedStackListener != null) { |
| 271 | try { |
| 272 | mPinnedStackListener.onActionsChanged(new ParceledListSlice(actions)); |
| 273 | } catch (RemoteException e) { |
| 274 | Slog.e(TAG_WM, "Error delivering actions changed event.", e); |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | /** |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 280 | * Notifies listeners that the PIP movement bounds have changed. |
| 281 | */ |
Hongwei Wang | 85cf41f | 2020-01-15 15:14:47 -0800 | [diff] [blame] | 282 | private void notifyMovementBoundsChanged(boolean fromImeAdjustment) { |
Wale Ogunwale | db485de | 2018-10-29 09:47:07 -0700 | [diff] [blame] | 283 | synchronized (mService.mGlobalLock) { |
Wale Ogunwale | b62139d | 2017-09-20 15:37:35 -0700 | [diff] [blame] | 284 | if (mPinnedStackListener == null) { |
| 285 | return; |
| 286 | } |
| 287 | try { |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 288 | final Rect animatingBounds = new Rect(); |
Wale Ogunwale | 734b896 | 2020-01-21 12:17:42 -0800 | [diff] [blame] | 289 | final ActivityStack pinnedStack = mDisplayContent.getRootPinnedTask(); |
Wale Ogunwale | b62139d | 2017-09-20 15:37:35 -0700 | [diff] [blame] | 290 | if (pinnedStack != null) { |
| 291 | pinnedStack.getAnimationOrCurrentBounds(animatingBounds); |
Wale Ogunwale | b62139d | 2017-09-20 15:37:35 -0700 | [diff] [blame] | 292 | } |
Hongwei Wang | 85cf41f | 2020-01-15 15:14:47 -0800 | [diff] [blame] | 293 | mPinnedStackListener.onMovementBoundsChanged(animatingBounds, fromImeAdjustment); |
Wale Ogunwale | b62139d | 2017-09-20 15:37:35 -0700 | [diff] [blame] | 294 | } catch (RemoteException e) { |
| 295 | Slog.e(TAG_WM, "Error delivering actions changed event.", e); |
Winson Chung | 2a82fe5 | 2017-02-02 14:43:34 -0800 | [diff] [blame] | 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /** |
Hongwei Wang | 43a752b | 2019-09-17 20:20:30 +0000 | [diff] [blame] | 301 | * Notifies listeners that the PIP animation is about to happen. |
| 302 | */ |
| 303 | private void notifyDisplayInfoChanged(DisplayInfo displayInfo) { |
| 304 | if (mPinnedStackListener == null) return; |
| 305 | try { |
| 306 | mPinnedStackListener.onDisplayInfoChanged(displayInfo); |
| 307 | } catch (RemoteException e) { |
| 308 | Slog.e(TAG_WM, "Error delivering DisplayInfo changed event.", e); |
| 309 | } |
| 310 | } |
| 311 | |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 312 | void dump(String prefix, PrintWriter pw) { |
| 313 | pw.println(prefix + "PinnedStackController"); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 314 | pw.println(prefix + " mIsImeShowing=" + mIsImeShowing); |
Tracy Zhou | 4351308 | 2018-03-08 21:58:36 -0800 | [diff] [blame] | 315 | pw.println(prefix + " mImeHeight=" + mImeHeight); |
Winson Chung | 95b7b62 | 2018-10-05 15:00:01 -0700 | [diff] [blame] | 316 | pw.println(prefix + " mAspectRatio=" + mAspectRatio); |
| 317 | pw.println(prefix + " mMinAspectRatio=" + mMinAspectRatio); |
| 318 | pw.println(prefix + " mMaxAspectRatio=" + mMaxAspectRatio); |
Winson Chung | a29eb98 | 2016-12-14 12:01:27 -0800 | [diff] [blame] | 319 | if (mActions.isEmpty()) { |
| 320 | pw.println(prefix + " mActions=[]"); |
| 321 | } else { |
| 322 | pw.println(prefix + " mActions=["); |
| 323 | for (int i = 0; i < mActions.size(); i++) { |
| 324 | RemoteAction action = mActions.get(i); |
| 325 | pw.print(prefix + " Action[" + i + "]: "); |
| 326 | action.dump("", pw); |
| 327 | } |
| 328 | pw.println(prefix + " ]"); |
| 329 | } |
Winson Chung | 95b7b62 | 2018-10-05 15:00:01 -0700 | [diff] [blame] | 330 | pw.println(prefix + " mDisplayInfo=" + mDisplayInfo); |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 331 | } |
Winson Chung | 655332c | 2016-10-31 13:14:28 -0700 | [diff] [blame] | 332 | } |