diff --git a/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java b/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java index c0728e81b37..741e3f9701f 100644 --- a/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java +++ b/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java @@ -2078,17 +2078,17 @@ public static void applyKeyboardHeight(Context context, int height) { */ public static Point getWindowSize(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - WindowMetrics windowMetrics = wm.getCurrentWindowMetrics(); - return new Point( - windowMetrics.getBounds().width(), - windowMetrics.getBounds().height()); - } - - // Deprecated in API 30 - Point size = new Point(0, 0); - wm.getDefaultDisplay().getSize(size); - return size; + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { + // Deprecated in API 30 + Point size = new Point(0, 0); + wm.getDefaultDisplay().getSize(size); + return size; + } + + WindowMetrics windowMetrics = wm.getCurrentWindowMetrics(); + return new Point( + windowMetrics.getBounds().width(), + windowMetrics.getBounds().height()); } public static float getWindowDensity(Context context) {