Skip to content

Commit 3efe106

Browse files
author
Jim Miller
committed
Clean up SIM PIN and PUK screens in keyguard.
- new flow for PUK screen - clean up SIM and PUK screen to match UX designs - simplified logic for showing emergency call button Change-Id: I66fcd312f3c52dd212d9836dc020735dbc88d5ee
1 parent 29dcd65 commit 3efe106

File tree

9 files changed

+189
-198
lines changed

9 files changed

+189
-198
lines changed

core/res/res/layout/keyguard_navigation.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
33
**
4-
** Copyright 2008, The Android Open Source Project
4+
** Copyright 2012, The Android Open Source Project
55
**
66
** Licensed under the Apache License, Version 2.0 (the "License")
77
** you may not use this file except in compliance with the License.

core/res/res/layout/keyguard_password_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
<ImageButton android:id="@+id/delete_button"
6868
android:layout_width="wrap_content"
6969
android:layout_height="wrap_content"
70+
android:layout_gravity="center_vertical"
7071
android:src="@*android:drawable/ic_input_delete"
7172
android:clickable="true"
7273
android:padding="8dip"
73-
android:layout_gravity="center_vertical"
7474
android:background="?android:attr/selectableItemBackground"
7575
android:visibility="gone"
7676
/>

core/res/res/layout/keyguard_sim_pin_view.xml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
android:layout_marginEnd="4dip"
5252
android:layout_marginStart="4dip"
5353
android:gravity="center_vertical"
54-
android:background="@android:drawable/edit_text">
54+
android:background="#70000000">
5555

5656
<!-- displays dots as user enters pin -->
5757
<EditText android:id="@+id/sim_pin_entry"
@@ -60,19 +60,26 @@
6060
android:layout_weight="1"
6161
android:maxLines="1"
6262
android:singleLine="true"
63-
android:textAppearance="?android:attr/textAppearanceLargeInverse"
64-
android:textColor="@*android:color/primary_text_holo_light"
65-
android:textStyle="bold"
63+
android:gravity="center_horizontal"
64+
android:layout_gravity="center_vertical"
65+
android:layout_marginStart="@*android:dimen/keyguard_lockscreen_pin_margin_left"
66+
android:textStyle="normal"
6667
android:inputType="textPassword"
68+
android:textSize="36sp"
69+
android:background="@null"
70+
android:textAppearance="?android:attr/textAppearanceMedium"
71+
android:textColor="#ffffffff"
6772
android:imeOptions="flagForceAscii|actionDone"
6873
/>
6974

7075
<ImageButton android:id="@+id/delete_button"
71-
android:src="@android:drawable/ic_input_delete"
7276
android:layout_width="wrap_content"
7377
android:layout_height="wrap_content"
74-
android:layout_marginEnd="-3dip"
75-
android:layout_marginBottom="-3dip"
78+
android:layout_gravity="center_vertical"
79+
android:src="@android:drawable/ic_input_delete"
80+
android:clickable="true"
81+
android:padding="8dip"
82+
android:background="?android:attr/selectableItemBackground"
7683
/>
7784
</LinearLayout>
7885

core/res/res/layout/keyguard_sim_puk_view.xml

Lines changed: 58 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
** limitations under the License.
1717
*/
1818
-->
19+
<!-- This is the SIM PUK view that allows the user to recover their device by entering the
20+
carrier-provided PUK code and entering a new SIM PIN for it. -->
1921
<com.android.internal.policy.impl.keyguard.KeyguardSimPukView
2022
xmlns:android="http://schemas.android.com/apk/res/android"
2123
android:id="@+id/keyguard_sim_puk_view"
@@ -24,98 +26,62 @@
2426
android:orientation="vertical"
2527
android:gravity="center_horizontal">
2628

