summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt2
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java29
-rw-r--r--packages/Keyguard/src/com/android/keyguard/EmergencyButton.java2
-rw-r--r--phone/java/android/phone/PhoneManager.java43
-rw-r--r--telecomm/java/com/android/internal/telecomm/ITelecommService.aidl5
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java24
6 files changed, 56 insertions, 49 deletions
diff --git a/api/current.txt b/api/current.txt
index 1aac2fd..9b9bfe9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -21797,6 +21797,8 @@ package android.phone {
public final class PhoneManager {
method public void cancelMissedCallsNotification();
method public boolean handlePinMmi(java.lang.String);
+ method public boolean isInAPhoneCall();
+ method public void showCallScreen(boolean);
}
}
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 916586c..5409de7 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -26,7 +26,6 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
-import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -34,8 +33,8 @@ import android.os.SystemClock;
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.TextUtils;
import android.util.Log;
import android.view.IWindowManager;
@@ -1323,19 +1322,11 @@ public class LockPatternUtils {
* 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
- * @param the phone state:
- * {@link TelephonyManager#CALL_STATE_IDLE}
- * {@link TelephonyManager#CALL_STATE_RINGING}
- * {@link TelephonyManager#CALL_STATE_OFFHOOK}
- * @param shown indicates whether the given screen wants the emergency button to show at all
- * @param button
- * @param phoneState
- * @param shown shown if true; hidden if false
- * @param upperCase if true, converts button label string to upper case
+ * @param button The button to update
+ * @param shown Indicates whether the given screen wants the emergency button to show at all
+ * @param showIcon Indicates whether to show a phone icon for the button.
*/
- public void updateEmergencyCallButtonState(Button button, int phoneState, boolean shown,
- boolean showIcon) {
+ public void updateEmergencyCallButtonState(Button button, boolean shown, boolean showIcon) {
if (isEmergencyCallCapable() && shown) {
button.setVisibility(View.VISIBLE);
} else {
@@ -1344,7 +1335,7 @@ public class LockPatternUtils {
}
int textId;
- if (phoneState == TelephonyManager.CALL_STATE_OFFHOOK) {
+ if (getPhoneManager().isInAPhoneCall()) {
// show "return to call" text and show phone icon
textId = R.string.lockscreen_return_to_call;
int phoneCallIcon = showIcon ? R.drawable.stat_sys_phone_call : 0;
@@ -1362,9 +1353,11 @@ public class LockPatternUtils {
* on various lockscreens.
*/
public void resumeCall() {
- TelephonyManager telephonyManager =
- (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
- telephonyManager.showCallScreen();
+ getPhoneManager().showCallScreen(false);
+ }
+
+ private PhoneManager getPhoneManager() {
+ return (PhoneManager) mContext.getSystemService(Context.PHONE_SERVICE);
}
private void finishBiometricWeak() {
diff --git a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
index 4ed37d4..73b11f3 100644
--- a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
+++ b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
@@ -128,7 +128,7 @@ public class EmergencyButton extends Button {
enabled = mLockPatternUtils.isSecure();
}
}
- mLockPatternUtils.updateEmergencyCallButtonState(this, phoneState, enabled, false);
+ mLockPatternUtils.updateEmergencyCallButtonState(this, enabled, false);
}
}
diff --git a/phone/java/android/phone/PhoneManager.java b/phone/java/android/phone/PhoneManager.java
index 244916f..360565e 100644
--- a/phone/java/android/phone/PhoneManager.java
+++ b/phone/java/android/phone/PhoneManager.java
@@ -22,7 +22,6 @@ import android.os.ServiceManager;
import android.util.Log;
import com.android.internal.telecomm.ITelecommService;
-import com.android.internal.telephony.ITelephony;
/**
* Exposes call-related functionality for use by phone and dialer apps.
@@ -49,15 +48,18 @@ public final class PhoneManager {
/**
* Processes the specified dial string as an MMI code.
+ * <p>
+ * Requires that the method-caller be set as the system dialer app.
+ * </p>
*
* @param dialString The digits to dial.
* @return True if the digits were processed as an MMI code, false otherwise.
*/
public boolean handlePinMmi(String dialString) {
try {
- return getITelephony().handlePinMmi(dialString);
+ return mService.handlePinMmi(dialString);
} catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#handlePinMmi", e);
+ Log.e(TAG, "Error calling ITelecommService#handlePinMmi", e);
}
return false;
}
@@ -65,7 +67,7 @@ public final class PhoneManager {
/**
* Removes the missed-call notification if one is present.
* <p>
- * Requires that the caller be set at the system dialer app.
+ * Requires that the method-caller be set as the system dialer app.
* </p>
*/
public void cancelMissedCallsNotification() {
@@ -76,7 +78,36 @@ public final class PhoneManager {
}
}
- private ITelephony getITelephony() {
- return ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
+ /**
+ * Brings the in-call screen to the foreground if there is an ongoing call. If there is
+ * currently no ongoing call, then this method does nothing.
+ * <p>
+ * Requires that the method-caller be set as the system dialer app or have the
+ * {@link android.Manifest.permission#READ_PHONE_STATE} permission.
+ * </p>
+ *
+ * @param showDialpad Brings up the in-call dialpad as part of showing the in-call screen.
+ */
+ public void showCallScreen(boolean showDialpad) {
+ try {
+ mService.showCallScreen(showDialpad);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecommService#showCallScreen", e);
+ }
+ }
+
+ /**
+ * Returns whether there is an ongoing phone call.
+ * <p>
+ * Requires permission: {@link android.Manifest.permission#READ_PHONE_STATE}
+ * </p>
+ */
+ public boolean isInAPhoneCall() {
+ try {
+ return mService.isInAPhoneCall();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error caling ITelecommService#isInAPhoneCall", e);
+ }
+ return false;
}
}
diff --git a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
index d151d09..30e4bdc 100644
--- a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
@@ -85,4 +85,9 @@ interface ITelecommService {
* @see PhoneManager#cancelMissedCallsNotification
*/
void cancelMissedCallsNotification();
+
+ /**
+ * @see PhoneManager#handlePinMmi
+ */
+ boolean handlePinMmi(String dialString);
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index e4885a1..15320e6 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -2890,30 +2890,6 @@ public class TelephonyManager {
/** @hide */
@SystemApi
- public boolean showCallScreen() {
- try {
- getTelecommService().showCallScreen(false);
- return true;
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelecommService#showCallScreen", e);
- }
- return false;
- }
-
- /** @hide */
- @SystemApi
- public boolean showCallScreenWithDialpad(boolean showDialpad) {
- try {
- getTelecommService().showCallScreen(showDialpad);
- return true;
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelecommService#showCallScreen(" + showDialpad + ")", e);
- }
- return false;
- }
-
- /** @hide */
- @SystemApi
public boolean endCall() {
try {
return getITelephony().endCall();