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

View File

@ -839,6 +839,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
cancelAllTasks();
}
@Override
public void trimMemory() {
super.trimMemory();
clearAllWidgetPages();
}
public void clearAllWidgetPages() {
cancelAllTasks();
int count = getChildCount();
@ -1472,9 +1478,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
@Override
public void reset() {
super.reset();
// If we have reset, then we should not continue to restore the previous state
mSaveInstanceStateItemIndex = -1;

View File

@ -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);

View File

@ -3815,10 +3815,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();
}
}
}

View File

@ -91,7 +91,7 @@ public abstract class PagedViewWithDraggableItems extends PagedView
return super.onTouchEvent(ev);
}
public void reset() {
public void trimMemory() {
mLastTouchedItem = null;
}