Fix a couple regressions from resetting AppsCustomizeTabHost
Bug 18409435
Bug 18358080
Change-Id: I07a071342b5c5e062ab2bb562b672d93ba0d5c2e
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 8aa013f..c8187f0 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -839,6 +839,12 @@
cancelAllTasks();
}
+ @Override
+ public void trimMemory() {
+ super.trimMemory();
+ clearAllWidgetPages();
+ }
+
public void clearAllWidgetPages() {
cancelAllTasks();
int count = getChildCount();
@@ -1472,9 +1478,7 @@
}
}
- @Override
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 69e3ac1..a271712 100644
--- a/src/com/android/launcher3/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher3/AppsCustomizeTabHost.java
@@ -118,6 +118,10 @@
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 0d1d3ef..ac46fd3 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3815,10 +3815,9 @@
// 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 7f4a3a0..0e59369 100644
--- a/src/com/android/launcher3/PagedViewWithDraggableItems.java
+++ b/src/com/android/launcher3/PagedViewWithDraggableItems.java
@@ -91,7 +91,7 @@
return super.onTouchEvent(ev);
}
- public void reset() {
+ public void trimMemory() {
mLastTouchedItem = null;
}