27-
<include layout="@layout/keyguard_navigation"/>
28-
29-
<Space
30-
android:layout_width="match_parent"
29+
<LinearLayout
3130
android:layout_height="0dip"
32-
android:layout_weight="1"/>
33-
34-
<LinearLayout android:id="@+id/topDisplayGroup"
3531
android:layout_width="match_parent"
36-
android:layout_height="wrap_content"
37-
android:orientation="vertical">
38-
39-
<LinearLayout
40-
android:orientation="horizontal"
41-
android:layout_width="match_parent"
42-
android:layout_height="wrap_content">
43-
44-
<LinearLayout
45-
android:orientation="vertical"
46-
android:layout_width="wrap_content"
47-
android:layout_weight="1"
48-
android:layout_height="match_parent"
49-
android:paddingEnd="0dip"
50-
android:layout_marginEnd="10dip"
51-
android:layout_marginStart="10dip">
52-
53-
<LinearLayout
54-
android:layout_width="match_parent"
55-
android:layout_height="wrap_content"
56-
android:orientation="horizontal"
57-
android:layout_marginEnd="6dip"
58-
android:layout_marginStart="6dip"
59-
android:gravity="center_vertical"
60-
android:background="@*android:drawable/edit_text">
61-
62-
<!-- displays dots as user enters puk -->
63-
<EditText android:id="@+id/sim_puk_entry"
64-
android:layout_width="0dip"
65-
android:layout_height="wrap_content"
66-
android:layout_weight="1"
67-
android:maxLines="1"
68-
android:textStyle="bold"
69-
android:inputType="textPassword"
70-
android:textColor="#000"
71-
android:hint="@string/kg_puk_enter_puk_hint"
72-
/>
73-
74-
<ImageButton android:id="@+id/puk_delete_button"
75-
android:src="@*android:drawable/ic_input_delete"
76-
android:layout_width="wrap_content"
77-
android:layout_height="wrap_content"
78-
android:layout_marginEnd="-3dip"
79-
android:layout_marginBottom="-3dip"
80-
/>
81-
82-
</LinearLayout>
32+
android:layout_weight="1"
33+
android:orientation="vertical"
34+
android:gravity="center">
8335

36+
<ImageView
37+
android:layout_width="wrap_content"
38+
android:layout_height="wrap_content"
39+
android:src="@drawable/ic_lockscreen_sim"/>
8440

85-
<LinearLayout
86-
android:layout_width="match_parent"
87-
android:layout_height="wrap_content"
88-
android:orientation="horizontal"
89-
android:layout_marginEnd="6dip"
90-
android:layout_marginStart="6dip"
91-
android:gravity="center_vertical"
92-
android:background="@*android:drawable/edit_text">
41+
<include layout="@layout/keyguard_navigation"/>
9342

94-
<!-- displays dots as user enters new pin -->
95-
<EditText android:id="@+id/sim_pin_entry"
96-
android:layout_width="0dip"
97-
android:layout_height="wrap_content"
98-
android:layout_weight="1"
99-
android:maxLines="1"
100-
android:textStyle="bold"
101-
android:inputType="textPassword"
102-
android:textColor="#000"
103-
android:hint="@string/kg_puk_enter_pin_hint"
104-
/>
105-
106-
<ImageButton android:id="@+id/pin_delete_button"
107-
android:src="@*android:drawable/ic_input_delete"
108-
android:layout_width="wrap_content"
109-
android:layout_height="wrap_content"
110-
android:layout_marginEnd="-3dip"
111-
android:layout_marginBottom="-3dip"
112-
/>
113-
</LinearLayout>
114-
115-
</LinearLayout>
116-
117-
</LinearLayout>
43+
</LinearLayout>
11844

