Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 19 | import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 20 | import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 21 | import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 22 | import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 23 | import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; |
lumark | 588a3e8 | 2018-07-20 18:53:54 +0800 | [diff] [blame] | 24 | import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 25 | |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 26 | import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; |
lumark | 9bca6b4 | 2019-10-17 18:35:22 +0800 | [diff] [blame] | 27 | import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS; |
| 28 | import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION; |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 29 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_SCREENSHOT; |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 30 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER; |
| 31 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT; |
| 32 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; |
| 33 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 34 | import static com.android.server.wm.WindowManagerService.H.WALLPAPER_DRAW_PENDING_TIMEOUT; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 35 | |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 36 | import android.graphics.Bitmap; |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 37 | import android.graphics.Rect; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 38 | import android.os.Bundle; |
| 39 | import android.os.Debug; |
| 40 | import android.os.IBinder; |
| 41 | import android.os.RemoteException; |
| 42 | import android.os.SystemClock; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 43 | import android.util.ArraySet; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 44 | import android.util.Slog; |
| 45 | import android.view.DisplayInfo; |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 46 | import android.view.SurfaceControl; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 47 | import android.view.WindowManager; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 48 | import android.view.animation.Animation; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 49 | |
Vishnu Nair | e6e2b0f | 2019-02-21 10:41:00 -0800 | [diff] [blame] | 50 | import com.android.internal.annotations.VisibleForTesting; |
lumark | 588a3e8 | 2018-07-20 18:53:54 +0800 | [diff] [blame] | 51 | import com.android.internal.util.ToBooleanFunction; |
| 52 | |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 53 | import java.io.PrintWriter; |
| 54 | import java.util.ArrayList; |
| 55 | |
| 56 | /** |
| 57 | * Controls wallpaper windows visibility, ordering, and so on. |
| 58 | * NOTE: All methods in this class must be called with the window manager service lock held. |
| 59 | */ |
| 60 | class WallpaperController { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 61 | private static final String TAG = TAG_WITH_CLASS_NAME ? "WallpaperController" : TAG_WM; |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 62 | private WindowManagerService mService; |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 63 | private final DisplayContent mDisplayContent; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 64 | |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 65 | private final ArrayList<WallpaperWindowToken> mWallpaperTokens = new ArrayList<>(); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 66 | |
| 67 | // If non-null, this is the currently visible window that is associated |
| 68 | // with the wallpaper. |
| 69 | private WindowState mWallpaperTarget = null; |
| 70 | // If non-null, we are in the middle of animating from one wallpaper target |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 71 | // to another, and this is the previous wallpaper target. |
| 72 | private WindowState mPrevWallpaperTarget = null; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 73 | |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 74 | private float mLastWallpaperX = -1; |
| 75 | private float mLastWallpaperY = -1; |
| 76 | private float mLastWallpaperXStep = -1; |
| 77 | private float mLastWallpaperYStep = -1; |
| 78 | private int mLastWallpaperDisplayOffsetX = Integer.MIN_VALUE; |
| 79 | private int mLastWallpaperDisplayOffsetY = Integer.MIN_VALUE; |
| 80 | |
| 81 | // This is set when we are waiting for a wallpaper to tell us it is done |
| 82 | // changing its scroll position. |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 83 | private WindowState mWaitingOnWallpaper; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 84 | |
| 85 | // The last time we had a timeout when waiting for a wallpaper. |
| 86 | private long mLastWallpaperTimeoutTime; |
| 87 | // We give a wallpaper up to 150ms to finish scrolling. |
| 88 | private static final long WALLPAPER_TIMEOUT = 150; |
| 89 | // Time we wait after a timeout before trying to wait again. |
| 90 | private static final long WALLPAPER_TIMEOUT_RECOVERY = 10000; |
| 91 | |
| 92 | // Set to the wallpaper window we would like to hide once the transition animations are done. |
| 93 | // This is useful in cases where we don't want the wallpaper to be hidden when the close app |
| 94 | // is a wallpaper target and is done animating out, but the opening app isn't a wallpaper |
| 95 | // target and isn't done animating in. |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 96 | WindowState mDeferredHideWallpaper = null; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 97 | |
| 98 | // We give a wallpaper up to 500ms to finish drawing before playing app transitions. |
| 99 | private static final long WALLPAPER_DRAW_PENDING_TIMEOUT_DURATION = 500; |
| 100 | private static final int WALLPAPER_DRAW_NORMAL = 0; |
| 101 | private static final int WALLPAPER_DRAW_PENDING = 1; |
| 102 | private static final int WALLPAPER_DRAW_TIMEOUT = 2; |
| 103 | private int mWallpaperDrawState = WALLPAPER_DRAW_NORMAL; |
| 104 | |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 105 | /** |
| 106 | * Temporary storage for taking a screenshot of the wallpaper. |
| 107 | * @see #screenshotWallpaperLocked() |
| 108 | */ |
| 109 | private WindowState mTmpTopWallpaper; |
| 110 | |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 111 | private final FindWallpaperTargetResult mFindResults = new FindWallpaperTargetResult(); |
| 112 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 113 | private final ToBooleanFunction<WindowState> mFindWallpaperTargetFunction = w -> { |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 114 | if ((w.mAttrs.type == TYPE_WALLPAPER)) { |
| 115 | if (mFindResults.topWallpaper == null || mFindResults.resetTopWallpaper) { |
| 116 | mFindResults.setTopWallpaper(w); |
| 117 | mFindResults.resetTopWallpaper = false; |
| 118 | } |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | mFindResults.resetTopWallpaper = true; |
Issei Suzuki | f2f6c91 | 2019-11-08 11:24:18 +0100 | [diff] [blame] | 123 | if (w.mActivityRecord != null && !w.mActivityRecord.isVisible() |
lumark | 9bca6b4 | 2019-10-17 18:35:22 +0800 | [diff] [blame] | 124 | && !w.mActivityRecord.isAnimating(TRANSITION)) { |
Jorim Jaggi | 8f52087 | 2018-08-14 17:00:20 +0200 | [diff] [blame] | 125 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 126 | // If this window's app token is hidden and not animating, it is of no interest to us. |
Jorim Jaggi | 8f52087 | 2018-08-14 17:00:20 +0200 | [diff] [blame] | 127 | if (DEBUG_WALLPAPER) Slog.v(TAG, "Skipping hidden and not animating token: " + w); |
| 128 | return false; |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 129 | } |
| 130 | if (DEBUG_WALLPAPER) Slog.v(TAG, "Win " + w + ": isOnScreen=" + w.isOnScreen() |
| 131 | + " mDrawState=" + w.mWinAnimator.mDrawState); |
| 132 | |
| 133 | if (w.mWillReplaceWindow && mWallpaperTarget == null |
| 134 | && !mFindResults.useTopWallpaperAsTarget) { |
| 135 | // When we are replacing a window and there was wallpaper before replacement, we want to |
| 136 | // keep the window until the new windows fully appear and can determine the visibility, |
| 137 | // to avoid flickering. |
| 138 | mFindResults.setUseTopWallpaperAsTarget(true); |
| 139 | } |
| 140 | |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 141 | final boolean keyguardGoingAwayWithWallpaper = (w.mActivityRecord != null |
lumark | 9bca6b4 | 2019-10-17 18:35:22 +0800 | [diff] [blame] | 142 | && w.mActivityRecord.isAnimating(TRANSITION) |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 143 | && AppTransition.isKeyguardGoingAwayTransit(w.mActivityRecord.getTransit()) |
| 144 | && (w.mActivityRecord.getTransitFlags() |
Jorim Jaggi | f5f9e12 | 2017-10-24 18:21:09 +0200 | [diff] [blame] | 145 | & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0); |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 146 | |
| 147 | boolean needsShowWhenLockedWallpaper = false; |
| 148 | if ((w.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 |
| 149 | && mService.mPolicy.isKeyguardLocked() |
| 150 | && mService.mPolicy.isKeyguardOccluded()) { |
| 151 | // The lowest show when locked window decides whether we need to put the wallpaper |
| 152 | // behind. |
| 153 | needsShowWhenLockedWallpaper = !isFullscreen(w.mAttrs) |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 154 | || (w.mActivityRecord != null && !w.mActivityRecord.fillsParent()); |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | if (keyguardGoingAwayWithWallpaper || needsShowWhenLockedWallpaper) { |
| 158 | // Keep the wallpaper during Keyguard exit but also when it's needed for a |
| 159 | // non-fullscreen show when locked activity. |
| 160 | mFindResults.setUseTopWallpaperAsTarget(true); |
| 161 | } |
| 162 | |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 163 | final RecentsAnimationController recentsAnimationController = |
| 164 | mService.getRecentsAnimationController(); |
lumark | 19a5d2e | 2019-10-11 16:19:30 +0800 | [diff] [blame] | 165 | final boolean animationWallpaper = w.mActivityRecord != null |
| 166 | && w.mActivityRecord.getAnimation() != null |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 167 | && w.mActivityRecord.getAnimation().getShowWallpaper(); |
Jorim Jaggi | 82c1786 | 2018-02-21 17:50:18 +0100 | [diff] [blame] | 168 | final boolean hasWallpaper = (w.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0 |
| 169 | || animationWallpaper; |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 170 | final boolean isRecentsTransitionTarget = (recentsAnimationController != null |
| 171 | && recentsAnimationController.isWallpaperVisible(w)); |
| 172 | if (isRecentsTransitionTarget) { |
| 173 | if (DEBUG_WALLPAPER) Slog.v(TAG, "Found recents animation wallpaper target: " + w); |
| 174 | mFindResults.setWallpaperTarget(w); |
| 175 | return true; |
| 176 | } else if (hasWallpaper && w.isOnScreen() |
| 177 | && (mWallpaperTarget == w || w.isDrawFinishedLw())) { |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 178 | if (DEBUG_WALLPAPER) Slog.v(TAG, "Found wallpaper target: " + w); |
| 179 | mFindResults.setWallpaperTarget(w); |
lumark | 9bca6b4 | 2019-10-17 18:35:22 +0800 | [diff] [blame] | 180 | if (w == mWallpaperTarget && w.isAnimating(TRANSITION | PARENTS)) { |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 181 | // The current wallpaper target is animating, so we'll look behind it for |
| 182 | // another possible target and figure out what is going on later. |
| 183 | if (DEBUG_WALLPAPER) Slog.v(TAG, |
| 184 | "Win " + w + ": token animating, looking behind."); |
| 185 | } |
| 186 | // Found a target! End search. |
| 187 | return true; |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 188 | } |
| 189 | return false; |
| 190 | }; |
| 191 | |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 192 | WallpaperController(WindowManagerService service, DisplayContent displayContent) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 193 | mService = service; |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 194 | mDisplayContent = displayContent; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | WindowState getWallpaperTarget() { |
| 198 | return mWallpaperTarget; |
| 199 | } |
| 200 | |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 201 | boolean isWallpaperTarget(WindowState win) { |
| 202 | return win == mWallpaperTarget; |
| 203 | } |
| 204 | |
| 205 | boolean isBelowWallpaperTarget(WindowState win) { |
| 206 | return mWallpaperTarget != null && mWallpaperTarget.mLayer >= win.mBaseLayer; |
| 207 | } |
| 208 | |
| 209 | boolean isWallpaperVisible() { |
| 210 | return isWallpaperVisible(mWallpaperTarget); |
| 211 | } |
| 212 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 213 | /** |
| 214 | * Starts {@param a} on all wallpaper windows. |
| 215 | */ |
| 216 | void startWallpaperAnimation(Animation a) { |
| 217 | for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) { |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 218 | final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 219 | token.startAnimation(a); |
| 220 | } |
| 221 | } |
| 222 | |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 223 | private final boolean isWallpaperVisible(WindowState wallpaperTarget) { |
| 224 | final RecentsAnimationController recentsAnimationController = |
| 225 | mService.getRecentsAnimationController(); |
| 226 | boolean isAnimatingWithRecentsComponent = recentsAnimationController != null |
| 227 | && recentsAnimationController.isWallpaperVisible(wallpaperTarget); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 228 | if (DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper vis: target " + wallpaperTarget + ", obscured=" |
| 229 | + (wallpaperTarget != null ? Boolean.toString(wallpaperTarget.mObscured) : "??") |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 230 | + " animating=" + ((wallpaperTarget != null && wallpaperTarget.mActivityRecord != null) |
lumark | 9bca6b4 | 2019-10-17 18:35:22 +0800 | [diff] [blame] | 231 | ? wallpaperTarget.mActivityRecord.isAnimating(TRANSITION) : null) |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 232 | + " prev=" + mPrevWallpaperTarget |
| 233 | + " recentsAnimationWallpaperVisible=" + isAnimatingWithRecentsComponent); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 234 | return (wallpaperTarget != null |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 235 | && (!wallpaperTarget.mObscured |
| 236 | || isAnimatingWithRecentsComponent |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 237 | || (wallpaperTarget.mActivityRecord != null |
lumark | 9bca6b4 | 2019-10-17 18:35:22 +0800 | [diff] [blame] | 238 | && wallpaperTarget.mActivityRecord.isAnimating(TRANSITION)))) |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 239 | || mPrevWallpaperTarget != null; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | boolean isWallpaperTargetAnimating() { |
lumark | 9bca6b4 | 2019-10-17 18:35:22 +0800 | [diff] [blame] | 243 | return mWallpaperTarget != null && mWallpaperTarget.isAnimating(TRANSITION | PARENTS) |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 244 | && (mWallpaperTarget.mActivityRecord == null |
| 245 | || !mWallpaperTarget.mActivityRecord.isWaitingForTransitionStart()); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | void updateWallpaperVisibility() { |
Filip Gruszczynski | 63a35e2 | 2015-11-05 15:38:59 -0800 | [diff] [blame] | 249 | final boolean visible = isWallpaperVisible(mWallpaperTarget); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 250 | |
| 251 | for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) { |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 252 | final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx); |
Wale Ogunwale | b0f3b83 | 2016-10-17 10:13:07 -0700 | [diff] [blame] | 253 | token.updateWallpaperVisibility(visible); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 254 | } |
| 255 | } |
| 256 | |
| 257 | void hideDeferredWallpapersIfNeeded() { |
| 258 | if (mDeferredHideWallpaper != null) { |
| 259 | hideWallpapers(mDeferredHideWallpaper); |
| 260 | mDeferredHideWallpaper = null; |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | void hideWallpapers(final WindowState winGoingAway) { |
| 265 | if (mWallpaperTarget != null |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 266 | && (mWallpaperTarget != winGoingAway || mPrevWallpaperTarget != null)) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 267 | return; |
| 268 | } |
lumark | 588a3e8 | 2018-07-20 18:53:54 +0800 | [diff] [blame] | 269 | if (mWallpaperTarget != null |
| 270 | && mWallpaperTarget.getDisplayContent().mAppTransition.isRunning()) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 271 | // Defer hiding the wallpaper when app transition is running until the animations |
| 272 | // are done. |
| 273 | mDeferredHideWallpaper = winGoingAway; |
| 274 | return; |
| 275 | } |
| 276 | |
| 277 | final boolean wasDeferred = (mDeferredHideWallpaper == winGoingAway); |
| 278 | for (int i = mWallpaperTokens.size() - 1; i >= 0; i--) { |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 279 | final WallpaperWindowToken token = mWallpaperTokens.get(i); |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 280 | token.hideWallpaperToken(wasDeferred, "hideWallpapers"); |
Issei Suzuki | f2f6c91 | 2019-11-08 11:24:18 +0100 | [diff] [blame] | 281 | if (DEBUG_WALLPAPER_LIGHT && token.isVisible()) { |
| 282 | Slog.d(TAG, "Hiding wallpaper " + token |
| 283 | + " from " + winGoingAway + " target=" + mWallpaperTarget + " prev=" |
| 284 | + mPrevWallpaperTarget + "\n" + Debug.getCallers(5, " ")); |
| 285 | } |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 286 | } |
| 287 | } |
| 288 | |
| 289 | boolean updateWallpaperOffset(WindowState wallpaperWin, int dw, int dh, boolean sync) { |
Robert Carr | 217e7cc | 2018-01-31 18:08:39 -0800 | [diff] [blame] | 290 | int xOffset = 0; |
| 291 | int yOffset = 0; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 292 | boolean rawChanged = false; |
Winson | 4b4ba90 | 2016-07-27 19:45:52 -0700 | [diff] [blame] | 293 | // Set the default wallpaper x-offset to either edge of the screen (depending on RTL), to |
| 294 | // match the behavior of most Launchers |
| 295 | float defaultWallpaperX = wallpaperWin.isRtl() ? 1f : 0f; |
| 296 | float wpx = mLastWallpaperX >= 0 ? mLastWallpaperX : defaultWallpaperX; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 297 | float wpxs = mLastWallpaperXStep >= 0 ? mLastWallpaperXStep : -1.0f; |
chaviw | 492139a | 2018-07-16 16:07:35 -0700 | [diff] [blame] | 298 | int availw = wallpaperWin.getFrameLw().right - wallpaperWin.getFrameLw().left - dw; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 299 | int offset = availw > 0 ? -(int)(availw * wpx + .5f) : 0; |
| 300 | if (mLastWallpaperDisplayOffsetX != Integer.MIN_VALUE) { |
| 301 | offset += mLastWallpaperDisplayOffsetX; |
| 302 | } |
Robert Carr | 217e7cc | 2018-01-31 18:08:39 -0800 | [diff] [blame] | 303 | xOffset = offset; |
| 304 | |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 305 | if (wallpaperWin.mWallpaperX != wpx || wallpaperWin.mWallpaperXStep != wpxs) { |
| 306 | wallpaperWin.mWallpaperX = wpx; |
| 307 | wallpaperWin.mWallpaperXStep = wpxs; |
| 308 | rawChanged = true; |
| 309 | } |
| 310 | |
| 311 | float wpy = mLastWallpaperY >= 0 ? mLastWallpaperY : 0.5f; |
| 312 | float wpys = mLastWallpaperYStep >= 0 ? mLastWallpaperYStep : -1.0f; |
chaviw | 492139a | 2018-07-16 16:07:35 -0700 | [diff] [blame] | 313 | int availh = wallpaperWin.getFrameLw().bottom - wallpaperWin.getFrameLw().top - dh; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 314 | offset = availh > 0 ? -(int)(availh * wpy + .5f) : 0; |
| 315 | if (mLastWallpaperDisplayOffsetY != Integer.MIN_VALUE) { |
| 316 | offset += mLastWallpaperDisplayOffsetY; |
| 317 | } |
Robert Carr | 217e7cc | 2018-01-31 18:08:39 -0800 | [diff] [blame] | 318 | yOffset = offset; |
| 319 | |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 320 | if (wallpaperWin.mWallpaperY != wpy || wallpaperWin.mWallpaperYStep != wpys) { |
| 321 | wallpaperWin.mWallpaperY = wpy; |
| 322 | wallpaperWin.mWallpaperYStep = wpys; |
| 323 | rawChanged = true; |
| 324 | } |
| 325 | |
Robert Carr | 217e7cc | 2018-01-31 18:08:39 -0800 | [diff] [blame] | 326 | boolean changed = wallpaperWin.mWinAnimator.setWallpaperOffset(xOffset, yOffset); |
| 327 | |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 328 | if (rawChanged && (wallpaperWin.mAttrs.privateFlags & |
| 329 | WindowManager.LayoutParams.PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS) != 0) { |
| 330 | try { |
| 331 | if (DEBUG_WALLPAPER) Slog.v(TAG, "Report new wp offset " |
| 332 | + wallpaperWin + " x=" + wallpaperWin.mWallpaperX |
| 333 | + " y=" + wallpaperWin.mWallpaperY); |
| 334 | if (sync) { |
| 335 | mWaitingOnWallpaper = wallpaperWin; |
| 336 | } |
| 337 | wallpaperWin.mClient.dispatchWallpaperOffsets( |
| 338 | wallpaperWin.mWallpaperX, wallpaperWin.mWallpaperY, |
| 339 | wallpaperWin.mWallpaperXStep, wallpaperWin.mWallpaperYStep, sync); |
| 340 | if (sync) { |
| 341 | if (mWaitingOnWallpaper != null) { |
| 342 | long start = SystemClock.uptimeMillis(); |
| 343 | if ((mLastWallpaperTimeoutTime + WALLPAPER_TIMEOUT_RECOVERY) |
| 344 | < start) { |
| 345 | try { |
| 346 | if (DEBUG_WALLPAPER) Slog.v(TAG, |
| 347 | "Waiting for offset complete..."); |
Wale Ogunwale | db485de | 2018-10-29 09:47:07 -0700 | [diff] [blame] | 348 | mService.mGlobalLock.wait(WALLPAPER_TIMEOUT); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 349 | } catch (InterruptedException e) { |
| 350 | } |
| 351 | if (DEBUG_WALLPAPER) Slog.v(TAG, "Offset complete!"); |
| 352 | if ((start + WALLPAPER_TIMEOUT) < SystemClock.uptimeMillis()) { |
| 353 | Slog.i(TAG, "Timeout waiting for wallpaper to offset: " |
| 354 | + wallpaperWin); |
| 355 | mLastWallpaperTimeoutTime = start; |
| 356 | } |
| 357 | } |
| 358 | mWaitingOnWallpaper = null; |
| 359 | } |
| 360 | } |
| 361 | } catch (RemoteException e) { |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | return changed; |
| 366 | } |
| 367 | |
| 368 | void setWindowWallpaperPosition( |
| 369 | WindowState window, float x, float y, float xStep, float yStep) { |
| 370 | if (window.mWallpaperX != x || window.mWallpaperY != y) { |
| 371 | window.mWallpaperX = x; |
| 372 | window.mWallpaperY = y; |
| 373 | window.mWallpaperXStep = xStep; |
| 374 | window.mWallpaperYStep = yStep; |
| 375 | updateWallpaperOffsetLocked(window, true); |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | void setWindowWallpaperDisplayOffset(WindowState window, int x, int y) { |
| 380 | if (window.mWallpaperDisplayOffsetX != x || window.mWallpaperDisplayOffsetY != y) { |
| 381 | window.mWallpaperDisplayOffsetX = x; |
| 382 | window.mWallpaperDisplayOffsetY = y; |
| 383 | updateWallpaperOffsetLocked(window, true); |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | Bundle sendWindowWallpaperCommand( |
| 388 | WindowState window, String action, int x, int y, int z, Bundle extras, boolean sync) { |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 389 | if (window == mWallpaperTarget || window == mPrevWallpaperTarget) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 390 | boolean doWait = sync; |
| 391 | for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) { |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 392 | final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx); |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 393 | token.sendWindowWallpaperCommand(action, x, y, z, extras, sync); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | if (doWait) { |
| 397 | // TODO: Need to wait for result. |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | return null; |
| 402 | } |
| 403 | |
Wale Ogunwale | b0f3b83 | 2016-10-17 10:13:07 -0700 | [diff] [blame] | 404 | private void updateWallpaperOffsetLocked(WindowState changingTarget, boolean sync) { |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 405 | final DisplayInfo displayInfo = mDisplayContent.getDisplayInfo(); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 406 | final int dw = displayInfo.logicalWidth; |
| 407 | final int dh = displayInfo.logicalHeight; |
| 408 | |
| 409 | WindowState target = mWallpaperTarget; |
| 410 | if (target != null) { |
| 411 | if (target.mWallpaperX >= 0) { |
| 412 | mLastWallpaperX = target.mWallpaperX; |
| 413 | } else if (changingTarget.mWallpaperX >= 0) { |
| 414 | mLastWallpaperX = changingTarget.mWallpaperX; |
| 415 | } |
| 416 | if (target.mWallpaperY >= 0) { |
| 417 | mLastWallpaperY = target.mWallpaperY; |
| 418 | } else if (changingTarget.mWallpaperY >= 0) { |
| 419 | mLastWallpaperY = changingTarget.mWallpaperY; |
| 420 | } |
| 421 | if (target.mWallpaperDisplayOffsetX != Integer.MIN_VALUE) { |
| 422 | mLastWallpaperDisplayOffsetX = target.mWallpaperDisplayOffsetX; |
| 423 | } else if (changingTarget.mWallpaperDisplayOffsetX != Integer.MIN_VALUE) { |
| 424 | mLastWallpaperDisplayOffsetX = changingTarget.mWallpaperDisplayOffsetX; |
| 425 | } |
| 426 | if (target.mWallpaperDisplayOffsetY != Integer.MIN_VALUE) { |
| 427 | mLastWallpaperDisplayOffsetY = target.mWallpaperDisplayOffsetY; |
| 428 | } else if (changingTarget.mWallpaperDisplayOffsetY != Integer.MIN_VALUE) { |
| 429 | mLastWallpaperDisplayOffsetY = changingTarget.mWallpaperDisplayOffsetY; |
| 430 | } |
| 431 | if (target.mWallpaperXStep >= 0) { |
| 432 | mLastWallpaperXStep = target.mWallpaperXStep; |
| 433 | } else if (changingTarget.mWallpaperXStep >= 0) { |
| 434 | mLastWallpaperXStep = changingTarget.mWallpaperXStep; |
| 435 | } |
| 436 | if (target.mWallpaperYStep >= 0) { |
| 437 | mLastWallpaperYStep = target.mWallpaperYStep; |
| 438 | } else if (changingTarget.mWallpaperYStep >= 0) { |
| 439 | mLastWallpaperYStep = changingTarget.mWallpaperYStep; |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) { |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 444 | mWallpaperTokens.get(curTokenNdx).updateWallpaperOffset(dw, dh, sync); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 445 | } |
| 446 | } |
| 447 | |
| 448 | void clearLastWallpaperTimeoutTime() { |
| 449 | mLastWallpaperTimeoutTime = 0; |
| 450 | } |
| 451 | |
| 452 | void wallpaperCommandComplete(IBinder window) { |
| 453 | if (mWaitingOnWallpaper != null && |
| 454 | mWaitingOnWallpaper.mClient.asBinder() == window) { |
| 455 | mWaitingOnWallpaper = null; |
Wale Ogunwale | db485de | 2018-10-29 09:47:07 -0700 | [diff] [blame] | 456 | mService.mGlobalLock.notifyAll(); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 457 | } |
| 458 | } |
| 459 | |
| 460 | void wallpaperOffsetsComplete(IBinder window) { |
| 461 | if (mWaitingOnWallpaper != null && |
| 462 | mWaitingOnWallpaper.mClient.asBinder() == window) { |
| 463 | mWaitingOnWallpaper = null; |
Wale Ogunwale | db485de | 2018-10-29 09:47:07 -0700 | [diff] [blame] | 464 | mService.mGlobalLock.notifyAll(); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 465 | } |
| 466 | } |
| 467 | |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 468 | private void findWallpaperTarget() { |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 469 | mFindResults.reset(); |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 470 | if (mDisplayContent.isStackVisible(WINDOWING_MODE_FREEFORM)) { |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 471 | // In freeform mode we set the wallpaper as its own target, so we don't need an |
| 472 | // additional window to make it visible. |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 473 | mFindResults.setUseTopWallpaperAsTarget(true); |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 474 | } |
Wale Ogunwale | 6cbba70 | 2016-06-28 16:27:31 -0700 | [diff] [blame] | 475 | |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 476 | mDisplayContent.forAllWindows(mFindWallpaperTargetFunction, true /* traverseTopToBottom */); |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 477 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 478 | if (mFindResults.wallpaperTarget == null && mFindResults.useTopWallpaperAsTarget) { |
| 479 | mFindResults.setWallpaperTarget(mFindResults.topWallpaper); |
Wale Ogunwale | 21fdd91 | 2015-08-20 12:34:57 -0700 | [diff] [blame] | 480 | } |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 481 | } |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 482 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 483 | private boolean isFullscreen(WindowManager.LayoutParams attrs) { |
| 484 | return attrs.x == 0 && attrs.y == 0 |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 485 | && attrs.width == MATCH_PARENT && attrs.height == MATCH_PARENT; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 486 | } |
| 487 | |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 488 | /** Updates the target wallpaper if needed and returns true if an update happened. */ |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 489 | private void updateWallpaperWindowsTarget(FindWallpaperTargetResult result) { |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 490 | |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 491 | WindowState wallpaperTarget = result.wallpaperTarget; |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 492 | |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 493 | if (mWallpaperTarget == wallpaperTarget |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 494 | || (mPrevWallpaperTarget != null && mPrevWallpaperTarget == wallpaperTarget)) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 495 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 496 | if (mPrevWallpaperTarget == null) { |
| 497 | return; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 498 | } |
| 499 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 500 | // Is it time to stop animating? |
| 501 | if (!mPrevWallpaperTarget.isAnimatingLw()) { |
| 502 | if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "No longer animating wallpaper targets!"); |
| 503 | mPrevWallpaperTarget = null; |
| 504 | mWallpaperTarget = wallpaperTarget; |
| 505 | } |
| 506 | return; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 510 | "New wallpaper target: " + wallpaperTarget + " prevTarget: " + mWallpaperTarget); |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 511 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 512 | mPrevWallpaperTarget = null; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 513 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 514 | final WindowState prevWallpaperTarget = mWallpaperTarget; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 515 | mWallpaperTarget = wallpaperTarget; |
| 516 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 517 | if (wallpaperTarget == null || prevWallpaperTarget == null) { |
| 518 | return; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 519 | } |
| 520 | |
| 521 | // Now what is happening... if the current and new targets are animating, |
| 522 | // then we are in our super special mode! |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 523 | boolean oldAnim = prevWallpaperTarget.isAnimatingLw(); |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 524 | boolean foundAnim = wallpaperTarget.isAnimatingLw(); |
| 525 | if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, |
| 526 | "New animation: " + foundAnim + " old animation: " + oldAnim); |
| 527 | |
| 528 | if (!foundAnim || !oldAnim) { |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 529 | return; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 530 | } |
| 531 | |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 532 | if (mDisplayContent.getWindow(w -> w == prevWallpaperTarget) == null) { |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 533 | return; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 534 | } |
| 535 | |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 536 | final boolean newTargetHidden = wallpaperTarget.mActivityRecord != null |
Issei Suzuki | 1669ea4 | 2019-11-06 14:20:59 +0100 | [diff] [blame] | 537 | && !wallpaperTarget.mActivityRecord.mVisibleRequested; |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 538 | final boolean oldTargetHidden = prevWallpaperTarget.mActivityRecord != null |
Issei Suzuki | 1669ea4 | 2019-11-06 14:20:59 +0100 | [diff] [blame] | 539 | && !prevWallpaperTarget.mActivityRecord.mVisibleRequested; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 540 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 541 | if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "Animating wallpapers:" + " old: " |
| 542 | + prevWallpaperTarget + " hidden=" + oldTargetHidden + " new: " + wallpaperTarget |
| 543 | + " hidden=" + newTargetHidden); |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 544 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 545 | mPrevWallpaperTarget = prevWallpaperTarget; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 546 | |
| 547 | if (newTargetHidden && !oldTargetHidden) { |
| 548 | if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "Old wallpaper still the target."); |
| 549 | // Use the old target if new target is hidden but old target |
| 550 | // is not. If they're both hidden, still use the new target. |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 551 | mWallpaperTarget = prevWallpaperTarget; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 552 | } else if (newTargetHidden == oldTargetHidden |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 553 | && !mDisplayContent.mOpeningApps.contains(wallpaperTarget.mActivityRecord) |
| 554 | && (mDisplayContent.mOpeningApps.contains(prevWallpaperTarget.mActivityRecord) |
| 555 | || mDisplayContent.mClosingApps.contains(prevWallpaperTarget.mActivityRecord))) { |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 556 | // If they're both hidden (or both not hidden), prefer the one that's currently in |
| 557 | // opening or closing app list, this allows transition selection logic to better |
| 558 | // determine the wallpaper status of opening/closing apps. |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 559 | mWallpaperTarget = prevWallpaperTarget; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 560 | } |
| 561 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 562 | result.setWallpaperTarget(wallpaperTarget); |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 563 | } |
| 564 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 565 | private void updateWallpaperTokens(boolean visible) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 566 | for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) { |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 567 | final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx); |
Jorim Jaggi | b0fc817 | 2017-11-23 17:04:08 +0000 | [diff] [blame] | 568 | token.updateWallpaperWindows(visible); |
Robert Carr | dee1b3f | 2017-02-27 11:33:33 -0800 | [diff] [blame] | 569 | token.getDisplayContent().assignWindowLayers(false); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 570 | } |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 571 | } |
| 572 | |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 573 | void adjustWallpaperWindows() { |
| 574 | mDisplayContent.mWallpaperMayChange = false; |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 575 | |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 576 | // First find top-most window that has asked to be on top of the wallpaper; |
| 577 | // all wallpapers go behind it. |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 578 | findWallpaperTarget(); |
| 579 | updateWallpaperWindowsTarget(mFindResults); |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 580 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 581 | // The window is visible to the compositor...but is it visible to the user? |
| 582 | // That is what the wallpaper cares about. |
| 583 | final boolean visible = mWallpaperTarget != null && isWallpaperVisible(mWallpaperTarget); |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 584 | if (DEBUG_WALLPAPER) { |
| 585 | Slog.v(TAG, "Wallpaper visibility: " + visible + " at display " |
| 586 | + mDisplayContent.getDisplayId()); |
| 587 | } |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 588 | |
| 589 | if (visible) { |
| 590 | if (mWallpaperTarget.mWallpaperX >= 0) { |
| 591 | mLastWallpaperX = mWallpaperTarget.mWallpaperX; |
| 592 | mLastWallpaperXStep = mWallpaperTarget.mWallpaperXStep; |
| 593 | } |
| 594 | if (mWallpaperTarget.mWallpaperY >= 0) { |
| 595 | mLastWallpaperY = mWallpaperTarget.mWallpaperY; |
| 596 | mLastWallpaperYStep = mWallpaperTarget.mWallpaperYStep; |
| 597 | } |
| 598 | if (mWallpaperTarget.mWallpaperDisplayOffsetX != Integer.MIN_VALUE) { |
| 599 | mLastWallpaperDisplayOffsetX = mWallpaperTarget.mWallpaperDisplayOffsetX; |
| 600 | } |
| 601 | if (mWallpaperTarget.mWallpaperDisplayOffsetY != Integer.MIN_VALUE) { |
| 602 | mLastWallpaperDisplayOffsetY = mWallpaperTarget.mWallpaperDisplayOffsetY; |
| 603 | } |
| 604 | } |
| 605 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 606 | updateWallpaperTokens(visible); |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 607 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 608 | if (DEBUG_WALLPAPER_LIGHT) Slog.d(TAG, "New wallpaper: target=" + mWallpaperTarget |
| 609 | + " prev=" + mPrevWallpaperTarget); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 610 | } |
| 611 | |
| 612 | boolean processWallpaperDrawPendingTimeout() { |
| 613 | if (mWallpaperDrawState == WALLPAPER_DRAW_PENDING) { |
| 614 | mWallpaperDrawState = WALLPAPER_DRAW_TIMEOUT; |
Adrian Roos | b125e0b | 2019-10-02 14:55:14 +0200 | [diff] [blame] | 615 | if (DEBUG_WALLPAPER) { |
| 616 | Slog.v(TAG, "*** WALLPAPER DRAW TIMEOUT"); |
| 617 | } |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 618 | |
Winson Chung | fe57103 | 2019-06-18 11:22:53 -0700 | [diff] [blame] | 619 | // If there was a pending recents animation, start the animation anyways (it's better |
| 620 | // to not see the wallpaper than for the animation to not start) |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 621 | if (mService.getRecentsAnimationController() != null) { |
Winson Chung | fe57103 | 2019-06-18 11:22:53 -0700 | [diff] [blame] | 622 | mService.getRecentsAnimationController().startAnimation(); |
Winson Chung | e2d7217 | 2018-01-25 17:46:20 +0000 | [diff] [blame] | 623 | } |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 624 | return true; |
| 625 | } |
| 626 | return false; |
| 627 | } |
| 628 | |
| 629 | boolean wallpaperTransitionReady() { |
| 630 | boolean transitionReady = true; |
| 631 | boolean wallpaperReady = true; |
| 632 | for (int curTokenIndex = mWallpaperTokens.size() - 1; |
| 633 | curTokenIndex >= 0 && wallpaperReady; curTokenIndex--) { |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 634 | final WallpaperWindowToken token = mWallpaperTokens.get(curTokenIndex); |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 635 | if (token.hasVisibleNotDrawnWallpaper()) { |
| 636 | // We've told this wallpaper to be visible, but it is not drawn yet |
| 637 | wallpaperReady = false; |
| 638 | if (mWallpaperDrawState != WALLPAPER_DRAW_TIMEOUT) { |
| 639 | // wait for this wallpaper until it is drawn or timeout |
| 640 | transitionReady = false; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 641 | } |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 642 | if (mWallpaperDrawState == WALLPAPER_DRAW_NORMAL) { |
| 643 | mWallpaperDrawState = WALLPAPER_DRAW_PENDING; |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 644 | mService.mH.removeMessages(WALLPAPER_DRAW_PENDING_TIMEOUT, this); |
| 645 | mService.mH.sendMessageDelayed( |
| 646 | mService.mH.obtainMessage(WALLPAPER_DRAW_PENDING_TIMEOUT, this), |
| 647 | WALLPAPER_DRAW_PENDING_TIMEOUT_DURATION); |
| 648 | |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 649 | } |
Adrian Roos | b125e0b | 2019-10-02 14:55:14 +0200 | [diff] [blame] | 650 | if (DEBUG_WALLPAPER) { |
| 651 | Slog.v(TAG, |
| 652 | "Wallpaper should be visible but has not been drawn yet. " |
| 653 | + "mWallpaperDrawState=" + mWallpaperDrawState); |
| 654 | } |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 655 | break; |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 656 | } |
| 657 | } |
| 658 | if (wallpaperReady) { |
| 659 | mWallpaperDrawState = WALLPAPER_DRAW_NORMAL; |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 660 | mService.mH.removeMessages(WALLPAPER_DRAW_PENDING_TIMEOUT, this); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 661 | } |
| 662 | |
| 663 | return transitionReady; |
| 664 | } |
| 665 | |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 666 | /** |
| 667 | * Adjusts the wallpaper windows if the input display has a pending wallpaper layout or one of |
| 668 | * the opening apps should be a wallpaper target. |
| 669 | */ |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 670 | void adjustWallpaperWindowsForAppTransitionIfNeeded(ArraySet<ActivityRecord> openingApps, |
| 671 | ArraySet<ActivityRecord> changingApps) { |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 672 | boolean adjust = false; |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 673 | if ((mDisplayContent.pendingLayoutChanges & FINISH_LAYOUT_REDO_WALLPAPER) != 0) { |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 674 | adjust = true; |
| 675 | } else { |
| 676 | for (int i = openingApps.size() - 1; i >= 0; --i) { |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 677 | final ActivityRecord activity = openingApps.valueAt(i); |
| 678 | if (activity.windowsCanBeWallpaperTarget()) { |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 679 | adjust = true; |
| 680 | break; |
| 681 | } |
| 682 | } |
Evan Rosky | 2289ba1 | 2018-11-19 18:28:18 -0800 | [diff] [blame] | 683 | if (!adjust) { |
| 684 | for (int i = changingApps.size() - 1; i >= 0; --i) { |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 685 | final ActivityRecord activity = changingApps.valueAt(i); |
| 686 | if (activity.windowsCanBeWallpaperTarget()) { |
Evan Rosky | 2289ba1 | 2018-11-19 18:28:18 -0800 | [diff] [blame] | 687 | adjust = true; |
| 688 | break; |
| 689 | } |
| 690 | } |
| 691 | } |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 692 | } |
| 693 | |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 694 | if (adjust) { |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 695 | adjustWallpaperWindows(); |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 696 | } |
| 697 | } |
| 698 | |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 699 | void addWallpaperToken(WallpaperWindowToken token) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 700 | mWallpaperTokens.add(token); |
| 701 | } |
| 702 | |
Jorim Jaggi | 879ff72 | 2016-11-04 18:08:17 -0700 | [diff] [blame] | 703 | void removeWallpaperToken(WallpaperWindowToken token) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 704 | mWallpaperTokens.remove(token); |
| 705 | } |
| 706 | |
Vishnu Nair | e6e2b0f | 2019-02-21 10:41:00 -0800 | [diff] [blame] | 707 | |
| 708 | @VisibleForTesting |
| 709 | boolean canScreenshotWallpaper() { |
| 710 | return canScreenshotWallpaper(getTopVisibleWallpaper()); |
| 711 | } |
| 712 | |
| 713 | private boolean canScreenshotWallpaper(WindowState wallpaperWindowState) { |
| 714 | if (!mService.mPolicy.isScreenOn()) { |
| 715 | if (DEBUG_SCREENSHOT) { |
| 716 | Slog.i(TAG_WM, "Attempted to take screenshot while display was off."); |
| 717 | } |
| 718 | return false; |
| 719 | } |
| 720 | |
| 721 | if (wallpaperWindowState == null) { |
| 722 | if (DEBUG_SCREENSHOT) { |
| 723 | Slog.i(TAG_WM, "No visible wallpaper to screenshot"); |
| 724 | } |
| 725 | return false; |
| 726 | } |
| 727 | return true; |
| 728 | } |
| 729 | |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 730 | /** |
| 731 | * Take a screenshot of the wallpaper if it's visible. |
| 732 | * |
| 733 | * @return Bitmap of the wallpaper |
| 734 | */ |
| 735 | Bitmap screenshotWallpaperLocked() { |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 736 | final WindowState wallpaperWindowState = getTopVisibleWallpaper(); |
Vishnu Nair | e6e2b0f | 2019-02-21 10:41:00 -0800 | [diff] [blame] | 737 | if (!canScreenshotWallpaper(wallpaperWindowState)) { |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 738 | return null; |
| 739 | } |
| 740 | |
| 741 | final Rect bounds = wallpaperWindowState.getBounds(); |
| 742 | bounds.offsetTo(0, 0); |
| 743 | |
Peiyong Lin | e3e5efd | 2019-03-21 20:59:47 +0000 | [diff] [blame] | 744 | SurfaceControl.ScreenshotGraphicBuffer wallpaperBuffer = SurfaceControl.captureLayers( |
Vishnu Nair | bc9beab | 2019-06-25 17:28:58 -0700 | [diff] [blame] | 745 | wallpaperWindowState.getSurfaceControl(), bounds, 1 /* frameScale */); |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 746 | |
| 747 | if (wallpaperBuffer == null) { |
| 748 | Slog.w(TAG_WM, "Failed to screenshot wallpaper"); |
| 749 | return null; |
| 750 | } |
Peiyong Lin | e3e5efd | 2019-03-21 20:59:47 +0000 | [diff] [blame] | 751 | return Bitmap.wrapHardwareBuffer( |
Sunny Goyal | 62915b2 | 2019-04-10 12:28:47 -0700 | [diff] [blame] | 752 | wallpaperBuffer.getGraphicBuffer(), wallpaperBuffer.getColorSpace()); |
chaviw | 0315a1a | 2018-03-05 15:28:35 -0800 | [diff] [blame] | 753 | } |
| 754 | |
| 755 | private WindowState getTopVisibleWallpaper() { |
| 756 | mTmpTopWallpaper = null; |
| 757 | |
| 758 | for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) { |
| 759 | final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx); |
| 760 | token.forAllWindows(w -> { |
| 761 | final WindowStateAnimator winAnim = w.mWinAnimator; |
| 762 | if (winAnim != null && winAnim.getShown() && winAnim.mLastAlpha > 0f) { |
| 763 | mTmpTopWallpaper = w; |
| 764 | return true; |
| 765 | } |
| 766 | return false; |
| 767 | }, true /* traverseTopToBottom */); |
| 768 | } |
| 769 | |
| 770 | return mTmpTopWallpaper; |
| 771 | } |
| 772 | |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 773 | void dump(PrintWriter pw, String prefix) { |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 774 | pw.print(prefix); pw.print("displayId="); pw.println(mDisplayContent.getDisplayId()); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 775 | pw.print(prefix); pw.print("mWallpaperTarget="); pw.println(mWallpaperTarget); |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 776 | if (mPrevWallpaperTarget != null) { |
| 777 | pw.print(prefix); pw.print("mPrevWallpaperTarget="); pw.println(mPrevWallpaperTarget); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 778 | } |
| 779 | pw.print(prefix); pw.print("mLastWallpaperX="); pw.print(mLastWallpaperX); |
| 780 | pw.print(" mLastWallpaperY="); pw.println(mLastWallpaperY); |
| 781 | if (mLastWallpaperDisplayOffsetX != Integer.MIN_VALUE |
| 782 | || mLastWallpaperDisplayOffsetY != Integer.MIN_VALUE) { |
| 783 | pw.print(prefix); |
| 784 | pw.print("mLastWallpaperDisplayOffsetX="); pw.print(mLastWallpaperDisplayOffsetX); |
| 785 | pw.print(" mLastWallpaperDisplayOffsetY="); pw.println(mLastWallpaperDisplayOffsetY); |
| 786 | } |
| 787 | } |
| 788 | |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 789 | /** Helper class for storing the results of a wallpaper target find operation. */ |
| 790 | final private static class FindWallpaperTargetResult { |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 791 | WindowState topWallpaper = null; |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 792 | boolean useTopWallpaperAsTarget = false; |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 793 | WindowState wallpaperTarget = null; |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 794 | boolean resetTopWallpaper = false; |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 795 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 796 | void setTopWallpaper(WindowState win) { |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 797 | topWallpaper = win; |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 798 | } |
| 799 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 800 | void setWallpaperTarget(WindowState win) { |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 801 | wallpaperTarget = win; |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 802 | } |
| 803 | |
| 804 | void setUseTopWallpaperAsTarget(boolean topWallpaperAsTarget) { |
| 805 | useTopWallpaperAsTarget = topWallpaperAsTarget; |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | void reset() { |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 809 | topWallpaper = null; |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 810 | wallpaperTarget = null; |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 811 | useTopWallpaperAsTarget = false; |
| 812 | resetTopWallpaper = false; |
Wale Ogunwale | 5f61d04 | 2015-08-20 10:09:47 -0700 | [diff] [blame] | 813 | } |
| 814 | } |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 815 | } |