Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2a7bddb authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Set flagForceAscii for device password entries

Since the beginning [1], ChooseLockPassword#validatePassword() has never
accepted non-ASCII characters [2].  Hence we can safely specify
EditorInfo#IME_FLAG_FORCE_ASCII so that IMEs can optimize their UX based
on this flag.  Note that EditorInfo#IME_FLAG_FORCE_ASCII is just a hint
for the IME so there should be no behavior change in the system side.

Note also that EditorInfo#IME_FLAG_FORCE_ASCII has been used in KeyGuard
(keyguard_password_view.xml) since JB MR-1 [3] so this flag is considered
to be well tested.

 [1]: 00d2476d
 [2]: Only character c where 32 <= c <= 126 is accepted
 [3]: Id75286113771ca1407e9db182172b580f870b612

Test: Run `adb shell dumpsys input_method` when the password entry
      field is focused to make sure that 'imeOptions' parameter
      has 0x80000000 bit. Tested the following scenarios:
       - PIN on a direct-boot disabled device
       - PIN on a direct-boot enabled device
       - Password on a direct-boot disabled device
       - Password on a direct-boot enabled device
Fixes: 27858858
Change-Id: I3075e24c6dac4d49f4d0e56a0d4d8434a323754d
parent c79681d8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@
                android:layout_gravity="center_horizontal|bottom"
                android:layout_marginBottom="26dp"
                android:inputType="textPassword"
                android:imeOptions="actionNext|flagNoFullscreen"
                android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
                android:gravity="center"
                android:textSize="16sp"
                style="@style/TextAppearance.PasswordEntry"/>
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
            android:layout_gravity="center"
            android:gravity="center"
            android:inputType="textPassword"
            android:imeOptions="actionNext|flagNoExtractUi"
            android:imeOptions="actionNext|flagNoExtractUi|flagForceAscii"
            android:textSize="24sp"
            style="@style/TextAppearance.PasswordEntry"/>

+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="-40dp"
            android:inputType="textPassword"
            android:imeOptions="actionNext|flagNoFullscreen"
            android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
            android:gravity="center"
            android:textSize="16sp"
            style="@style/TextAppearance.PasswordEntry"/>
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="-40dp"
            android:inputType="textPassword"
            android:imeOptions="actionNext|flagNoFullscreen"
            android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
            android:gravity="center"
            android:textSize="16sp"
            style="@style/TextAppearance.PasswordEntry"/>
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
        android:layout_width="0dip"
        android:layout_weight="1"
        android:inputType="textPassword"
        android:imeOptions="flagForceAscii"
        android:textSize="16sp"
        android:padding="10sp"
        android:maxLength="500"