diff options
author | Santos Cordon <santoscordon@google.com> | 2014-05-30 21:32:50 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-30 21:32:50 +0000 |
commit | 5a1233e7df8a44722ecad436562b0cc82c9d4c30 (patch) | |
tree | 09838d7227a217c549172725f05ae549ef5b7ebf /src/com/android/settings/CryptKeeper.java | |
parent | 548fd3061233da2eb85045504a404a51ab826342 (diff) | |
parent | 3afbdf006057c93f930694e26306a3cc9cea34e4 (diff) | |
download | packages_apps_Settings-5a1233e7df8a44722ecad436562b0cc82c9d4c30.zip packages_apps_Settings-5a1233e7df8a44722ecad436562b0cc82c9d4c30.tar.gz packages_apps_Settings-5a1233e7df8a44722ecad436562b0cc82c9d4c30.tar.bz2 |
am 3afbdf00: Update showCallScreen to use Telecomm (6/6)
* commit '3afbdf006057c93f930694e26306a3cc9cea34e4':
Update showCallScreen to use Telecomm (6/6)
Diffstat (limited to 'src/com/android/settings/CryptKeeper.java')
-rw-r--r-- | src/com/android/settings/CryptKeeper.java | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java index 3dc15c5..322bda0 100644 --- a/src/com/android/settings/CryptKeeper.java +++ b/src/com/android/settings/CryptKeeper.java @@ -58,7 +58,6 @@ import android.widget.ProgressBar; import android.widget.TextView; import com.android.internal.statusbar.StatusBarIcon; -import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneConstants; import com.android.internal.widget.LockPatternUtils; @@ -606,8 +605,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList } // Disable the Emergency call button if the device has no voice telephone capability - final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); - if (!tm.isVoiceCapable()) { + if (!getTelephonyManager().isVoiceCapable()) { final View emergencyCall = findViewById(R.id.emergencyCallButton); if (emergencyCall != null) { Log.d(TAG, "Removing the emergency Call button"); @@ -761,7 +759,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList */ private final void setAirplaneModeIfNecessary() { final boolean isLteDevice = - TelephonyManager.getDefault().getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE; + getTelephonyManager().getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE; if (!isLteDevice) { Log.d(TAG, "Going into airplane mode."); Settings.Global.putInt(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1); @@ -797,7 +795,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList return; } - final int newState = TelephonyManager.getDefault().getCallState(); + final int newState = getTelephonyManager().getCallState(); int textId; if (newState == TelephonyManager.CALL_STATE_OFFHOOK) { // Show "return to call" text and show phone icon @@ -817,23 +815,14 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList } private void takeEmergencyCallAction() { - if (TelephonyManager.getDefault().getCallState() == TelephonyManager.CALL_STATE_OFFHOOK) { - resumeCall(); + TelephonyManager telephonyManager = getTelephonyManager(); + if (telephonyManager.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK) { + telephonyManager.showCallScreen(); } else { launchEmergencyDialer(); } } - private void resumeCall() { - final ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); - if (phone != null) { - try { - phone.showCallScreen(); - } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony service: " + e); - } - } - } private void launchEmergencyDialer() { final Intent intent = new Intent(ACTION_EMERGENCY_DIAL); @@ -842,6 +831,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList startActivity(intent); } + private TelephonyManager getTelephonyManager() { + return (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + } + /** * Listen to key events so we can disable sounds when we get a keyinput in EditText. */ |