45+
<!-- Password entry field -->
46+
<!-- Note: the entire container is styled to look like the edit field,
47+
since the backspace/IME switcher looks better inside -->
48+
<LinearLayout
49+
android:layout_width="match_parent"
50+
android:layout_height="wrap_content"
51+
android:orientation="horizontal"
52+
android:layout_marginEnd="4dip"
53+
android:layout_marginStart="4dip"
54+
android:gravity="center_vertical"
55+
android:background="#70000000">
56+
57+
<!-- displays dots as user enters pin -->
58+
<EditText android:id="@+id/sim_pin_entry"
59+
android:layout_width="0dip"
60+
android:layout_height="wrap_content"
61+
android:layout_weight="1"
62+
android:maxLines="1"
63+
android:singleLine="true"
64+
android:gravity="center_horizontal"
65+
android:layout_gravity="center_vertical"
66+
android:layout_marginStart="@*android:dimen/keyguard_lockscreen_pin_margin_left"
67+
android:textStyle="normal"
68+
android:inputType="textPassword"
69+
android:textSize="36sp"
70+
android:background="@null"
71+
android:textAppearance="?android:attr/textAppearanceMedium"
72+
android:textColor="#ffffffff"
73+
android:imeOptions="flagForceAscii|actionDone"
74+
/>
75+
76+
<ImageButton android:id="@+id/delete_button"
77+
android:layout_width="wrap_content"
78+
android:layout_height="wrap_content"
79+
android:layout_gravity="center_vertical"
80+
android:src="@android:drawable/ic_input_delete"
81+
android:clickable="true"
82+
android:padding="8dip"
83+
android:background="?android:attr/selectableItemBackground"
84+
/>
11985
</LinearLayout>
12086

12187
<!-- Numeric keyboard -->
@@ -125,9 +91,14 @@
12591
android:layout_marginEnd="4dip"
12692
android:paddingTop="4dip"
12793
android:paddingBottom="4dip"
128-
android:background="#80ffffff"
94+
android:background="#40000000"
12995
android:keyBackground="@*android:drawable/btn_keyboard_key_ics"
13096
android:clickable="true"
13197
/>
13298

99+
<Space
100+
android:layout_width="match_parent"
101+
android:layout_height="@dimen/kg_secure_padding_height"
102+
android:background="@drawable/lockscreen_protection_pattern" />
103+
133104
</com.android.internal.policy.impl.keyguard.KeyguardSimPukView>

core/res/res/values/strings.xml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3830,22 +3830,24 @@
38303830
<string name="kg_pin_instructions">Enter PIN</string>
38313831
<!-- Instructions for using the password unlock screen -->
38323832
<string name="kg_password_instructions">Enter Password</string>
3833-
<!-- Hint shown in the PUK unlock screen PUK TextView -->
3834-
<string name="kg_puk_enter_puk_hint">PUK code</string>
3833+
<!-- Hint shown in the PUK screen that asks the user to enter the PUK code given to them by their provider -->
3834+
<string name="kg_puk_enter_puk_hint">SIM is now disabled. Enter PUK code to continue. Contact carrier for details.</string>
38353835
<!-- Hint shown in the PUK unlock screen PIN TextView -->
3836-
<string name="kg_puk_enter_pin_hint">New PIN code</string>
3836+
<string name="kg_puk_enter_pin_hint">Enter desired PIN code</string>
3837+
<!-- Message shown when the user needs to confirm the PIN they just entered in the PUK screen -->
3838+
<string name="kg_enter_confirm_pin_hint">Confirm desired PIN code</string>
38373839
<!-- Message shown in dialog while the device is unlocking the SIM card -->
38383840
<string name="kg_sim_unlock_progress_dialog_message">Unlocking SIM card\u2026</string>
38393841
<!-- Message shown when the user enters the wrong PIN code -->
38403842
<string name="kg_password_wrong_pin_code">Incorrect PIN code.</string>
38413843
<!-- Message shown when the user enters an invalid SIM pin password in PUK screen -->
38423844
<string name="kg_invalid_sim_pin_hint">Type a PIN that is 4 to 8 numbers.</string>
38433845
<!-- Message shown when the user enters an invalid PUK code in the PUK screen -->
3844-
<string name="kg_invalid_sim_puk_hint">Type a PUK that is 8 numbers or longer.</string>
3845-
<!-- Instructions for PUK unlock screen -->
3846-
<string name="kg_sim_puk_recovery_hint">Type PUK and new PIN code</string>
3846+
<string name="kg_invalid_sim_puk_hint">PUK code should be 8 numbers or more.</string>
38473847
<!-- Message shown when the user enters an invalid PUK code -->
3848-
<string name="kg_invalid_puk">The PUK you typed isn\'t correct.</string>
3848+
<string name="kg_invalid_puk">Re-enter the correct PUK code. Repeated attempts will permanently disable the SIM.</string>
3849+
<!-- String shown in PUK screen when PIN codes don't match -->
3850+
<string name="kg_invalid_confirm_pin_hint" product="default">PIN codes does not match</string>
38493851
<!-- Message shown when the user exceeds the maximum number of pattern attempts -->
38503852
<string name="kg_login_too_many_attempts">Too many pattern attempts</string>
38513853
<!-- Instructions show in account unlock screen allowing user to enter their email password -->
@@ -3861,7 +3863,7 @@
38613863
<!-- Hint text shown when user has too many failed password attempts in account unlock screen of keyguard -->
38623864
<string name="kg_login_account_recovery_hint">Forgot your username or password\?\nVisit <b>google.com/accounts/recovery</b>.</string>
38633865
<!-- Message shown while device checks username/password in account unlock screen of keyguard -->
3864-
<string name="kg_login_checking_password">Checking\u2026</string>
3866+
<string name="kg_login_checking_password">Unlocking SIM\u2026</string>
38653867
<!-- Message shown in dialog when max number of attempts are reached for PIN screen of keyguard -->
38663868
<string name="kg_too_many_failed_pin_attempts_dialog_message">
38673869
You have incorrectly typed your PIN <xliff:g id="number">%d</xliff:g> times.

