Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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.systemui.statusbar.phone; |
| 18 | |
| 19 | import android.graphics.Color; |
| 20 | import android.os.Trace; |
| 21 | |
Jerry Chang | 50c5da4 | 2019-10-16 17:21:07 +0800 | [diff] [blame] | 22 | import com.android.systemui.dock.DockManager; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 23 | import com.android.systemui.statusbar.ScrimView; |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 24 | import com.android.systemui.statusbar.notification.stack.StackStateAnimator; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Possible states of the ScrimController state machine. |
| 28 | */ |
| 29 | public enum ScrimState { |
| 30 | |
| 31 | /** |
| 32 | * Initial state. |
| 33 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 34 | UNINITIALIZED, |
| 35 | |
| 36 | /** |
| 37 | * When turned off by sensors (prox, presence.) |
| 38 | */ |
| 39 | OFF { |
| 40 | @Override |
| 41 | public void prepare(ScrimState previousState) { |
| 42 | mFrontTint = Color.BLACK; |
Lucas Dupin | 36ec73c | 2019-10-18 13:39:04 -0700 | [diff] [blame] | 43 | mBehindTint = Color.BLACK; |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 44 | mBubbleTint = previousState.mBubbleTint; |
| 45 | |
| 46 | mFrontAlpha = 1f; |
Lucas Dupin | 36ec73c | 2019-10-18 13:39:04 -0700 | [diff] [blame] | 47 | mBehindAlpha = 1f; |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 48 | mBubbleAlpha = previousState.mBubbleAlpha; |
| 49 | |
| 50 | mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG; |
| 51 | } |
Lucas Dupin | 36ec73c | 2019-10-18 13:39:04 -0700 | [diff] [blame] | 52 | |
| 53 | @Override |
| 54 | public boolean isLowPowerState() { |
| 55 | return true; |
| 56 | } |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 57 | }, |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * On the lock screen. |
| 61 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 62 | KEYGUARD { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 63 | @Override |
| 64 | public void prepare(ScrimState previousState) { |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 65 | mBlankScreen = false; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 66 | if (previousState == ScrimState.AOD) { |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 67 | mAnimationDuration = StackStateAnimator.ANIMATION_DURATION_WAKEUP; |
| 68 | if (mDisplayRequiresBlanking) { |
| 69 | // DisplayPowerManager will blank the screen, we'll just |
| 70 | // set our scrim to black in this frame to avoid flickering and |
| 71 | // fade it out afterwards. |
| 72 | mBlankScreen = true; |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 73 | } |
Lucas Dupin | 55c6e80 | 2018-09-27 18:07:36 -0700 | [diff] [blame] | 74 | } else if (previousState == ScrimState.KEYGUARD) { |
| 75 | mAnimationDuration = StackStateAnimator.ANIMATION_DURATION_WAKEUP; |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 76 | } else { |
| 77 | mAnimationDuration = ScrimController.ANIMATION_DURATION; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 78 | } |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 79 | mFrontTint = Color.BLACK; |
| 80 | mBehindTint = Color.BLACK; |
| 81 | mBubbleTint = Color.TRANSPARENT; |
| 82 | |
| 83 | mFrontAlpha = 0; |
| 84 | mBehindAlpha = mScrimBehindAlphaKeyguard; |
| 85 | mBubbleAlpha = 0; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 86 | } |
Lucas Dupin | 55c6e80 | 2018-09-27 18:07:36 -0700 | [diff] [blame] | 87 | }, |
| 88 | |
| 89 | /** |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 90 | * Showing password challenge on the keyguard. |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 91 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 92 | BOUNCER { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 93 | @Override |
| 94 | public void prepare(ScrimState previousState) { |
Lucas Dupin | 43d0124 | 2020-02-03 11:58:33 -0800 | [diff] [blame] | 95 | mBehindAlpha = ScrimController.BUSY_SCRIM_ALPHA; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 96 | mFrontAlpha = 0f; |
| 97 | mBubbleAlpha = 0f; |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 98 | } |
| 99 | }, |
| 100 | |
| 101 | /** |
| 102 | * Showing password challenge on top of a FLAG_SHOW_WHEN_LOCKED activity. |
| 103 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 104 | BOUNCER_SCRIMMED { |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 105 | @Override |
| 106 | public void prepare(ScrimState previousState) { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 107 | mBehindAlpha = 0; |
| 108 | mBubbleAlpha = 0f; |
Lucas Dupin | 43d0124 | 2020-02-03 11:58:33 -0800 | [diff] [blame] | 109 | mFrontAlpha = ScrimController.BUSY_SCRIM_ALPHA; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 110 | } |
| 111 | }, |
| 112 | |
| 113 | /** |
| 114 | * Changing screen brightness from quick settings. |
| 115 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 116 | BRIGHTNESS_MIRROR { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 117 | @Override |
| 118 | public void prepare(ScrimState previousState) { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 119 | mBehindAlpha = 0; |
| 120 | mFrontAlpha = 0; |
| 121 | mBubbleAlpha = 0; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 122 | } |
| 123 | }, |
| 124 | |
| 125 | /** |
| 126 | * Always on display or screen off. |
| 127 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 128 | AOD { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 129 | @Override |
| 130 | public void prepare(ScrimState previousState) { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 131 | final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn(); |
Jerry Chang | 50c5da4 | 2019-10-16 17:21:07 +0800 | [diff] [blame] | 132 | final boolean isDocked = mDockManager.isDocked(); |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 133 | mBlankScreen = mDisplayRequiresBlanking; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 134 | |
| 135 | mFrontTint = Color.BLACK; |
Jerry Chang | 50c5da4 | 2019-10-16 17:21:07 +0800 | [diff] [blame] | 136 | mFrontAlpha = (alwaysOnEnabled || isDocked) ? mAodFrontScrimAlpha : 1f; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 137 | |
| 138 | mBehindTint = Color.BLACK; |
| 139 | mBehindAlpha = ScrimController.TRANSPARENT; |
| 140 | |
| 141 | mBubbleTint = Color.TRANSPARENT; |
| 142 | mBubbleAlpha = ScrimController.TRANSPARENT; |
| 143 | |
Lucas Dupin | 4749f1b | 2018-04-04 15:09:06 -0700 | [diff] [blame] | 144 | mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG; |
Lucas Dupin | ea0116e | 2018-04-05 10:09:29 -0700 | [diff] [blame] | 145 | // DisplayPowerManager may blank the screen for us, |
| 146 | // in this case we just need to set our state. |
| 147 | mAnimateChange = mDozeParameters.shouldControlScreenOff(); |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 148 | } |
Lucas Dupin | 38962d7 | 2018-03-14 12:41:39 -0700 | [diff] [blame] | 149 | |
| 150 | @Override |
Lucas Dupin | 3d36dd8 | 2019-01-02 14:38:35 -0800 | [diff] [blame] | 151 | public float getBehindAlpha() { |
Lucas Dupin | 9bee582 | 2018-07-09 14:32:53 -0700 | [diff] [blame] | 152 | return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; |
| 153 | } |
| 154 | |
| 155 | @Override |
Lucas Dupin | 38962d7 | 2018-03-14 12:41:39 -0700 | [diff] [blame] | 156 | public boolean isLowPowerState() { |
| 157 | return true; |
| 158 | } |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 159 | }, |
| 160 | |
| 161 | /** |
| 162 | * When phone wakes up because you received a notification. |
| 163 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 164 | PULSING { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 165 | @Override |
| 166 | public void prepare(ScrimState previousState) { |
Chris.CC Lee | d424e20 | 2019-09-16 12:17:19 +0800 | [diff] [blame] | 167 | mFrontAlpha = mAodFrontScrimAlpha; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 168 | mBubbleAlpha = 0f; |
| 169 | mBehindTint = Color.BLACK; |
Mady Mellor | 4035ef5 | 2019-07-25 11:10:02 -0700 | [diff] [blame] | 170 | mFrontTint = Color.BLACK; |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 171 | mBlankScreen = mDisplayRequiresBlanking; |
Lucas Dupin | a7eacf9 | 2019-07-24 12:40:34 -0700 | [diff] [blame] | 172 | mAnimationDuration = mWakeLockScreenSensorActive |
| 173 | ? ScrimController.ANIMATION_DURATION_LONG : ScrimController.ANIMATION_DURATION; |
Lucas Dupin | fea9b86 | 2019-08-08 16:58:50 -0700 | [diff] [blame] | 174 | |
| 175 | // Wake sensor will show the wallpaper, let's fade from black. Otherwise it will |
| 176 | // feel like the screen is flashing if the wallpaper is light. |
| 177 | if (mWakeLockScreenSensorActive && previousState == AOD) { |
| 178 | updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); |
| 179 | } |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 180 | } |
Lucas Dupin | 5f00fa5 | 2019-03-27 22:46:53 -0700 | [diff] [blame] | 181 | |
| 182 | @Override |
| 183 | public float getBehindAlpha() { |
| 184 | return mWakeLockScreenSensorActive ? ScrimController.WAKE_SENSOR_SCRIM_ALPHA |
| 185 | : AOD.getBehindAlpha(); |
| 186 | } |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 187 | }, |
| 188 | |
| 189 | /** |
| 190 | * Unlocked on top of an app (launcher or any other activity.) |
| 191 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 192 | UNLOCKED { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 193 | @Override |
| 194 | public void prepare(ScrimState previousState) { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 195 | // State that UI will sync to. |
| 196 | mBehindAlpha = 0; |
| 197 | mFrontAlpha = 0; |
| 198 | mBubbleAlpha = 0; |
| 199 | |
Selim Cinek | 72cd9a7 | 2019-08-09 17:19:57 -0700 | [diff] [blame] | 200 | mAnimationDuration = mKeyguardFadingAway |
| 201 | ? mKeyguardFadingAwayDuration |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 202 | : StatusBar.FADE_KEYGUARD_DURATION; |
Mady Mellor | 0679200 | 2019-08-13 14:33:24 -0700 | [diff] [blame] | 203 | |
Lucas Dupin | 193677c | 2018-06-11 19:16:03 -0700 | [diff] [blame] | 204 | mAnimateChange = !mLaunchingAffordanceWithPreview; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 205 | |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 206 | mFrontTint = Color.TRANSPARENT; |
| 207 | mBehindTint = Color.TRANSPARENT; |
| 208 | mBubbleTint = Color.TRANSPARENT; |
| 209 | mBlankScreen = false; |
| 210 | |
Lucas Dupin | d35502f | 2018-06-27 13:35:52 -0700 | [diff] [blame] | 211 | if (previousState == ScrimState.AOD) { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 212 | // Set all scrims black, before they fade transparent. |
| 213 | updateScrimColor(mScrimInFront, 1f /* alpha */, Color.BLACK /* tint */); |
| 214 | updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK /* tint */); |
| 215 | updateScrimColor(mScrimForBubble, 1f /* alpha */, Color.BLACK /* tint */); |
| 216 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 217 | // Scrims should still be black at the end of the transition. |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 218 | mFrontTint = Color.BLACK; |
| 219 | mBehindTint = Color.BLACK; |
| 220 | mBubbleTint = Color.BLACK; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 221 | mBlankScreen = true; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 222 | } |
| 223 | } |
Mady Mellor | 0c33377 | 2018-11-06 18:05:54 -0800 | [diff] [blame] | 224 | }, |
| 225 | |
| 226 | /** |
| 227 | * Unlocked with a bubble expanded. |
| 228 | */ |
Lucas Dupin | edbe45b | 2019-10-14 15:43:03 -0700 | [diff] [blame] | 229 | BUBBLE_EXPANDED { |
Mady Mellor | 0c33377 | 2018-11-06 18:05:54 -0800 | [diff] [blame] | 230 | @Override |
| 231 | public void prepare(ScrimState previousState) { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 232 | mFrontTint = Color.TRANSPARENT; |
| 233 | mBehindTint = Color.TRANSPARENT; |
| 234 | mBubbleTint = Color.TRANSPARENT; |
| 235 | |
| 236 | mFrontAlpha = ScrimController.TRANSPARENT; |
Lucas Dupin | 43d0124 | 2020-02-03 11:58:33 -0800 | [diff] [blame] | 237 | mBehindAlpha = ScrimController.BUSY_SCRIM_ALPHA; |
| 238 | mBubbleAlpha = ScrimController.BUSY_SCRIM_ALPHA; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 239 | |
Mady Mellor | 0c33377 | 2018-11-06 18:05:54 -0800 | [diff] [blame] | 240 | mAnimationDuration = ScrimController.ANIMATION_DURATION; |
Mady Mellor | 0c33377 | 2018-11-06 18:05:54 -0800 | [diff] [blame] | 241 | mBlankScreen = false; |
| 242 | } |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 243 | }; |
| 244 | |
| 245 | boolean mBlankScreen = false; |
| 246 | long mAnimationDuration = ScrimController.ANIMATION_DURATION; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 247 | int mFrontTint = Color.TRANSPARENT; |
| 248 | int mBehindTint = Color.TRANSPARENT; |
| 249 | int mBubbleTint = Color.TRANSPARENT; |
| 250 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 251 | boolean mAnimateChange = true; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 252 | float mAodFrontScrimAlpha; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 253 | float mFrontAlpha; |
| 254 | float mBehindAlpha; |
| 255 | float mBubbleAlpha; |
| 256 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 257 | float mScrimBehindAlphaKeyguard; |
| 258 | ScrimView mScrimInFront; |
| 259 | ScrimView mScrimBehind; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 260 | ScrimView mScrimForBubble; |
| 261 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 262 | DozeParameters mDozeParameters; |
Jerry Chang | 50c5da4 | 2019-10-16 17:21:07 +0800 | [diff] [blame] | 263 | DockManager mDockManager; |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 264 | boolean mDisplayRequiresBlanking; |
Lucas Dupin | 7517b5d | 2017-08-22 12:51:25 -0700 | [diff] [blame] | 265 | boolean mWallpaperSupportsAmbientMode; |
Lucas Dupin | f8463ee | 2018-06-11 16:18:15 -0700 | [diff] [blame] | 266 | boolean mHasBackdrop; |
Lucas Dupin | 193677c | 2018-06-11 19:16:03 -0700 | [diff] [blame] | 267 | boolean mLaunchingAffordanceWithPreview; |
Lucas Dupin | 5f00fa5 | 2019-03-27 22:46:53 -0700 | [diff] [blame] | 268 | boolean mWakeLockScreenSensorActive; |
Selim Cinek | 72cd9a7 | 2019-08-09 17:19:57 -0700 | [diff] [blame] | 269 | boolean mKeyguardFadingAway; |
| 270 | long mKeyguardFadingAwayDuration; |
Lucas Dupin | 5866aaf | 2018-02-02 14:45:31 -0800 | [diff] [blame] | 271 | |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 272 | public void init(ScrimView scrimInFront, ScrimView scrimBehind, ScrimView scrimForBubble, |
Jerry Chang | 50c5da4 | 2019-10-16 17:21:07 +0800 | [diff] [blame] | 273 | DozeParameters dozeParameters, DockManager dockManager) { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 274 | mScrimInFront = scrimInFront; |
| 275 | mScrimBehind = scrimBehind; |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 276 | mScrimForBubble = scrimForBubble; |
| 277 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 278 | mDozeParameters = dozeParameters; |
Jerry Chang | 50c5da4 | 2019-10-16 17:21:07 +0800 | [diff] [blame] | 279 | mDockManager = dockManager; |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 280 | mDisplayRequiresBlanking = dozeParameters.getDisplayNeedsBlanking(); |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 281 | } |
| 282 | |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 283 | /** Prepare state for transition. */ |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 284 | public void prepare(ScrimState previousState) { |
| 285 | } |
| 286 | |
| 287 | public float getFrontAlpha() { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 288 | return mFrontAlpha; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 289 | } |
| 290 | |
Lucas Dupin | 3d36dd8 | 2019-01-02 14:38:35 -0800 | [diff] [blame] | 291 | public float getBehindAlpha() { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 292 | return mBehindAlpha; |
| 293 | } |
| 294 | |
| 295 | public float getBubbleAlpha() { |
| 296 | return mBubbleAlpha; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | public int getFrontTint() { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 300 | return mFrontTint; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | public int getBehindTint() { |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 304 | return mBehindTint; |
| 305 | } |
| 306 | |
| 307 | public int getBubbleTint() { |
| 308 | return mBubbleTint; |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | public long getAnimationDuration() { |
| 312 | return mAnimationDuration; |
| 313 | } |
| 314 | |
| 315 | public boolean getBlanksScreen() { |
| 316 | return mBlankScreen; |
| 317 | } |
| 318 | |
| 319 | public void updateScrimColor(ScrimView scrim, float alpha, int tint) { |
| 320 | Trace.traceCounter(Trace.TRACE_TAG_APP, |
| 321 | scrim == mScrimInFront ? "front_scrim_alpha" : "back_scrim_alpha", |
| 322 | (int) (alpha * 255)); |
| 323 | |
| 324 | Trace.traceCounter(Trace.TRACE_TAG_APP, |
| 325 | scrim == mScrimInFront ? "front_scrim_tint" : "back_scrim_tint", |
| 326 | Color.alpha(tint)); |
| 327 | |
| 328 | scrim.setTint(tint); |
| 329 | scrim.setViewAlpha(alpha); |
| 330 | } |
| 331 | |
| 332 | public boolean getAnimateChange() { |
| 333 | return mAnimateChange; |
| 334 | } |
| 335 | |
| 336 | public void setAodFrontScrimAlpha(float aodFrontScrimAlpha) { |
| 337 | mAodFrontScrimAlpha = aodFrontScrimAlpha; |
| 338 | } |
| 339 | |
| 340 | public void setScrimBehindAlphaKeyguard(float scrimBehindAlphaKeyguard) { |
| 341 | mScrimBehindAlphaKeyguard = scrimBehindAlphaKeyguard; |
| 342 | } |
Lucas Dupin | 7517b5d | 2017-08-22 12:51:25 -0700 | [diff] [blame] | 343 | |
| 344 | public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) { |
| 345 | mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode; |
| 346 | } |
Lucas Dupin | 38962d7 | 2018-03-14 12:41:39 -0700 | [diff] [blame] | 347 | |
Lucas Dupin | 193677c | 2018-06-11 19:16:03 -0700 | [diff] [blame] | 348 | public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) { |
| 349 | mLaunchingAffordanceWithPreview = launchingAffordanceWithPreview; |
| 350 | } |
| 351 | |
Lucas Dupin | 38962d7 | 2018-03-14 12:41:39 -0700 | [diff] [blame] | 352 | public boolean isLowPowerState() { |
| 353 | return false; |
| 354 | } |
Lucas Dupin | f8463ee | 2018-06-11 16:18:15 -0700 | [diff] [blame] | 355 | |
| 356 | public void setHasBackdrop(boolean hasBackdrop) { |
| 357 | mHasBackdrop = hasBackdrop; |
| 358 | } |
Lucas Dupin | 5f00fa5 | 2019-03-27 22:46:53 -0700 | [diff] [blame] | 359 | |
| 360 | public void setWakeLockScreenSensorActive(boolean active) { |
| 361 | mWakeLockScreenSensorActive = active; |
| 362 | } |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 363 | |
Selim Cinek | 72cd9a7 | 2019-08-09 17:19:57 -0700 | [diff] [blame] | 364 | public void setKeyguardFadingAway(boolean fadingAway, long duration) { |
| 365 | mKeyguardFadingAway = fadingAway; |
| 366 | mKeyguardFadingAwayDuration = duration; |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 367 | } |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 368 | } |