From 72745fffe8d43b12ebb753b562191e319e5c1cda Mon Sep 17 00:00:00 2001 From: Seonggoo Kang Date: Wed, 24 Dec 2014 13:55:50 +0900 Subject: Prevent duplicated registration of OnComputeInternalInsetsListener OnComputeInternalInsetsListener is added when initViews is called, and initViews is called by onCreate and onConfigurationChanged. But it is removed only by onDestroy. Therefore listeners are accumulated and it results performance issue. So before adding, remove mInsetListener that was previously added. Change-Id: I494d3f1875613d73d3f9b8e2af286b5800f03196 --- core/java/android/inputmethodservice/InputMethodService.java | 1 + 1 file changed, 1 insertion(+) (limited to 'core/java/android/inputmethodservice/InputMethodService.java') diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 2eb42a71831e..f218b65306e1 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -708,6 +708,7 @@ public class InputMethodService extends AbstractInputMethodService { mRootView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); mWindow.setContentView(mRootView); + mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(mInsetsComputer); mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer); if (Settings.Global.getInt(getContentResolver(), Settings.Global.FANCY_IME_ANIMATIONS, 0) != 0) { -- cgit v1.2.3