summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2010-04-07 00:22:31 -0400
committerDaniel Sandler <dsandler@android.com>2010-04-07 00:23:53 -0400
commit36822c42098a37d30f7f0d810dcb224b84e0630f (patch)
tree68e7bfda7389d8cc203af9e028c9ed31506e7e63
parent876b0644770d1790b21e4049bc7f40851045dc86 (diff)
downloadbase-36822c42098a37d30f7f0d810dcb224b84e0630f.tar.gz
Add emergency call button to PUK'd lockscreen.
The user unlocks a PUK-locked SIM via the e-call dialer, so we absolutely need the button there. This is the code portion; it requires layout from change I8aa0fc2223428ba15a57269ac5a624e74e91a5f3 in frameworks/base. Bug: 2568732 Change-Id: I6872c3ad135bc34348adafa76e08a3878f1b506f
-rw-r--r--phone/com/android/internal/policy/impl/LockScreen.java27
1 files changed, 23 insertions, 4 deletions
diff --git a/phone/com/android/internal/policy/impl/LockScreen.java b/phone/com/android/internal/policy/impl/LockScreen.java
index 381b913..f5fc145 100644
--- a/phone/com/android/internal/policy/impl/LockScreen.java
+++ b/phone/com/android/internal/policy/impl/LockScreen.java
@@ -67,6 +67,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
private TextView mStatus2;
private TextView mScreenLocked;
private TextView mEmergencyCallText;
+ private Button mEmergencyCallButton;
// current configuration state of keyboard and display
private int mKeyboardHidden;
@@ -185,7 +186,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
Log.v(TAG, "Cur orient=" + mCreationOrientation
+ " res orient=" + context.getResources().getConfiguration().orientation);
}
-
+
final LayoutInflater inflater = LayoutInflater.from(context);
if (DBG) Log.v(TAG, "Creation orientation = " + mCreationOrientation);
if (mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE) {
@@ -209,6 +210,16 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
mSelector.setLeftHintText(R.string.lockscreen_unlock_label);
mEmergencyCallText = (TextView) findViewById(R.id.emergencyCallText);
+ mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
+ mEmergencyCallButton.setText(R.string.lockscreen_emergency_call);
+
+ mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
+ mEmergencyCallButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ mCallback.takeEmergencyCallAction();
+ }
+ });
+
setFocusable(true);
setFocusableInTouchMode(true);
@@ -492,6 +503,9 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
private void updateLayout(Status status) {
// The emergency call button no longer appears on this screen.
if (DBG) Log.d(TAG, "updateLayout: status=" + status);
+
+ mEmergencyCallButton.setVisibility(View.GONE); // in almost all cases
+
switch (status) {
case Normal:
// text
@@ -530,6 +544,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
mScreenLocked.setVisibility(View.VISIBLE);
mSelector.setVisibility(View.VISIBLE);
mEmergencyCallText.setVisibility(View.VISIBLE);
+ // do not need to show the e-call button; user may unlock
break;
case SimMissingLocked:
// text
@@ -541,8 +556,9 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
// layout
mScreenLocked.setVisibility(View.VISIBLE);
- mSelector.setVisibility(View.GONE);
+ mSelector.setVisibility(View.GONE); // cannot unlock
mEmergencyCallText.setVisibility(View.VISIBLE);
+ mEmergencyCallButton.setVisibility(View.VISIBLE);
break;
case SimLocked:
// text
@@ -566,8 +582,9 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
// layout
mScreenLocked.setVisibility(View.VISIBLE);
- mSelector.setVisibility(View.GONE);
+ mSelector.setVisibility(View.GONE); // cannot unlock
mEmergencyCallText.setVisibility(View.VISIBLE);
+ mEmergencyCallButton.setVisibility(View.VISIBLE);
break;
}
}
@@ -603,7 +620,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
}
}
}
-
+
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
@@ -640,6 +657,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
/** {@inheritDoc} */
public void onResume() {
resetStatusInfo(mUpdateMonitor);
+ mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
}
/** {@inheritDoc} */
@@ -657,5 +675,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
}
public void onPhoneStateChanged(String newState) {
+ mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
}
}