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
39 lines
1.5 KiB
XML
39 lines
1.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!--
|
|
**
|
|
** Copyright 2014, The Android Open Source Project
|
|
**
|
|
** Licensed under the Apache License, Version 2.0 (the "License")
|
|
** you may not use this file except in compliance with the License.
|
|
** You may obtain a copy of the License at
|
|
**
|
|
** http://www.apache.org/licenses/LICENSE-2.0
|
|
**
|
|
** Unless required by applicable law or agreed to in writing, software
|
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
** See the License for the specific language governing permissions and
|
|
** limitations under the License.
|
|
*/
|
|
-->
|
|
|
|
<!-- Contents of the password entry field for CryptKeeper. Comes with an IME
|
|
switcher, if necessary. Assumed to be in a horizontal LinearLayout. -->
|
|
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
|
|
|
<!-- Note that crypt_keeper_pin_field.xml also has ImeAwareEditText with the same ID. -->
|
|
<com.android.settings.widget.ImeAwareEditText android:id="@+id/passwordEntry"
|
|
android:layout_height="wrap_content"
|
|
android:layout_width="0dip"
|
|
android:layout_weight="1"
|
|
android:inputType="textPassword"
|
|
android:imeOptions="flagForceAscii"
|
|
android:textSize="16sp"
|
|
android:padding="10sp"
|
|
android:maxLength="500"
|
|
style="@style/TextAppearance.CryptKeeper_PasswordEntry" />
|
|
|
|
<include layout="@layout/crypt_keeper_switch_input_method" />
|
|
|
|
</merge>
|