Fix a couple regressions from resetting AppsCustomizeTabHost

Bug 18409435
Bug 18358080

Change-Id: I07a071342b5c5e062ab2bb562b672d93ba0d5c2e
This commit is contained in:
Adam Cohen
2014-11-19 16:03:20 -08:00
parent 08072c05bf
commit c8f4e1bc88
4 changed files with 13 additions and 6 deletions
@@ -839,6 +839,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
cancelAllTasks(); cancelAllTasks();
} }
@Override
public void trimMemory() {
super.trimMemory();
clearAllWidgetPages();
}
public void clearAllWidgetPages() { public void clearAllWidgetPages() {
cancelAllTasks(); cancelAllTasks();
int count = getChildCount(); int count = getChildCount();
@@ -1472,9 +1478,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
} }
} }
@Override
public void reset() { public void reset() {
super.reset();
// If we have reset, then we should not continue to restore the previous state // If we have reset, then we should not continue to restore the previous state
mSaveInstanceStateItemIndex = -1; mSaveInstanceStateItemIndex = -1;
@@ -118,6 +118,10 @@ public class AppsCustomizeTabHost extends FrameLayout implements LauncherTransit
mPagedView.reset(); mPagedView.reset();
} }
void trimMemory() {
mPagedView.trimMemory();
}
public void onWindowVisible() { public void onWindowVisible() {
if (getVisibility() == VISIBLE) { if (getVisibility() == VISIBLE) {
mContent.setVisibility(VISIBLE); mContent.setVisibility(VISIBLE);
+2 -3
View File
@@ -3815,10 +3815,9 @@ public class Launcher extends Activity
// 3MB of memory for caching which isn't necessary. // 3MB of memory for caching which isn't necessary.
SQLiteDatabase.releaseMemory(); SQLiteDatabase.releaseMemory();
// We reset the apps customize tray in order to // This clears all widget bitmaps from the widget tray
// to free all the memory associated with widget previews
if (mAppsCustomizeTabHost != null) { if (mAppsCustomizeTabHost != null) {
mAppsCustomizeTabHost.reset(); mAppsCustomizeTabHost.trimMemory();
} }
} }
} }
@@ -91,7 +91,7 @@ public abstract class PagedViewWithDraggableItems extends PagedView
return super.onTouchEvent(ev); return super.onTouchEvent(ev);
} }
public void reset() { public void trimMemory() {
mLastTouchedItem = null; mLastTouchedItem = null;
} }