diff options
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | api/system-current.txt | 3 | ||||
| -rw-r--r-- | api/test-current.txt | 2 | ||||
| -rw-r--r-- | telecomm/java/android/telecom/InCallService.java | 21 | ||||
| -rw-r--r-- | telecomm/java/android/telecom/Phone.java | 17 | ||||
| -rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 9 | ||||
| -rw-r--r-- | telecomm/java/com/android/internal/telecom/IInCallService.aidl | 2 |
7 files changed, 56 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index fd68192159e4..2a4228face8c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -35528,6 +35528,7 @@ package android.telecom { method public void onCallAudioStateChanged(android.telecom.CallAudioState); method public void onCallRemoved(android.telecom.Call); method public void onCanAddCallChanged(boolean); + method public void onSilenceRinger(); method public final void setAudioRoute(int); method public final void setMuted(boolean); field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.InCallService"; @@ -35788,6 +35789,7 @@ package android.telecom { field public static final java.lang.String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.telecom.extra.START_CALL_WITH_VIDEO_STATE"; field public static final java.lang.String GATEWAY_ORIGINAL_ADDRESS = "android.telecom.extra.GATEWAY_ORIGINAL_ADDRESS"; field public static final java.lang.String GATEWAY_PROVIDER_PACKAGE = "android.telecom.extra.GATEWAY_PROVIDER_PACKAGE"; + field public static final java.lang.String METADATA_IN_CALL_SERVICE_RINGING = "android.telecom.IN_CALL_SERVICE_RINGING"; field public static final java.lang.String METADATA_IN_CALL_SERVICE_UI = "android.telecom.IN_CALL_SERVICE_UI"; field public static final int PRESENTATION_ALLOWED = 1; // 0x1 field public static final int PRESENTATION_PAYPHONE = 4; // 0x4 diff --git a/api/system-current.txt b/api/system-current.txt index 09136a9397c5..18e54d7294f5 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -37835,6 +37835,7 @@ package android.telecom { method public void onCanAddCallChanged(boolean); method public deprecated void onPhoneCreated(android.telecom.Phone); method public deprecated void onPhoneDestroyed(android.telecom.Phone); + method public void onSilenceRinger(); method public final void setAudioRoute(int); method public final void setMuted(boolean); field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.InCallService"; @@ -37916,6 +37917,7 @@ package android.telecom { method public void onCallAudioStateChanged(android.telecom.Phone, android.telecom.CallAudioState); method public void onCallRemoved(android.telecom.Phone, android.telecom.Call); method public void onCanAddCallChanged(android.telecom.Phone, boolean); + method public void onSilenceRinger(android.telecom.Phone); } public final class PhoneAccount implements android.os.Parcelable { @@ -38175,6 +38177,7 @@ package android.telecom { field public static final java.lang.String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.telecom.extra.START_CALL_WITH_VIDEO_STATE"; field public static final java.lang.String GATEWAY_ORIGINAL_ADDRESS = "android.telecom.extra.GATEWAY_ORIGINAL_ADDRESS"; field public static final java.lang.String GATEWAY_PROVIDER_PACKAGE = "android.telecom.extra.GATEWAY_PROVIDER_PACKAGE"; + field public static final java.lang.String METADATA_IN_CALL_SERVICE_RINGING = "android.telecom.IN_CALL_SERVICE_RINGING"; field public static final java.lang.String METADATA_IN_CALL_SERVICE_UI = "android.telecom.IN_CALL_SERVICE_UI"; field public static final int PRESENTATION_ALLOWED = 1; // 0x1 field public static final int PRESENTATION_PAYPHONE = 4; // 0x4 diff --git a/api/test-current.txt b/api/test-current.txt index e1d1fdedb22b..888ac03c4663 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -35542,6 +35542,7 @@ package android.telecom { method public void onCallAudioStateChanged(android.telecom.CallAudioState); method public void onCallRemoved(android.telecom.Call); method public void onCanAddCallChanged(boolean); + method public void onSilenceRinger(); method public final void setAudioRoute(int); method public final void setMuted(boolean); field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.InCallService"; @@ -35802,6 +35803,7 @@ package android.telecom { field public static final java.lang.String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.telecom.extra.START_CALL_WITH_VIDEO_STATE"; field public static final java.lang.String GATEWAY_ORIGINAL_ADDRESS = "android.telecom.extra.GATEWAY_ORIGINAL_ADDRESS"; field public static final java.lang.String GATEWAY_PROVIDER_PACKAGE = "android.telecom.extra.GATEWAY_PROVIDER_PACKAGE"; + field public static final java.lang.String METADATA_IN_CALL_SERVICE_RINGING = "android.telecom.IN_CALL_SERVICE_RINGING"; field public static final java.lang.String METADATA_IN_CALL_SERVICE_UI = "android.telecom.IN_CALL_SERVICE_UI"; field public static final int PRESENTATION_ALLOWED = 1; // 0x1 field public static final int PRESENTATION_PAYPHONE = 4; // 0x4 diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java index 426b240e9c78..671399b6f842 100644 --- a/telecomm/java/android/telecom/InCallService.java +++ b/telecomm/java/android/telecom/InCallService.java @@ -73,6 +73,7 @@ public abstract class InCallService extends Service { private static final int MSG_ON_CALL_AUDIO_STATE_CHANGED = 5; private static final int MSG_BRING_TO_FOREGROUND = 6; private static final int MSG_ON_CAN_ADD_CALL_CHANGED = 7; + private static final int MSG_SILENCE_RINGER = 8; /** Default Handler used to consolidate binder method calls onto a single thread. */ private final Handler mHandler = new Handler(Looper.getMainLooper()) { @@ -114,6 +115,9 @@ public abstract class InCallService extends Service { case MSG_ON_CAN_ADD_CALL_CHANGED: mPhone.internalSetCanAddCall(msg.arg1 == 1); break; + case MSG_SILENCE_RINGER: + mPhone.internalSilenceRinger(); + break; default: break; } @@ -165,6 +169,11 @@ public abstract class InCallService extends Service { mHandler.obtainMessage(MSG_ON_CAN_ADD_CALL_CHANGED, canAddCall ? 1 : 0, 0) .sendToTarget(); } + + @Override + public void silenceRinger() { + mHandler.obtainMessage(MSG_SILENCE_RINGER).sendToTarget(); + } } private Phone.Listener mPhoneListener = new Phone.Listener() { @@ -202,6 +211,12 @@ public abstract class InCallService extends Service { InCallService.this.onCanAddCallChanged(canAddCall); } + /** ${inheritDoc} */ + @Override + public void onSilenceRinger(Phone phone) { + InCallService.this.onSilenceRinger(); + } + }; private Phone mPhone; @@ -405,6 +420,12 @@ public abstract class InCallService extends Service { } /** + * Called to silence the ringer if a ringing call exists. + */ + public void onSilenceRinger() { + } + + /** * Used to issue commands to the {@link Connection.VideoProvider} associated with a * {@link Call}. */ diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java index 47154da242f4..56eb7ec5fb78 100644 --- a/telecomm/java/android/telecom/Phone.java +++ b/telecomm/java/android/telecom/Phone.java @@ -97,6 +97,13 @@ public final class Phone { * @param canAddCall Indicates whether an additional call can be added. */ public void onCanAddCallChanged(Phone phone, boolean canAddCall) { } + + /** + * Called to silence the ringer if a ringing call exists. + * + * @param phone The {@code Phone} calling this method. + */ + public void onSilenceRinger(Phone phone) { } } // A Map allows us to track each Call by its Telecom-specified call ID @@ -179,6 +186,10 @@ public final class Phone { } } + final void internalSilenceRinger() { + fireSilenceRinger(); + } + /** * Called to destroy the phone and cleanup any lingering calls. */ @@ -330,6 +341,12 @@ public final class Phone { } } + private void fireSilenceRinger() { + for (Listener listener : mListeners) { + listener.onSilenceRinger(this); + } + } + private void checkCallTree(ParcelableCall parcelableCall) { if (parcelableCall.getParentCallId() != null && !mCallByTelecomCallId.containsKey(parcelableCall.getParentCallId())) { diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 497864e875b8..72ff27227efb 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -308,6 +308,15 @@ public class TelecomManager { "android.telecom.IN_CALL_SERVICE_CAR_MODE_UI"; /** + * A boolean meta-data value indicating whether an {@link InCallService} implements ringing. + * Dialer implementations (see {@link #getDefaultDialerPackage()}) which would also like to + * override the system provided ringing should set this meta-data to {@code true} in the + * manifest registration of their {@link InCallService}. + */ + public static final String METADATA_IN_CALL_SERVICE_RINGING = + "android.telecom.IN_CALL_SERVICE_RINGING"; + + /** * The dual tone multi-frequency signaling character sent to indicate the dialing system should * pause for a predefined period. */ diff --git a/telecomm/java/com/android/internal/telecom/IInCallService.aidl b/telecomm/java/com/android/internal/telecom/IInCallService.aidl index ded47d5a0562..0088e0cf6b64 100644 --- a/telecomm/java/com/android/internal/telecom/IInCallService.aidl +++ b/telecomm/java/com/android/internal/telecom/IInCallService.aidl @@ -45,4 +45,6 @@ oneway interface IInCallService { void bringToForeground(boolean showDialpad); void onCanAddCallChanged(boolean canAddCall); + + void silenceRinger(); } |