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]: 00d2476d8f
[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
This commit is contained in:
@@ -74,7 +74,7 @@
|
|||||||
android:layout_gravity="center_horizontal|bottom"
|
android:layout_gravity="center_horizontal|bottom"
|
||||||
android:layout_marginBottom="26dp"
|
android:layout_marginBottom="26dp"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:imeOptions="actionNext|flagNoFullscreen"
|
android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
style="@style/TextAppearance.PasswordEntry"/>
|
style="@style/TextAppearance.PasswordEntry"/>
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:imeOptions="actionNext|flagNoExtractUi"
|
android:imeOptions="actionNext|flagNoExtractUi|flagForceAscii"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
style="@style/TextAppearance.PasswordEntry"/>
|
style="@style/TextAppearance.PasswordEntry"/>
|
||||||
|
|
||||||
|
@@ -70,7 +70,7 @@
|
|||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="-40dp"
|
android:layout_marginTop="-40dp"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:imeOptions="actionNext|flagNoFullscreen"
|
android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
style="@style/TextAppearance.PasswordEntry"/>
|
style="@style/TextAppearance.PasswordEntry"/>
|
||||||
|
@@ -67,7 +67,7 @@
|
|||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="-40dp"
|
android:layout_marginTop="-40dp"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:imeOptions="actionNext|flagNoFullscreen"
|
android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
style="@style/TextAppearance.PasswordEntry"/>
|
style="@style/TextAppearance.PasswordEntry"/>
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
android:layout_width="0dip"
|
android:layout_width="0dip"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
|
android:imeOptions="flagForceAscii"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="10sp"
|
android:padding="10sp"
|
||||||
android:maxLength="500"
|
android:maxLength="500"
|
||||||
|
Reference in New Issue
Block a user