From 918dcfa0de0bc541afa0d865824d68d4ec07a4fb Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Wed, 19 Nov 2014 16:03:20 -0800 Subject: Fix a couple regressions from resetting AppsCustomizeTabHost Bug 18409435 Bug 18358080 Change-Id: I07a071342b5c5e062ab2bb562b672d93ba0d5c2e --- src/com/android/launcher3/AppsCustomizePagedView.java | 7 ++++++- src/com/android/launcher3/AppsCustomizeTabHost.java | 4 ++++ src/com/android/launcher3/Launcher.java | 5 ++--- src/com/android/launcher3/PagedViewWithDraggableItems.java | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java index 8c6d117ab..044dea0f5 100644 --- a/src/com/android/launcher3/AppsCustomizePagedView.java +++ b/src/com/android/launcher3/AppsCustomizePagedView.java @@ -987,6 +987,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen cancelAllTasks(); } + @Override + public void trimMemory() { + super.trimMemory(); + clearAllWidgetPages(); + } + public void clearAllWidgetPages() { cancelAllTasks(); int count = getChildCount(); @@ -1921,7 +1927,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } public void reset() { - super.reset(); // If we have reset, then we should not continue to restore the previous state mSaveInstanceStateItemIndex = -1; diff --git a/src/com/android/launcher3/AppsCustomizeTabHost.java b/src/com/android/launcher3/AppsCustomizeTabHost.java index 69e3ac17f..a2717126d 100644 --- a/src/com/android/launcher3/AppsCustomizeTabHost.java +++ b/src/com/android/launcher3/AppsCustomizeTabHost.java @@ -118,6 +118,10 @@ public class AppsCustomizeTabHost extends FrameLayout implements LauncherTransit mPagedView.reset(); } + void trimMemory() { + mPagedView.trimMemory(); + } + public void onWindowVisible() { if (getVisibility() == VISIBLE) { mContent.setVisibility(VISIBLE); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 44124f9d9..f98051d05 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -4414,10 +4414,9 @@ public class Launcher extends Activity // 3MB of memory for caching which isn't necessary. SQLiteDatabase.releaseMemory(); - // We reset the apps customize tray in order to - // to free all the memory associated with widget previews + // This clears all widget bitmaps from the widget tray if (mAppsCustomizeTabHost != null) { - mAppsCustomizeTabHost.reset(); + mAppsCustomizeTabHost.trimMemory(); } } } diff --git a/src/com/android/launcher3/PagedViewWithDraggableItems.java b/src/com/android/launcher3/PagedViewWithDraggableItems.java index 7f4a3a032..0e593698d 100644 --- a/src/com/android/launcher3/PagedViewWithDraggableItems.java +++ b/src/com/android/launcher3/PagedViewWithDraggableItems.java @@ -91,7 +91,7 @@ public abstract class PagedViewWithDraggableItems extends PagedView return super.onTouchEvent(ev); } - public void reset() { + public void trimMemory() { mLastTouchedItem = null; } -- cgit v1.2.3