diff --git a/app/src/main/java/io/github/sspanak/tt9/hacks/DeviceInfo.java b/app/src/main/java/io/github/sspanak/tt9/hacks/DeviceInfo.java index 831a5c4b..8328a725 100644 --- a/app/src/main/java/io/github/sspanak/tt9/hacks/DeviceInfo.java +++ b/app/src/main/java/io/github/sspanak/tt9/hacks/DeviceInfo.java @@ -10,11 +10,17 @@ import android.view.KeyEvent; import androidx.annotation.NonNull; public class DeviceInfo { - private static Boolean isRobo = null; - public static boolean noKeyboard(Context context) { + // all Xiaomi phones are only touchscreen, but some of them report they have a keyboard + // See: https://github.com/sspanak/tt9/issues/549 + if (DeviceInfo.isXiaomi()) { + return true; + } + + Configuration configuration = context.getResources().getConfiguration(); + return - context.getResources().getConfiguration().keyboard == Configuration.KEYBOARD_NOKEYS + (configuration.keyboard == Configuration.KEYBOARD_NOKEYS || configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) && !KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_STAR) && !KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POUND); } @@ -43,6 +49,10 @@ public class DeviceInfo { return isSonim() && Build.VERSION.SDK_INT == Build.VERSION_CODES.R && noTouchScreen(context); } + public static boolean isXiaomi() { + return Build.MANUFACTURER.equals("Xiaomi"); + } + @NonNull @Override public String toString() { diff --git a/app/src/main/java/io/github/sspanak/tt9/hacks/InputType.java b/app/src/main/java/io/github/sspanak/tt9/hacks/InputType.java index 1e37c5c6..d096e290 100644 --- a/app/src/main/java/io/github/sspanak/tt9/hacks/InputType.java +++ b/app/src/main/java/io/github/sspanak/tt9/hacks/InputType.java @@ -42,6 +42,7 @@ public class InputType extends StandardInputType { public boolean isDumbPhoneDialer(Context context) { + // the inputType is not always TYPE_CLASS_PHONE on all devices, so we must not filter by that. return field.packageName.endsWith(".dialer") && !DeviceInfo.noKeyboard(context); } @@ -133,8 +134,10 @@ public class InputType extends StandardInputType { * the initial GitHub issue about Qin F21 Pro+ * the PR about calculators * Dialer not detected correctly on LG X100S - * [NO ISSUE] On touchscreen-only phones, in the Dialer app, we can't switch to passthrough, because + * [NO ISSUE] On touchscreen-only phones, in the Dialer app, we mustn't switch to passthrough, because * they don't have a physical keyboard. + * Beeps on CAT S22 Flip + * The UI does not appear on Xiaomi Redmi 12c */ protected boolean isSpecialNumeric(Context context) { return