diff options
author | Jim Miller <jaggies@google.com> | 2010-02-24 15:35:05 -0800 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2010-02-25 20:07:56 -0800 |
commit | 69ac9887459a65a0eebc6f9c450a5b6c2313d713 (patch) | |
tree | a32ef554b58765fde9d649aacbdf1d38a9e23790 /core | |
parent | 277903f8d853297a1d22ea07e27e04d6534bc430 (diff) | |
download | frameworks_base-69ac9887459a65a0eebc6f9c450a5b6c2313d713.zip frameworks_base-69ac9887459a65a0eebc6f9c450a5b6c2313d713.tar.gz frameworks_base-69ac9887459a65a0eebc6f9c450a5b6c2313d713.tar.bz2 |
Fix 2336057: Provide a way for the user to return to a call from LockScreen.
This makes the "Emergency call" button dual-purpose. If there's a call in progress,
the button will show "Return to call" and take the user back to the call.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/widget/LockPatternUtils.java | 46 | ||||
-rw-r--r-- | core/res/res/values/strings.xml | 2 |
2 files changed, 47 insertions, 1 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 9713c27..1956b4e 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -17,15 +17,20 @@ package com.android.internal.widget; import android.app.DevicePolicyManager; -import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; +import android.os.RemoteException; +import android.os.ServiceManager; import android.os.SystemClock; import android.provider.Settings; import android.security.MessageDigest; +import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; +import android.widget.Button; +import com.android.internal.R; +import com.android.internal.telephony.ITelephony; import com.google.android.collect.Lists; import java.io.FileNotFoundException; @@ -675,4 +680,43 @@ public class LockPatternUtils { || (mode == MODE_PIN || mode == MODE_PASSWORD) && savedPasswordExists(); return secure; } + + /** + * Sets the text on the emergency button to indicate what action will be taken. + * If there's currently a call in progress, the button will take them to the call + * @param button the button to update + */ + public void updateEmergencyCallButtonState(Button button) { + int newState = TelephonyManager.getDefault().getCallState(); + int textId; + if (newState == TelephonyManager.CALL_STATE_OFFHOOK) { + // show "return to call" text and show phone icon + textId = R.string.lockscreen_return_to_call; + int phoneCallIcon = R.drawable.stat_sys_phone_call; + button.setCompoundDrawablesWithIntrinsicBounds(phoneCallIcon, 0, 0, 0); + } else { + textId = R.string.lockscreen_emergency_call; + int emergencyIcon = R.drawable.ic_emergency; + button.setCompoundDrawablesWithIntrinsicBounds(emergencyIcon, 0, 0, 0); + } + button.setText(textId); + } + + /** + * Resumes a call in progress. Typically launched from the EmergencyCall button + * on various lockscreens. + * + * @return true if we were able to tell InCallScreen to show. + */ + public boolean resumeCall() { + ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); + try { + if (phone != null && phone.showCallScreen()) { + return true; + } + } catch (RemoteException e) { + // What can we do? + } + return false; + } } diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 5d2d272..b791bf8 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1441,6 +1441,8 @@ <string name="lockscreen_pattern_instructions">Draw pattern to unlock</string> <!-- Button at the bottom of the unlock screen to make an emergency call. --> <string name="lockscreen_emergency_call">Emergency call</string> + <!-- Button at the bottom of the unlock screen that lets the user return to a call --> + <string name="lockscreen_return_to_call">Return to call</string> <!-- Shown to confirm that the user entered their lock pattern correctly. --> <string name="lockscreen_pattern_correct">Correct!</string> <!-- On the unlock pattern screen, shown when the user enters the wrong lock pattern and must try again. --> |