Merge "Deallocate gesture trail bitmap when unneeded"

main
Ken Wakasa 2013-07-31 11:46:25 +00:00 committed by Android (Google) Code Review
commit 883bd364eb
3 changed files with 10 additions and 0 deletions

View File

@ -1370,4 +1370,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
drawIcon(canvas, mSpaceIcon, x, y, iconWidth, iconHeight);
}
}
public void deallocateMemory() {
mGestureTrailsPreview.deallocateMemory();
}
}

View File

@ -104,7 +104,12 @@ public final class GestureTrailsPreview extends AbstractDrawingPreview {
freeOffscreenBuffer();
}
public void deallocateMemory() {
freeOffscreenBuffer();
}
private void freeOffscreenBuffer() {
mOffscreenCanvas.setBitmap(null);
if (mOffscreenBuffer != null) {
mOffscreenBuffer.recycle();
mOffscreenBuffer = null;

View File

@ -894,6 +894,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
if (mainKeyboardView != null) {
mainKeyboardView.cancelAllOngoingEvents();
mainKeyboardView.deallocateMemory();
}
// Remove pending messages related to update suggestions
mHandler.cancelUpdateSuggestionStrip();