summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2014-05-29 13:07:10 -0700
committerSantos Cordon <santoscordon@google.com>2014-05-30 11:35:42 -0700
commit3534ede5722b98c5be1526ba0bc2cd8acfbe0e55 (patch)
treea868cad3c18543edf28438afd088f63351e40a60
parenteec8f0cbbba8cfe3de29fef4b2362af3817ea575 (diff)
downloadframeworks_base-3534ede5722b98c5be1526ba0bc2cd8acfbe0e55.zip
frameworks_base-3534ede5722b98c5be1526ba0bc2cd8acfbe0e55.tar.gz
frameworks_base-3534ede5722b98c5be1526ba0bc2cd8acfbe0e55.tar.bz2
Update showCallScreen to use Telecomm (1/6)
- Add API methods to InCallService and ITelecommService. - Remove old methods from ITelephony. - Route the TelephonyManager methods through ITelecommService instead of ITelephony. - Update Lock screen to use TelephonyManager instead of ITelephony. Bug: 15008165 Change-Id: Ib674e2e48efaa1cc97d1513dc2c2b27fdb343657
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java17
-rw-r--r--telecomm/java/android/telecomm/InCallService.java17
-rw-r--r--telecomm/java/com/android/internal/telecomm/IInCallService.aidl2
-rw-r--r--telecomm/java/com/android/internal/telecomm/ITelecommService.aidl9
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java10
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl22
6 files changed, 37 insertions, 40 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 25e3463..d31c5cc 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -43,7 +43,6 @@ import android.view.View;
import android.widget.Button;
import com.android.internal.R;
-import com.android.internal.telephony.ITelephony;
import com.google.android.collect.Lists;
import java.security.MessageDigest;
@@ -1360,19 +1359,11 @@ public class LockPatternUtils {
/**
* Resumes a call in progress. Typically launched from the EmergencyCall button
* on various lockscreens.
- *
- * @return true if we were able to tell InCallScreen to show.
*/
- public boolean resumeCall() {
- ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
- try {
- if (phone != null && phone.showCallScreen()) {
- return true;
- }
- } catch (RemoteException e) {
- // What can we do?
- }
- return false;
+ public void resumeCall() {
+ TelephonyManager telephonyManager =
+ (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ telephonyManager.showCallScreen();
}
private void finishBiometricWeak() {
diff --git a/telecomm/java/android/telecomm/InCallService.java b/telecomm/java/android/telecomm/InCallService.java
index 63b2020..3a63077 100644
--- a/telecomm/java/android/telecomm/InCallService.java
+++ b/telecomm/java/android/telecomm/InCallService.java
@@ -42,6 +42,7 @@ public abstract class InCallService extends Service {
private static final int MSG_SET_POST_DIAL = 4;
private static final int MSG_SET_POST_DIAL_WAIT = 5;
private static final int MSG_ON_AUDIO_STATE_CHANGED = 6;
+ private static final int MSG_BRING_TO_FOREGROUND = 7;
/** Default Handler used to consolidate binder method calls onto a single thread. */
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -83,6 +84,9 @@ public abstract class InCallService extends Service {
case MSG_ON_AUDIO_STATE_CHANGED:
onAudioStateChanged((CallAudioState) msg.obj);
break;
+ case MSG_BRING_TO_FOREGROUND:
+ bringToForeground(msg.arg1 == 1);
+ break;
default:
break;
}
@@ -130,6 +134,12 @@ public abstract class InCallService extends Service {
public void onAudioStateChanged(CallAudioState audioState) {
mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, audioState).sendToTarget();
}
+
+ /** {@inheritDoc} */
+ @Override
+ public void bringToForeground(boolean showDialpad) {
+ mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget();
+ }
}
private final InCallServiceBinder mBinder;
@@ -206,4 +216,11 @@ public abstract class InCallService extends Service {
* @param audioState The new {@link CallAudioState}.
*/
protected abstract void onAudioStateChanged(CallAudioState audioState);
+
+ /**
+ * Brings the in-call screen to the foreground.
+ *
+ * @param showDialpad If true, put up the dialpad when the screen is shown.
+ */
+ protected abstract void bringToForeground(boolean showDialpad);
}
diff --git a/telecomm/java/com/android/internal/telecomm/IInCallService.aidl b/telecomm/java/com/android/internal/telecomm/IInCallService.aidl
index ccf7e3f..1635053 100644
--- a/telecomm/java/com/android/internal/telecomm/IInCallService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IInCallService.aidl
@@ -40,4 +40,6 @@ oneway interface IInCallService {
void setPostDialWait(String callId, String remaining);
void onAudioStateChanged(in CallAudioState audioState);
+
+ void bringToForeground(boolean showDialpad);
}
diff --git a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
index c439211..0e94ffb 100644
--- a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
@@ -21,7 +21,7 @@ package com.android.internal.telecomm;
* commands that were previously handled by ITelephony.
* {@hide}
*/
-oneway interface ITelecommService {
+interface ITelecommService {
/**
* Silence the ringer if an incoming call is currently ringing.
@@ -31,4 +31,11 @@ oneway interface ITelecommService {
* even if there's no incoming call. (If so, this method will do nothing.)
*/
void silenceRinger();
+
+ /**
+ * Brings the in-call screen to the foreground if there is an active call.
+ *
+ * @param showDialpad if true, make the dialpad visible initially.
+ */
+ void showCallScreen(boolean showDialpad);
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 4aed1fe..525441d 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1980,9 +1980,10 @@ public class TelephonyManager {
@PrivateApi
public boolean showCallScreen() {
try {
- return getITelephony().showCallScreen();
+ getTelecommService().showCallScreen(false);
+ return true;
} catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#showCallScreen", e);
+ Log.e(TAG, "Error calling ITelecommService#showCallScreen", e);
}
return false;
}
@@ -1991,9 +1992,10 @@ public class TelephonyManager {
@PrivateApi
public boolean showCallScreenWithDialpad(boolean showDialpad) {
try {
- return getITelephony().showCallScreenWithDialpad(showDialpad);
+ getTelecommService().showCallScreen(showDialpad);
+ return true;
} catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#showCallScreenWithDialpad", e);
+ Log.e(TAG, "Error calling ITelecommService#showCallScreen(" + showDialpad + ")", e);
}
return false;
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 6d7f158..acaa8de 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -49,28 +49,6 @@ interface ITelephony {
void call(String callingPackage, String number);
/**
- * If there is currently a call in progress, show the call screen.
- * The DTMF dialpad may or may not be visible initially, depending on
- * whether it was up when the user last exited the InCallScreen.
- *
- * @return true if the call screen was shown.
- */
- boolean showCallScreen();
-
- /**
- * Variation of showCallScreen() that also specifies whether the
- * DTMF dialpad should be initially visible when the InCallScreen
- * comes up.
- *
- * @param showDialpad if true, make the dialpad visible initially,
- * otherwise hide the dialpad initially.
- * @return true if the call screen was shown.
- *
- * @see showCallScreen
- */
- boolean showCallScreenWithDialpad(boolean showDialpad);
-
- /**
* End call if there is a call in progress, otherwise does nothing.
*
* @return whether it hung up