From 15fd13470f7922567a1ed1b185ea794e1f4e9c42 Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Fri, 27 May 2022 22:34:52 +0000 Subject: [PATCH 1/2] Give FloatingIconView a copy of, rather than, the original icon. Previously, if a user tapped on the clock icon then rapidly swiped back, the clock icon would stop updating. This fixes that issue by avoiding changes to the original icon's inner callback state while preparing and displaying the FloatingIconView. Bug: 188377749 Test: Locally enabled the second hand on the clock icon in addition to the minute and hour hands, then verified that it was incrementing correctly every second even after tapping then rapidly swiping back on the clock icon. Change-Id: Ib8eddb53de293194e5f9dce2fcafe8a481a6116c --- src/com/android/launcher3/views/FloatingIconView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index babe607ca1..acdd9a19df 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -525,7 +525,7 @@ public class FloatingIconView extends FrameLayout implements & ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) { btvIcon = btv.makePreloadIcon(); } else { - btvIcon = btv.getIcon(); + btvIcon = (FastBitmapDrawable) btv.getIcon().getConstantState().newDrawable(); } } else { btvIcon = null; From 80d36083c2c2d5cb33d37e65669c8a9aa801a344 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 27 May 2022 16:05:34 +0100 Subject: [PATCH 2/2] Avoid DisplayController.currentSize from being stuck at wrong value - Update Info when perDisplayBounds has changed - Add more detailed logging to displayInfo, realBounds and perDisplayBounds - Add perDisplayBounds to dumpsys and replace supportedBounds Bug: 233562339 Test: manual Change-Id: I9a040e8465a8b0a2dcde61bab06c6ca1df3006da --- .../launcher3/util/DisplayController.java | 23 +++++++++++++++---- .../android/launcher3/util/WindowBounds.java | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java index 7c73be51c6..9ed6beef6f 100644 --- a/src/com/android/launcher3/util/DisplayController.java +++ b/src/com/android/launcher3/util/DisplayController.java @@ -55,6 +55,7 @@ import com.android.launcher3.util.window.WindowManagerProxy; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Objects; import java.util.Set; @@ -238,7 +239,8 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable { if (newInfo.navigationMode != oldInfo.navigationMode) { change |= CHANGE_NAVIGATION_MODE; } - if (!newInfo.supportedBounds.equals(oldInfo.supportedBounds)) { + if (!newInfo.supportedBounds.equals(oldInfo.supportedBounds) + || !newInfo.mPerDisplayBounds.equals(oldInfo.mPerDisplayBounds)) { change |= CHANGE_SUPPORTED_BOUNDS; Point currentS = newInfo.currentSize; @@ -261,6 +263,9 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable { return; } } + Log.d("b/198965093", "handleInfoChange" + + "\n\tchange: " + change + + "\n\tConfiguration diff: " + newInfo.mConfiguration.diff(oldInfo.mConfiguration)); if (change != 0) { mInfo = newInfo; @@ -300,6 +305,9 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable { private final ArrayMap> mPerDisplayBounds = new ArrayMap<>(); + // TODO(b/198965093): Remove after investigation + private Configuration mConfiguration; + public Info(Context context, Display display) { /* don't need system overrides for external displays */ this(context, display, new WindowManagerProxy(), new ArrayMap<>()); @@ -321,6 +329,9 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable { mScreenSizeDp = new PortraitSize(config.screenHeightDp, config.screenWidthDp); navigationMode = parseNavigationMode(context); + // TODO(b/198965093): Remove after investigation + mConfiguration = config; + mPerDisplayBounds.putAll(perDisplayBoundsCache); Pair cachedValue = mPerDisplayBounds.get(displayId); @@ -340,8 +351,11 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable { } mPerDisplayBounds.values().forEach( pair -> Collections.addAll(supportedBounds, pair.second)); - Log.d("b/211775278", "displayId: " + displayId + ", currentSize: " + currentSize); - Log.d("b/211775278", "perDisplayBounds: " + mPerDisplayBounds); + Log.e("b/198965093", "mConfiguration: " + mConfiguration); + Log.d("b/198965093", "displayInfo: " + displayInfo); + Log.d("b/198965093", "realBounds: " + realBounds); + mPerDisplayBounds.values().forEach(pair -> Log.d("b/198965093", + "perDisplayBounds - " + pair.first + ": " + Arrays.deepToString(pair.second))); } /** @@ -375,7 +389,8 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable { pw.println(" densityDpi=" + info.densityDpi); pw.println(" navigationMode=" + info.navigationMode.name()); pw.println(" currentSize=" + info.currentSize); - pw.println(" supportedBounds=" + info.supportedBounds); + info.mPerDisplayBounds.values().forEach(pair -> pw.println( + " perDisplayBounds - " + pair.first + ": " + Arrays.deepToString(pair.second))); } /** diff --git a/src/com/android/launcher3/util/WindowBounds.java b/src/com/android/launcher3/util/WindowBounds.java index a15679a822..91480e17c4 100644 --- a/src/com/android/launcher3/util/WindowBounds.java +++ b/src/com/android/launcher3/util/WindowBounds.java @@ -76,6 +76,7 @@ public class WindowBounds { + "bounds=" + bounds + ", insets=" + insets + ", availableSize=" + availableSize + + ", rotationHint=" + rotationHint + '}'; }