From 35230e9ed76de518c7ea46d9277bdc8fa765efd8 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Mon, 7 Jul 2014 16:25:10 -0700 Subject: [PATCH] Update CryptKeeper to use PhoneManager APIS. Change-Id: Ie0ba36ef55869f2d7cfd3e460541c6f3bd08da55 --- src/com/android/settings/CryptKeeper.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java index 151927d9b52..7f159ab3430 100644 --- a/src/com/android/settings/CryptKeeper.java +++ b/src/com/android/settings/CryptKeeper.java @@ -35,6 +35,8 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.os.storage.IMountService; import android.os.storage.StorageManager; + +import android.phone.PhoneManager; import android.provider.Settings; import android.telephony.TelephonyManager; import android.text.Editable; @@ -858,9 +860,8 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList return; } - final int newState = getTelephonyManager().getCallState(); int textId; - if (newState == TelephonyManager.CALL_STATE_OFFHOOK) { + if (getPhoneManager().isInAPhoneCall()) { // Show "return to call" text and show phone icon textId = R.string.cryptkeeper_return_to_call; final int phoneCallIcon = R.drawable.stat_sys_phone_call; @@ -878,9 +879,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList } private void takeEmergencyCallAction() { - TelephonyManager telephonyManager = getTelephonyManager(); - if (telephonyManager.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK) { - telephonyManager.showCallScreen(); + PhoneManager phoneManager = getPhoneManager(); + if (phoneManager.isInAPhoneCall()) { + phoneManager.showCallScreen(false /* showDialpad */); } else { launchEmergencyDialer(); } @@ -899,6 +900,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList return (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); } + private PhoneManager getPhoneManager() { + return (PhoneManager) getSystemService(Context.PHONE_SERVICE); + } + /** * Listen to key events so we can disable sounds when we get a keyinput in EditText. */