Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [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 | |
Wale Ogunwale | 5950709 | 2018-10-29 09:00:30 -0700 | [diff] [blame] | 17 | package com.android.server.wm; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 18 | |
Wale Ogunwale | dfb7fb2 | 2017-06-23 14:52:40 -0700 | [diff] [blame] | 19 | import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; |
David Stevens | 9440dc8 | 2017-03-16 19:00:20 -0700 | [diff] [blame] | 20 | import static android.view.Display.DEFAULT_DISPLAY; |
Wale Ogunwale | 9e4f3e0 | 2018-05-17 09:35:39 -0700 | [diff] [blame] | 21 | import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; |
| 22 | import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; |
| 23 | import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; |
| 24 | import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; |
| 25 | import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; |
| 26 | import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; |
| 27 | import static android.view.WindowManager.TRANSIT_UNSET; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 28 | import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS; |
| 29 | import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE; |
| 30 | import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER; |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 31 | |
Issei Suzuki | d6eb5a2 | 2019-02-20 23:08:03 +0100 | [diff] [blame] | 32 | import static com.android.server.am.KeyguardControllerProto.AOD_SHOWING; |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 33 | import static com.android.server.am.KeyguardControllerProto.KEYGUARD_OCCLUDED_STATES; |
Yi Jin | 6c6e9ca | 2018-03-20 16:53:35 -0700 | [diff] [blame] | 34 | import static com.android.server.am.KeyguardControllerProto.KEYGUARD_SHOWING; |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 35 | import static com.android.server.am.KeyguardOccludedProto.DISPLAY_ID; |
| 36 | import static com.android.server.am.KeyguardOccludedProto.KEYGUARD_OCCLUDED; |
wilsonshih | e7903ea | 2018-09-26 16:17:59 +0800 | [diff] [blame] | 37 | import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS; |
| 38 | import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM; |
| 39 | import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 40 | |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 41 | import android.os.IBinder; |
| 42 | import android.os.RemoteException; |
Wale Ogunwale | dfb7fb2 | 2017-06-23 14:52:40 -0700 | [diff] [blame] | 43 | import android.os.Trace; |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 44 | import android.util.Slog; |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 45 | import android.util.SparseArray; |
Steven Timotius | 4346f0a | 2017-09-12 11:07:21 -0700 | [diff] [blame] | 46 | import android.util.proto.ProtoOutputStream; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 47 | |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 48 | import com.android.internal.policy.IKeyguardDismissCallback; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 49 | import com.android.server.policy.WindowManagerPolicy; |
Wale Ogunwale | 9e4f3e0 | 2018-05-17 09:35:39 -0700 | [diff] [blame] | 50 | import com.android.server.wm.ActivityTaskManagerInternal.SleepToken; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 51 | |
Jorim Jaggi | 8d78693 | 2016-10-26 19:08:36 -0700 | [diff] [blame] | 52 | import java.io.PrintWriter; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Controls Keyguard occluding, dismissing and transitions depending on what kind of activities are |
| 56 | * currently visible. |
| 57 | * <p> |
| 58 | * Note that everything in this class should only be accessed with the AM lock being held. |
| 59 | */ |
| 60 | class KeyguardController { |
| 61 | |
Wale Ogunwale | 9887561 | 2018-10-12 07:53:02 -0700 | [diff] [blame] | 62 | private static final String TAG = TAG_WITH_CLASS_NAME ? "KeyguardController" : TAG_ATM; |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 63 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 64 | private final ActivityStackSupervisor mStackSupervisor; |
| 65 | private WindowManagerService mWindowManager; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 66 | private boolean mKeyguardShowing; |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 67 | private boolean mAodShowing; |
Jorim Jaggi | 8d78693 | 2016-10-26 19:08:36 -0700 | [diff] [blame] | 68 | private boolean mKeyguardGoingAway; |
Jorim Jaggi | 0796187 | 2016-11-23 11:28:57 +0100 | [diff] [blame] | 69 | private boolean mDismissalRequested; |
wilsonshih | e7903ea | 2018-09-26 16:17:59 +0800 | [diff] [blame] | 70 | private int[] mSecondaryDisplayIdsShowing; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 71 | private int mBeforeUnoccludeTransit; |
| 72 | private int mVisibilityTransactionDepth; |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 73 | private final SparseArray<KeyguardDisplayState> mDisplayStates = new SparseArray<>(); |
| 74 | private final ActivityTaskManagerService mService; |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 75 | private RootActivityContainer mRootActivityContainer; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 76 | |
Wale Ogunwale | f673393 | 2018-06-27 05:14:34 -0700 | [diff] [blame] | 77 | KeyguardController(ActivityTaskManagerService service, |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 78 | ActivityStackSupervisor stackSupervisor) { |
| 79 | mService = service; |
| 80 | mStackSupervisor = stackSupervisor; |
| 81 | } |
| 82 | |
| 83 | void setWindowManager(WindowManagerService windowManager) { |
| 84 | mWindowManager = windowManager; |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 85 | mRootActivityContainer = mService.mRootActivityContainer; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | /** |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 89 | * @return true if either Keyguard or AOD are showing, not going away, and not being occluded |
Issei Suzuki | d6eb5a2 | 2019-02-20 23:08:03 +0100 | [diff] [blame] | 90 | * on the given display, false otherwise. |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 91 | */ |
| 92 | boolean isKeyguardOrAodShowing(int displayId) { |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 93 | return (mKeyguardShowing || mAodShowing) && !mKeyguardGoingAway |
wilsonshih | 498a4b8 | 2018-12-11 16:10:16 +0800 | [diff] [blame] | 94 | && !isDisplayOccluded(displayId); |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | /** |
Louis Chang | 3319d02 | 2019-03-12 11:53:14 +0800 | [diff] [blame] | 98 | * @return {@code true} for default display when AOD is showing. Otherwise, same as |
| 99 | * {@link #isKeyguardOrAodShowing(int)} |
Issei Suzuki | d6eb5a2 | 2019-02-20 23:08:03 +0100 | [diff] [blame] | 100 | * TODO(b/125198167): Replace isKeyguardOrAodShowing() by this logic. |
| 101 | */ |
| 102 | boolean isKeyguardUnoccludedOrAodShowing(int displayId) { |
Louis Chang | 3319d02 | 2019-03-12 11:53:14 +0800 | [diff] [blame] | 103 | if (displayId == DEFAULT_DISPLAY && mAodShowing) { |
| 104 | return true; |
| 105 | } |
| 106 | return isKeyguardOrAodShowing(displayId); |
Issei Suzuki | d6eb5a2 | 2019-02-20 23:08:03 +0100 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | /** |
David Stevens | 53a39ea | 2017-08-23 18:41:49 -0700 | [diff] [blame] | 110 | * @return true if Keyguard is showing, not going away, and not being occluded on the given |
| 111 | * display, false otherwise |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 112 | */ |
David Stevens | 53a39ea | 2017-08-23 18:41:49 -0700 | [diff] [blame] | 113 | boolean isKeyguardShowing(int displayId) { |
wilsonshih | 498a4b8 | 2018-12-11 16:10:16 +0800 | [diff] [blame] | 114 | return mKeyguardShowing && !mKeyguardGoingAway && !isDisplayOccluded(displayId); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | /** |
| 118 | * @return true if Keyguard is either showing or occluded, but not going away |
| 119 | */ |
| 120 | boolean isKeyguardLocked() { |
| 121 | return mKeyguardShowing && !mKeyguardGoingAway; |
| 122 | } |
| 123 | |
| 124 | /** |
Bryce Lee | 271617a | 2018-03-15 10:39:12 -0700 | [diff] [blame] | 125 | * @return {@code true} if the keyguard is going away, {@code false} otherwise. |
| 126 | */ |
| 127 | boolean isKeyguardGoingAway() { |
| 128 | // Also check keyguard showing in case value is stale. |
| 129 | return mKeyguardGoingAway && mKeyguardShowing; |
| 130 | } |
| 131 | |
| 132 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 133 | * Update the Keyguard showing state. |
| 134 | */ |
wilsonshih | 177261f | 2019-02-22 12:02:18 +0800 | [diff] [blame] | 135 | void setKeyguardShown(boolean keyguardShowing, boolean aodShowing) { |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 136 | boolean showingChanged = keyguardShowing != mKeyguardShowing || aodShowing != mAodShowing; |
Adrian Roos | 6ec76b7 | 2018-04-25 14:01:11 +0200 | [diff] [blame] | 137 | // If keyguard is going away, but SystemUI aborted the transition, need to reset state. |
| 138 | showingChanged |= mKeyguardGoingAway && keyguardShowing; |
wilsonshih | 177261f | 2019-02-22 12:02:18 +0800 | [diff] [blame] | 139 | if (!showingChanged) { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 140 | return; |
| 141 | } |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 142 | mKeyguardShowing = keyguardShowing; |
| 143 | mAodShowing = aodShowing; |
chaviw | 0e9fb13 | 2018-06-05 16:29:13 -0700 | [diff] [blame] | 144 | mWindowManager.setAodShowing(aodShowing); |
David Stevens | 53a39ea | 2017-08-23 18:41:49 -0700 | [diff] [blame] | 145 | if (showingChanged) { |
| 146 | dismissDockedStackIfNeeded(); |
Andrii Kulian | 0d595f3 | 2018-02-21 15:47:33 -0800 | [diff] [blame] | 147 | setKeyguardGoingAway(false); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 148 | // TODO(b/113840485): Check usage for non-default display |
Adrian Roos | b56b3c3 | 2018-05-17 17:32:26 +0200 | [diff] [blame] | 149 | mWindowManager.setKeyguardOrAodShowingOnDefaultDisplay( |
| 150 | isKeyguardOrAodShowing(DEFAULT_DISPLAY)); |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 151 | if (keyguardShowing) { |
David Stevens | 53a39ea | 2017-08-23 18:41:49 -0700 | [diff] [blame] | 152 | mDismissalRequested = false; |
| 153 | } |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 154 | } |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 155 | mRootActivityContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); |
David Stevens | 9440dc8 | 2017-03-16 19:00:20 -0700 | [diff] [blame] | 156 | updateKeyguardSleepToken(); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Called when Keyguard is going away. |
| 161 | * |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 162 | * @param flags See {@link WindowManagerPolicy#KEYGUARD_GOING_AWAY_FLAG_TO_SHADE} |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 163 | * etc. |
| 164 | */ |
| 165 | void keyguardGoingAway(int flags) { |
Wale Ogunwale | dfb7fb2 | 2017-06-23 14:52:40 -0700 | [diff] [blame] | 166 | if (!mKeyguardShowing) { |
| 167 | return; |
| 168 | } |
| 169 | Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "keyguardGoingAway"); |
| 170 | mWindowManager.deferSurfaceLayout(); |
| 171 | try { |
| 172 | setKeyguardGoingAway(true); |
Wale Ogunwale | 3a256e6 | 2018-12-06 14:41:18 -0800 | [diff] [blame] | 173 | mRootActivityContainer.getDefaultDisplay().mDisplayContent |
lumark | 588a3e8 | 2018-07-20 18:53:54 +0800 | [diff] [blame] | 174 | .prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, |
| 175 | false /* alwaysKeepCurrent */, convertTransitFlags(flags), |
| 176 | false /* forceOverride */); |
David Stevens | 9440dc8 | 2017-03-16 19:00:20 -0700 | [diff] [blame] | 177 | updateKeyguardSleepToken(); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 178 | |
Wale Ogunwale | dfb7fb2 | 2017-06-23 14:52:40 -0700 | [diff] [blame] | 179 | // Some stack visibility might change (e.g. docked stack) |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 180 | mRootActivityContainer.resumeFocusedStacksTopActivities(); |
| 181 | mRootActivityContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); |
| 182 | mRootActivityContainer.addStartingWindowsForVisibleActivities( |
| 183 | true /* taskSwitch */); |
Wale Ogunwale | dfb7fb2 | 2017-06-23 14:52:40 -0700 | [diff] [blame] | 184 | mWindowManager.executeAppTransition(); |
| 185 | } finally { |
| 186 | Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "keyguardGoingAway: surfaceLayout"); |
| 187 | mWindowManager.continueSurfaceLayout(); |
| 188 | Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); |
| 189 | |
| 190 | Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 191 | } |
| 192 | } |
| 193 | |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 194 | void dismissKeyguard(IBinder token, IKeyguardDismissCallback callback, CharSequence message) { |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 195 | final ActivityRecord activityRecord = ActivityRecord.forTokenLocked(token); |
| 196 | if (activityRecord == null || !activityRecord.visibleIgnoringKeyguard) { |
| 197 | failCallback(callback); |
| 198 | return; |
| 199 | } |
Jorim Jaggi | d721489 | 2017-07-18 14:05:19 +0200 | [diff] [blame] | 200 | Slog.i(TAG, "Activity requesting to dismiss Keyguard: " + activityRecord); |
chaviw | 59b9885 | 2017-06-13 12:05:44 -0700 | [diff] [blame] | 201 | |
| 202 | // If the client has requested to dismiss the keyguard and the Activity has the flag to |
| 203 | // turn the screen on, wakeup the screen if it's the top Activity. |
| 204 | if (activityRecord.getTurnScreenOnFlag() && activityRecord.isTopRunningActivity()) { |
| 205 | mStackSupervisor.wakeUp("dismissKeyguard"); |
| 206 | } |
| 207 | |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 208 | mWindowManager.dismissKeyguard(callback, message); |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 209 | } |
| 210 | |
Wale Ogunwale | bfa81ad | 2017-05-24 15:14:42 -0700 | [diff] [blame] | 211 | private void setKeyguardGoingAway(boolean keyguardGoingAway) { |
| 212 | mKeyguardGoingAway = keyguardGoingAway; |
| 213 | mWindowManager.setKeyguardGoingAway(keyguardGoingAway); |
| 214 | } |
| 215 | |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 216 | private void failCallback(IKeyguardDismissCallback callback) { |
| 217 | try { |
| 218 | callback.onDismissError(); |
| 219 | } catch (RemoteException e) { |
| 220 | Slog.w(TAG, "Failed to call callback", e); |
| 221 | } |
| 222 | } |
| 223 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 224 | private int convertTransitFlags(int keyguardGoingAwayFlags) { |
| 225 | int result = 0; |
| 226 | if ((keyguardGoingAwayFlags & KEYGUARD_GOING_AWAY_FLAG_TO_SHADE) != 0) { |
| 227 | result |= TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; |
| 228 | } |
| 229 | if ((keyguardGoingAwayFlags & KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS) != 0) { |
| 230 | result |= TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; |
| 231 | } |
| 232 | if ((keyguardGoingAwayFlags & KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER) != 0) { |
| 233 | result |= TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; |
| 234 | } |
| 235 | return result; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * Starts a batch of visibility updates. |
| 240 | */ |
| 241 | void beginActivityVisibilityUpdate() { |
| 242 | mVisibilityTransactionDepth++; |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Ends a batch of visibility updates. After all batches are done, this method makes sure to |
| 247 | * update lockscreen occluded/dismiss state if needed. |
| 248 | */ |
| 249 | void endActivityVisibilityUpdate() { |
| 250 | mVisibilityTransactionDepth--; |
| 251 | if (mVisibilityTransactionDepth == 0) { |
| 252 | visibilitiesUpdated(); |
| 253 | } |
| 254 | } |
| 255 | |
Jorim Jaggi | e69c931 | 2016-10-31 18:24:38 -0700 | [diff] [blame] | 256 | /** |
| 257 | * @return True if we may show an activity while Keyguard is showing because we are in the |
| 258 | * process of dismissing it anyways, false otherwise. |
| 259 | */ |
Jorim Jaggi | 0796187 | 2016-11-23 11:28:57 +0100 | [diff] [blame] | 260 | boolean canShowActivityWhileKeyguardShowing(ActivityRecord r, boolean dismissKeyguard) { |
| 261 | |
| 262 | // Allow to show it when we are about to dismiss Keyguard. This isn't allowed if r is |
| 263 | // already the dismissing activity, in which case we don't allow it to repeatedly dismiss |
| 264 | // Keyguard. |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 265 | return dismissKeyguard && canDismissKeyguard() && !mAodShowing |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 266 | && (mDismissalRequested |
| 267 | || getDisplay(r.getDisplayId()).mDismissingKeyguardActivity != r); |
Jorim Jaggi | 0796187 | 2016-11-23 11:28:57 +0100 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | /** |
| 271 | * @return True if we may show an activity while Keyguard is occluded, false otherwise. |
| 272 | */ |
| 273 | boolean canShowWhileOccluded(boolean dismissKeyguard, boolean showWhenLocked) { |
Brad Stenning | 2bdc21e | 2019-03-11 14:33:22 -0700 | [diff] [blame] | 274 | return showWhenLocked || dismissKeyguard |
| 275 | && !mWindowManager.isKeyguardSecure(mService.getCurrentUserId()); |
Jorim Jaggi | e69c931 | 2016-10-31 18:24:38 -0700 | [diff] [blame] | 276 | } |
| 277 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 278 | private void visibilitiesUpdated() { |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 279 | boolean requestDismissKeyguard = false; |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 280 | for (int displayNdx = mRootActivityContainer.getChildCount() - 1; |
| 281 | displayNdx >= 0; displayNdx--) { |
| 282 | final ActivityDisplay display = mRootActivityContainer.getChildAt(displayNdx); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 283 | final KeyguardDisplayState state = getDisplay(display.mDisplayId); |
| 284 | state.visibilitiesUpdated(this, display); |
| 285 | requestDismissKeyguard |= state.mRequestDismissKeyguard; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 286 | } |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 287 | |
| 288 | // Dismissing Keyguard happens globally using the information from all displays. |
| 289 | if (requestDismissKeyguard) { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 290 | handleDismissKeyguard(); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * Called when occluded state changed. |
| 296 | */ |
Issei Suzuki | 62356a2 | 2019-04-11 16:46:37 +0200 | [diff] [blame] | 297 | private void handleOccludedChanged(int displayId) { |
| 298 | // TODO(b/113840485): Handle app transition for individual display, and apply occluded |
| 299 | // state change to secondary displays. |
| 300 | // For now, only default display fully supports occluded change. Other displays only |
| 301 | // updates keygaurd sleep token on that display. |
| 302 | if (displayId != DEFAULT_DISPLAY) { |
| 303 | updateKeyguardSleepToken(displayId); |
| 304 | return; |
| 305 | } |
| 306 | |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 307 | mWindowManager.onKeyguardOccludedChanged(isDisplayOccluded(DEFAULT_DISPLAY)); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 308 | if (isKeyguardLocked()) { |
| 309 | mWindowManager.deferSurfaceLayout(); |
| 310 | try { |
Wale Ogunwale | 3a256e6 | 2018-12-06 14:41:18 -0800 | [diff] [blame] | 311 | mRootActivityContainer.getDefaultDisplay().mDisplayContent |
lumark | 588a3e8 | 2018-07-20 18:53:54 +0800 | [diff] [blame] | 312 | .prepareAppTransition(resolveOccludeTransit(), |
| 313 | false /* alwaysKeepCurrent */, 0 /* flags */, |
| 314 | true /* forceOverride */); |
Issei Suzuki | 62356a2 | 2019-04-11 16:46:37 +0200 | [diff] [blame] | 315 | updateKeyguardSleepToken(DEFAULT_DISPLAY); |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 316 | mRootActivityContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 317 | mWindowManager.executeAppTransition(); |
| 318 | } finally { |
| 319 | mWindowManager.continueSurfaceLayout(); |
| 320 | } |
| 321 | } |
| 322 | dismissDockedStackIfNeeded(); |
| 323 | } |
| 324 | |
| 325 | /** |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 326 | * Called when somebody wants to dismiss the Keyguard via the flag. |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 327 | */ |
| 328 | private void handleDismissKeyguard() { |
Jorim Jaggi | 0796187 | 2016-11-23 11:28:57 +0100 | [diff] [blame] | 329 | // We only allow dismissing Keyguard via the flag when Keyguard is secure for legacy |
| 330 | // reasons, because that's how apps used to dismiss Keyguard in the secure case. In the |
| 331 | // insecure case, we actually show it on top of the lockscreen. See #canShowWhileOccluded. |
Brad Stenning | 2bdc21e | 2019-03-11 14:33:22 -0700 | [diff] [blame] | 332 | if (!mWindowManager.isKeyguardSecure(mService.getCurrentUserId())) { |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 333 | return; |
| 334 | } |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 335 | |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 336 | mWindowManager.dismissKeyguard(null /* callback */, null /* message */); |
| 337 | mDismissalRequested = true; |
| 338 | |
| 339 | // If we are about to unocclude the Keyguard, but we can dismiss it without security, |
| 340 | // we immediately dismiss the Keyguard so the activity gets shown without a flicker. |
Wale Ogunwale | 3a256e6 | 2018-12-06 14:41:18 -0800 | [diff] [blame] | 341 | final DisplayContent dc = |
| 342 | mRootActivityContainer.getDefaultDisplay().mDisplayContent; |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 343 | if (mKeyguardShowing && canDismissKeyguard() |
Wale Ogunwale | 3a256e6 | 2018-12-06 14:41:18 -0800 | [diff] [blame] | 344 | && dc.mAppTransition.getAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE) { |
| 345 | dc.prepareAppTransition(mBeforeUnoccludeTransit, false /* alwaysKeepCurrent */, |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 346 | 0 /* flags */, true /* forceOverride */); |
| 347 | mRootActivityContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); |
| 348 | mWindowManager.executeAppTransition(); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 349 | } |
| 350 | } |
| 351 | |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 352 | private boolean isDisplayOccluded(int displayId) { |
| 353 | return getDisplay(displayId).mOccluded; |
| 354 | } |
| 355 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 356 | /** |
| 357 | * @return true if Keyguard can be currently dismissed without entering credentials. |
| 358 | */ |
Andrii Kulian | fc8f82b | 2017-01-26 13:17:27 -0800 | [diff] [blame] | 359 | boolean canDismissKeyguard() { |
Brad Stenning | 2bdc21e | 2019-03-11 14:33:22 -0700 | [diff] [blame] | 360 | return mWindowManager.isKeyguardTrusted() |
| 361 | || !mWindowManager.isKeyguardSecure(mService.getCurrentUserId()); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | private int resolveOccludeTransit() { |
Wale Ogunwale | 3a256e6 | 2018-12-06 14:41:18 -0800 | [diff] [blame] | 365 | final DisplayContent dc = |
| 366 | mService.mRootActivityContainer.getDefaultDisplay().mDisplayContent; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 367 | if (mBeforeUnoccludeTransit != TRANSIT_UNSET |
Wale Ogunwale | 3a256e6 | 2018-12-06 14:41:18 -0800 | [diff] [blame] | 368 | && dc.mAppTransition.getAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 369 | // TODO(b/113840485): Handle app transition for individual display. |
| 370 | && isDisplayOccluded(DEFAULT_DISPLAY)) { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 371 | |
| 372 | // Reuse old transit in case we are occluding Keyguard again, meaning that we never |
| 373 | // actually occclude/unocclude Keyguard, but just run a normal transition. |
| 374 | return mBeforeUnoccludeTransit; |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 375 | // TODO(b/113840485): Handle app transition for individual display. |
| 376 | } else if (!isDisplayOccluded(DEFAULT_DISPLAY)) { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 377 | |
| 378 | // Save transit in case we dismiss/occlude Keyguard shortly after. |
Wale Ogunwale | 3a256e6 | 2018-12-06 14:41:18 -0800 | [diff] [blame] | 379 | mBeforeUnoccludeTransit = dc.mAppTransition.getAppTransition(); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 380 | return TRANSIT_KEYGUARD_UNOCCLUDE; |
| 381 | } else { |
| 382 | return TRANSIT_KEYGUARD_OCCLUDE; |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | private void dismissDockedStackIfNeeded() { |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 387 | // TODO(b/113840485): Handle docked stack for individual display. |
| 388 | if (mKeyguardShowing && isDisplayOccluded(DEFAULT_DISPLAY)) { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 389 | // The lock screen is currently showing, but is occluded by a window that can |
| 390 | // show on top of the lock screen. In this can we want to dismiss the docked |
| 391 | // stack since it will be complicated/risky to try to put the activity on top |
| 392 | // of the lock screen in the right fullscreen configuration. |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 393 | final ActivityStack stack = |
| 394 | mRootActivityContainer.getDefaultDisplay().getSplitScreenPrimaryStack(); |
Wale Ogunwale | 9dcf946 | 2017-09-19 15:13:01 -0700 | [diff] [blame] | 395 | if (stack == null) { |
| 396 | return; |
| 397 | } |
| 398 | mStackSupervisor.moveTasksToFullscreenStackLocked(stack, |
Andrii Kulian | 52d255c | 2018-07-13 11:32:19 -0700 | [diff] [blame] | 399 | stack.isFocusedStackOnDisplay()); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 400 | } |
| 401 | } |
Jorim Jaggi | 8d78693 | 2016-10-26 19:08:36 -0700 | [diff] [blame] | 402 | |
David Stevens | 9440dc8 | 2017-03-16 19:00:20 -0700 | [diff] [blame] | 403 | private void updateKeyguardSleepToken() { |
Wale Ogunwale | d32da47 | 2018-11-16 07:19:28 -0800 | [diff] [blame] | 404 | for (int displayNdx = mRootActivityContainer.getChildCount() - 1; |
| 405 | displayNdx >= 0; displayNdx--) { |
| 406 | final ActivityDisplay display = mRootActivityContainer.getChildAt(displayNdx); |
Issei Suzuki | 62356a2 | 2019-04-11 16:46:37 +0200 | [diff] [blame] | 407 | updateKeyguardSleepToken(display.mDisplayId); |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | private void updateKeyguardSleepToken(int displayId) { |
| 412 | final KeyguardDisplayState state = getDisplay(displayId); |
| 413 | if (isKeyguardUnoccludedOrAodShowing(displayId) && state.mSleepToken == null) { |
| 414 | state.acquiredSleepToken(); |
| 415 | } else if (!isKeyguardUnoccludedOrAodShowing(displayId) && state.mSleepToken != null) { |
| 416 | state.releaseSleepToken(); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 417 | } |
| 418 | } |
| 419 | |
| 420 | private KeyguardDisplayState getDisplay(int displayId) { |
wilsonshih | e7903ea | 2018-09-26 16:17:59 +0800 | [diff] [blame] | 421 | KeyguardDisplayState state = mDisplayStates.get(displayId); |
| 422 | if (state == null) { |
| 423 | state = new KeyguardDisplayState(mService, displayId); |
| 424 | mDisplayStates.append(displayId, state); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 425 | } |
wilsonshih | e7903ea | 2018-09-26 16:17:59 +0800 | [diff] [blame] | 426 | return state; |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 427 | } |
| 428 | |
| 429 | void onDisplayRemoved(int displayId) { |
wilsonshih | e7903ea | 2018-09-26 16:17:59 +0800 | [diff] [blame] | 430 | final KeyguardDisplayState state = mDisplayStates.get(displayId); |
| 431 | if (state != null) { |
| 432 | state.onRemoved(); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 433 | mDisplayStates.remove(displayId); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | /** Represents Keyguard state per individual display. */ |
| 438 | private static class KeyguardDisplayState { |
| 439 | private final int mDisplayId; |
| 440 | private boolean mOccluded; |
| 441 | private ActivityRecord mDismissingKeyguardActivity; |
| 442 | private boolean mRequestDismissKeyguard; |
| 443 | private final ActivityTaskManagerService mService; |
| 444 | private SleepToken mSleepToken; |
| 445 | |
| 446 | KeyguardDisplayState(ActivityTaskManagerService service, int displayId) { |
| 447 | mService = service; |
| 448 | mDisplayId = displayId; |
| 449 | } |
| 450 | |
| 451 | void onRemoved() { |
| 452 | mDismissingKeyguardActivity = null; |
| 453 | releaseSleepToken(); |
| 454 | } |
| 455 | |
| 456 | void acquiredSleepToken() { |
| 457 | if (mSleepToken == null) { |
| 458 | mSleepToken = mService.acquireSleepToken("keyguard", mDisplayId); |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | void releaseSleepToken() { |
| 463 | if (mSleepToken != null) { |
| 464 | mSleepToken.release(); |
| 465 | mSleepToken = null; |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | void visibilitiesUpdated(KeyguardController controller, ActivityDisplay display) { |
| 470 | final boolean lastOccluded = mOccluded; |
| 471 | final ActivityRecord lastDismissActivity = mDismissingKeyguardActivity; |
| 472 | mRequestDismissKeyguard = false; |
| 473 | mOccluded = false; |
| 474 | mDismissingKeyguardActivity = null; |
| 475 | |
wilsonshih | 9a10e9d | 2019-01-11 14:39:27 +0800 | [diff] [blame] | 476 | final ActivityStack stack = getStackForControllingOccluding(display); |
| 477 | if (stack != null) { |
| 478 | final ActivityRecord topDismissing = stack.getTopDismissingKeyguardActivity(); |
| 479 | mOccluded = stack.topActivityOccludesKeyguard() || (topDismissing != null |
| 480 | && stack.topRunningActivityLocked() == topDismissing |
| 481 | && controller.canShowWhileOccluded( |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 482 | true /* dismissKeyguard */, |
| 483 | false /* showWhenLocked */)); |
wilsonshih | 9a10e9d | 2019-01-11 14:39:27 +0800 | [diff] [blame] | 484 | if (stack.getTopDismissingKeyguardActivity() != null) { |
| 485 | mDismissingKeyguardActivity = stack.getTopDismissingKeyguardActivity(); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 486 | } |
wilsonshih | 498a4b8 | 2018-12-11 16:10:16 +0800 | [diff] [blame] | 487 | // FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD only apply for secondary display. |
| 488 | if (mDisplayId != DEFAULT_DISPLAY) { |
| 489 | mOccluded |= stack.canShowWithInsecureKeyguard() |
| 490 | && controller.canDismissKeyguard(); |
| 491 | } |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 492 | } |
wilsonshih | 498a4b8 | 2018-12-11 16:10:16 +0800 | [diff] [blame] | 493 | // TODO(b/123372519): isShowingDream can only works on default display. |
| 494 | if (mDisplayId == DEFAULT_DISPLAY) { |
| 495 | mOccluded |= controller.mWindowManager.isShowingDream(); |
| 496 | } |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 497 | |
Issei Suzuki | 62356a2 | 2019-04-11 16:46:37 +0200 | [diff] [blame] | 498 | if (lastOccluded != mOccluded) { |
| 499 | controller.handleOccludedChanged(mDisplayId); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 500 | } |
| 501 | if (lastDismissActivity != mDismissingKeyguardActivity && !mOccluded |
| 502 | && mDismissingKeyguardActivity != null |
Brad Stenning | 2bdc21e | 2019-03-11 14:33:22 -0700 | [diff] [blame] | 503 | && controller.mWindowManager.isKeyguardSecure( |
| 504 | controller.mService.getCurrentUserId())) { |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 505 | mRequestDismissKeyguard = true; |
| 506 | } |
| 507 | } |
| 508 | |
wilsonshih | 9a10e9d | 2019-01-11 14:39:27 +0800 | [diff] [blame] | 509 | /** |
| 510 | * Gets the stack used to check the occluded state. |
| 511 | * <p> |
| 512 | * Only the top non-pinned activity of the focusable stack on each display can control its |
| 513 | * occlusion state. |
| 514 | */ |
| 515 | private ActivityStack getStackForControllingOccluding(ActivityDisplay display) { |
| 516 | for (int stackNdx = display.getChildCount() - 1; stackNdx >= 0; --stackNdx) { |
| 517 | final ActivityStack stack = display.getChildAt(stackNdx); |
| 518 | if (stack != null && stack.isFocusableAndVisible() |
| 519 | && !stack.inPinnedWindowingMode()) { |
| 520 | return stack; |
| 521 | } |
| 522 | } |
| 523 | return null; |
| 524 | } |
| 525 | |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 526 | void dumpStatus(PrintWriter pw, String prefix) { |
| 527 | final StringBuilder sb = new StringBuilder(); |
| 528 | sb.append(prefix); |
| 529 | sb.append(" Occluded=").append(mOccluded) |
| 530 | .append(" DismissingKeyguardActivity=") |
| 531 | .append(mDismissingKeyguardActivity) |
| 532 | .append(" at display=") |
| 533 | .append(mDisplayId); |
| 534 | pw.println(sb.toString()); |
| 535 | } |
| 536 | |
| 537 | void writeToProto(ProtoOutputStream proto, long fieldId) { |
| 538 | final long token = proto.start(fieldId); |
| 539 | proto.write(DISPLAY_ID, mDisplayId); |
| 540 | proto.write(KEYGUARD_OCCLUDED, mOccluded); |
| 541 | proto.end(token); |
David Stevens | 9440dc8 | 2017-03-16 19:00:20 -0700 | [diff] [blame] | 542 | } |
| 543 | } |
| 544 | |
Jorim Jaggi | 8d78693 | 2016-10-26 19:08:36 -0700 | [diff] [blame] | 545 | void dump(PrintWriter pw, String prefix) { |
| 546 | pw.println(prefix + "KeyguardController:"); |
| 547 | pw.println(prefix + " mKeyguardShowing=" + mKeyguardShowing); |
Lucas Dupin | 47a65c7 | 2018-02-15 14:16:18 -0800 | [diff] [blame] | 548 | pw.println(prefix + " mAodShowing=" + mAodShowing); |
Jorim Jaggi | 8d78693 | 2016-10-26 19:08:36 -0700 | [diff] [blame] | 549 | pw.println(prefix + " mKeyguardGoingAway=" + mKeyguardGoingAway); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 550 | dumpDisplayStates(pw, prefix); |
Jorim Jaggi | 0796187 | 2016-11-23 11:28:57 +0100 | [diff] [blame] | 551 | pw.println(prefix + " mDismissalRequested=" + mDismissalRequested); |
Jorim Jaggi | 8d78693 | 2016-10-26 19:08:36 -0700 | [diff] [blame] | 552 | pw.println(prefix + " mVisibilityTransactionDepth=" + mVisibilityTransactionDepth); |
| 553 | } |
Steven Timotius | 4346f0a | 2017-09-12 11:07:21 -0700 | [diff] [blame] | 554 | |
| 555 | void writeToProto(ProtoOutputStream proto, long fieldId) { |
| 556 | final long token = proto.start(fieldId); |
Issei Suzuki | d6eb5a2 | 2019-02-20 23:08:03 +0100 | [diff] [blame] | 557 | proto.write(AOD_SHOWING, mAodShowing); |
Steven Timotius | 4346f0a | 2017-09-12 11:07:21 -0700 | [diff] [blame] | 558 | proto.write(KEYGUARD_SHOWING, mKeyguardShowing); |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 559 | writeDisplayStatesToProto(proto, KEYGUARD_OCCLUDED_STATES); |
Steven Timotius | 4346f0a | 2017-09-12 11:07:21 -0700 | [diff] [blame] | 560 | proto.end(token); |
| 561 | } |
wilsonshih | 0299c8a | 2018-08-24 15:52:57 +0800 | [diff] [blame] | 562 | |
| 563 | private void dumpDisplayStates(PrintWriter pw, String prefix) { |
| 564 | for (int i = 0; i < mDisplayStates.size(); i++) { |
| 565 | mDisplayStates.valueAt(i).dumpStatus(pw, prefix); |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | private void writeDisplayStatesToProto(ProtoOutputStream proto, long fieldId) { |
| 570 | for (int i = 0; i < mDisplayStates.size(); i++) { |
| 571 | mDisplayStates.valueAt(i).writeToProto(proto, fieldId); |
| 572 | } |
| 573 | } |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 574 | } |