core/res/res/values/symbols.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,10 +1274,7 @@
12741274
<java-symbol type="id" name="glow_pad_view" />
12751275
<java-symbol type="id" name="sim_pin_entry" />
12761276
<java-symbol type="id" name="delete_button" />
1277-
<java-symbol type="id" name="sim_puk_entry" />
12781277
<java-symbol type="id" name="sim_pin_entry" />
1279-
<java-symbol type="id" name="puk_delete_button" />
1280-
<java-symbol type="id" name="pin_delete_button" />
12811278
<java-symbol type="id" name="keyguard_user_avatar" />
12821279
<java-symbol type="id" name="keyguard_user_name" />
12831280
<java-symbol type="id" name="keyguard_transport_control" />
@@ -1408,6 +1405,8 @@
14081405
<java-symbol type="string" name="kg_failed_attempts_almost_at_wipe" />
14091406
<java-symbol type="string" name="kg_failed_attempts_now_wiping" />
14101407
<java-symbol type="string" name="kg_failed_attempts_almost_at_login" />
1408+
<java-symbol type="string" name="kg_enter_confirm_pin_hint" />
1409+
<java-symbol type="string" name="kg_invalid_confirm_pin_hint" />
14111410

14121411
<!-- From services -->
14131412
<java-symbol type="anim" name="screen_rotate_0_enter" />

policy/src/com/android/internal/policy/impl/keyguard/EmergencyButton.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,19 @@ public void takeEmergencyCallAction() {
9898
}
9999

100100
private void updateEmergencyCallButton(State simState, int phoneState) {
101-
boolean enabled = mLockPatternUtils.isEmergencyCallCapable()
102-
|| (phoneState == TelephonyManager.CALL_STATE_OFFHOOK); // voice call in progress
103-
if (enabled && KeyguardUpdateMonitor.isSimLocked(simState)) {
104-
// Some countries can't handle emergency calls while SIM is locked.
105-
enabled = mLockPatternUtils.isEmergencyCallEnabledWhileSimLocked();
101+
boolean enabled = false;
102+
if (phoneState == TelephonyManager.CALL_STATE_OFFHOOK) {
103+
enabled = true; // always show "return to call" if phone is off-hook
104+
} else if (mLockPatternUtils.isEmergencyCallCapable()) {
105+
boolean simLocked = KeyguardUpdateMonitor.getInstance(mContext).isSimLocked();
106+
if (simLocked) {
107+
// Some countries can't handle emergency calls while SIM is locked.
108+
enabled = mLockPatternUtils.isEmergencyCallEnabledWhileSimLocked();
109+
} else {
110+
// True if we need to show a secure screen (pin/pattern/SIM pin/SIM puk);
111+
// hides emergency button on "Slide" screen if device is not secure.
112+
enabled = mLockPatternUtils.isSecure();
113+
}
106114
}
107115
mLockPatternUtils.updateEmergencyCallButtonState(this, phoneState, enabled,
108116
KeyguardViewManager.USE_UPPER_CASE, false);

0 commit comments

Comments
 (0)