diff options
author | Santos Cordon <santoscordon@google.com> | 2014-07-07 15:15:29 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2014-07-08 18:36:32 -0700 |
commit | d15629deb20dd45572ee27fb2890e9a5a2a86ca3 (patch) | |
tree | 5f491552c979b7d07dc46661d8515a65c631fc2e | |
parent | 2adba884432bc5f1b78079d74b4bf2cb2f1ff20f (diff) |
Update showCallScreen & isInAPhoneCall to use PhoneManager.
Change-Id: Ibe6900a0560611346d4ec8e109349b0c82c8a463
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 12 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 15 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 414135178..60826a811 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -30,6 +30,9 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.net.Uri; import android.os.Bundle; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.phone.PhoneManager; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; import android.speech.RecognizerIntent; @@ -801,7 +804,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O final boolean callKey = Intent.ACTION_CALL_BUTTON.equals(intent.getAction()); if (callKey) { - getTelephonyManager().showCallScreen(); + getPhoneManager().showCallScreen(false); return true; } @@ -1029,8 +1032,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } private boolean phoneIsInUse() { - // TODO(santoscordon): Replace with a TelecommService method call. - return getTelephonyManager().getCallState() != TelephonyManager.CALL_STATE_IDLE; + return getPhoneManager().isInAPhoneCall(); } public static Intent getAddNumberToContactIntent(CharSequence text) { @@ -1160,6 +1162,10 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O return (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); } + private PhoneManager getPhoneManager() { + return (PhoneManager) getSystemService(Context.PHONE_SERVICE); + } + @Override public boolean isActionBarShowing() { return mActionBarController.isActionBarShowing(); diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index f9139c7b7..0c1450a8c 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -34,12 +34,12 @@ import android.media.AudioManager; import android.media.ToneGenerator; import android.net.Uri; import android.os.Bundle; +import android.phone.PhoneManager; import android.provider.Contacts.People; import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; import android.provider.Settings; import android.telecomm.PhoneAccount; -import android.telecomm.TelecommManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; @@ -68,12 +68,13 @@ import android.widget.TextView; import com.android.contacts.common.CallUtil; import com.android.contacts.common.GeoUtil; + import com.android.contacts.common.PhoneAccountManager; import com.android.contacts.common.dialog.SelectAccountDialogFragment; import com.android.contacts.common.util.PhoneNumberFormatter; import com.android.contacts.common.util.StopWatch; -import com.android.dialer.NeededForReflection; import com.android.dialer.DialtactsActivity; +import com.android.dialer.NeededForReflection; import com.android.dialer.R; import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.util.DialerUtils; @@ -215,7 +216,7 @@ public class DialpadFragment extends Fragment * press/depress of the "hookswitch" of a landline phone. Aka "empty flash". * * TODO: Using an intent extra to tell the phone to send this flash is a - * temporary measure. To be replaced with an Telephony/TelecommManager call in the future. + * temporary measure. To be replaced with an Telephony/PhoneManager call in the future. * TODO: Keep in sync with the string defined in OutgoingCallBroadcaster.java * in Phone app until this is replaced with the Telephony/Telecomm API. */ @@ -275,8 +276,8 @@ public class DialpadFragment extends Fragment return (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); } - private TelecommManager getTelecommManager() { - return (TelecommManager) getActivity().getSystemService(Context.TELECOMM_SERVICE); + private PhoneManager getPhoneManager() { + return (PhoneManager) getActivity().getSystemService(Context.PHONE_SERVICE); } @Override @@ -1389,7 +1390,7 @@ public class DialpadFragment extends Fragment * or "return to call" from the dialpad chooser. */ private void returnToInCallScreen(boolean showDialpad) { - getTelephonyManager().showCallScreenWithDialpad(showDialpad); + getPhoneManager().showCallScreen(showDialpad); // Finally, finish() ourselves so that we don't stay on the // activity stack. @@ -1407,7 +1408,7 @@ public class DialpadFragment extends Fragment * is active (ie. off hook or ringing or dialing, or on hold). */ public boolean isPhoneInUse() { - return getTelecommManager().isInAPhoneCall(); + return getPhoneManager().isInAPhoneCall(); } /** |