Update CryptKeeper to use PhoneManager APIS.

Change-Id: Ie0ba36ef55869f2d7cfd3e460541c6f3bd08da55
This commit is contained in:
Santos Cordon
2014-07-07 16:25:10 -07:00
parent e6d52157fa
commit 35230e9ed7

View File

@@ -35,6 +35,8 @@ import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.storage.IMountService; import android.os.storage.IMountService;
import android.os.storage.StorageManager; import android.os.storage.StorageManager;
import android.phone.PhoneManager;
import android.provider.Settings; import android.provider.Settings;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.Editable; import android.text.Editable;
@@ -858,9 +860,8 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
return; return;
} }
final int newState = getTelephonyManager().getCallState();
int textId; int textId;
if (newState == TelephonyManager.CALL_STATE_OFFHOOK) { if (getPhoneManager().isInAPhoneCall()) {
// Show "return to call" text and show phone icon // Show "return to call" text and show phone icon
textId = R.string.cryptkeeper_return_to_call; textId = R.string.cryptkeeper_return_to_call;
final int phoneCallIcon = R.drawable.stat_sys_phone_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() { private void takeEmergencyCallAction() {
TelephonyManager telephonyManager = getTelephonyManager(); PhoneManager phoneManager = getPhoneManager();
if (telephonyManager.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK) { if (phoneManager.isInAPhoneCall()) {
telephonyManager.showCallScreen(); phoneManager.showCallScreen(false /* showDialpad */);
} else { } else {
launchEmergencyDialer(); launchEmergencyDialer();
} }
@@ -899,6 +900,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
return (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 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. * Listen to key events so we can disable sounds when we get a keyinput in EditText.
*/ */