summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorCharles Chen <charlesccchen@google.com>2020-02-13 16:41:32 +0800
committerCharles Chen <charlesccchen@google.com>2020-05-04 11:41:13 +0800
commit49f329ca66e3cf06a8c6086b77333c68fef5cf5b (patch)
treee0f253b3b905055bd548bd8490669f667113f990 /core/java/android/inputmethodservice/InputMethodService.java
parentd827ec8bbd33aec9435575ce55776766e746cdf9 (diff)
Add WindowMetricsHelper
This metrics now is used for calculating the value reported by Display#getSize. It could be extended to have more function later. Also replace getCurrentMetrics usages to make them report Display#getSize value. Bug: 148904274 Test: atest WindowMetricsHelperTest Change-Id: I182b6e63f7c28752eee22839cb9e69f073046c3f
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index d3464fde4b75..d8b1f41c86d5 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -90,6 +90,7 @@ import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
+import android.window.WindowMetricsHelper;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.inputmethod.IInputContentUriToken;
@@ -1438,8 +1439,8 @@ public class InputMethodService extends AbstractInputMethodService {
*/
public int getMaxWidth() {
final WindowManager windowManager = getSystemService(WindowManager.class);
- final Rect windowBounds = windowManager.getCurrentWindowMetrics().getBounds();
- return windowBounds.width();
+ return WindowMetricsHelper.getBoundsExcludingNavigationBarAndCutout(
+ windowManager.getCurrentWindowMetrics()).width();
}
/**