From eb7a2ad4086ba48688e5066aa42ef04645462951 Mon Sep 17 00:00:00 2001 From: Hall Liu Date: Wed, 15 Jan 2020 17:27:29 -0800 Subject: [PATCH] Add call barring constants to ImsUtImplBase Add call barring constants to ImsUtImplBase in order to expose them in the system API surface. Fixes: 147733594 Bug: 146834818 Test: build Change-Id: Ieb701625b1ecf858d67648f5bb4c87f3e87c1f73 --- api/system-current.txt | 11 +++ api/test-current.txt | 11 +++ .../telephony/ims/stub/ImsUtImplBase.java | 74 ++++++++++++++++++- .../java/com/android/ims/ImsUtInterface.java | 38 +++++----- 4 files changed, 113 insertions(+), 21 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 4afb29b45a557..7d68882ad7d0b 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -10573,6 +10573,17 @@ package android.telephony.ims.stub { method public int updateClir(int); method public int updateColp(boolean); method public int updateColr(int); + field public static final int CALL_BARRING_ALL = 7; // 0x7 + field public static final int CALL_BARRING_ALL_INCOMING = 1; // 0x1 + field public static final int CALL_BARRING_ALL_OUTGOING = 2; // 0x2 + field public static final int CALL_BARRING_ANONYMOUS_INCOMING = 6; // 0x6 + field public static final int CALL_BARRING_INCOMING_ALL_SERVICES = 9; // 0x9 + field public static final int CALL_BARRING_OUTGOING_ALL_SERVICES = 8; // 0x8 + field public static final int CALL_BARRING_OUTGOING_INTL = 3; // 0x3 + field public static final int CALL_BARRING_OUTGOING_INTL_EXCL_HOME = 4; // 0x4 + field public static final int CALL_BARRING_SPECIFIC_INCOMING_CALLS = 10; // 0xa + field public static final int CALL_BLOCKING_INCOMING_WHEN_ROAMING = 5; // 0x5 + field public static final int INVALID_RESULT = -1; // 0xffffffff } } diff --git a/api/test-current.txt b/api/test-current.txt index 2a4af615e86c2..4e6fb7300f87b 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -3904,6 +3904,17 @@ package android.telephony.ims.stub { method public int updateClir(int); method public int updateColp(boolean); method public int updateColr(int); + field public static final int CALL_BARRING_ALL = 7; // 0x7 + field public static final int CALL_BARRING_ALL_INCOMING = 1; // 0x1 + field public static final int CALL_BARRING_ALL_OUTGOING = 2; // 0x2 + field public static final int CALL_BARRING_ANONYMOUS_INCOMING = 6; // 0x6 + field public static final int CALL_BARRING_INCOMING_ALL_SERVICES = 9; // 0x9 + field public static final int CALL_BARRING_OUTGOING_ALL_SERVICES = 8; // 0x8 + field public static final int CALL_BARRING_OUTGOING_INTL = 3; // 0x3 + field public static final int CALL_BARRING_OUTGOING_INTL_EXCL_HOME = 4; // 0x4 + field public static final int CALL_BARRING_SPECIFIC_INCOMING_CALLS = 10; // 0xa + field public static final int CALL_BLOCKING_INCOMING_WHEN_ROAMING = 5; // 0x5 + field public static final int INVALID_RESULT = -1; // 0xffffffff } } diff --git a/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java b/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java index feac3c2ebfde9..3ec4f34684970 100644 --- a/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java @@ -16,6 +16,7 @@ package android.telephony.ims.stub; +import android.annotation.IntDef; import android.annotation.SystemApi; import android.annotation.TestApi; import android.os.Bundle; @@ -25,6 +26,9 @@ import android.telephony.ims.ImsUtListener; import com.android.ims.internal.IImsUt; import com.android.ims.internal.IImsUtListener; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + /** * Base implementation of IMS UT interface, which implements stubs. Override these methods to * implement functionality. @@ -36,6 +40,70 @@ import com.android.ims.internal.IImsUtListener; @SystemApi @TestApi public class ImsUtImplBase { + /** + * Bar all incoming calls. (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_ALL_INCOMING = 1; + + /** + * Bar all outgoing calls. (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_ALL_OUTGOING = 2; + + /** + * Bar all outgoing international calls. (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_OUTGOING_INTL = 3; + + /** + * Bar all outgoing international calls, excluding those to the home PLMN country + * (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_OUTGOING_INTL_EXCL_HOME = 4; + + /** + * Bar all incoming calls when roaming (See 3GPP TS 24.611) + */ + public static final int CALL_BLOCKING_INCOMING_WHEN_ROAMING = 5; + + /** + * Enable Anonymous Communication Rejection (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_ANONYMOUS_INCOMING = 6; + + /** + * Bar all incoming and outgoing calls. (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_ALL = 7; + + /** + * Bar all outgoing service requests, including calls. (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_OUTGOING_ALL_SERVICES = 8; + + /** + * Bar all incoming service requests, including calls. (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_INCOMING_ALL_SERVICES = 9; + + /** + * Bar specific incoming calls. (See 3GPP TS 24.611) + */ + public static final int CALL_BARRING_SPECIFIC_INCOMING_CALLS = 10; + + /** @hide */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = "CALL_BARRING_", value = {CALL_BARRING_ALL_INCOMING, CALL_BARRING_ALL_OUTGOING, + CALL_BARRING_OUTGOING_INTL, CALL_BARRING_OUTGOING_INTL_EXCL_HOME, + CALL_BLOCKING_INCOMING_WHEN_ROAMING, CALL_BARRING_ANONYMOUS_INCOMING, + CALL_BARRING_ALL, CALL_BARRING_OUTGOING_ALL_SERVICES, + CALL_BARRING_INCOMING_ALL_SERVICES, CALL_BARRING_SPECIFIC_INCOMING_CALLS}) + public @interface CallBarringMode {} + + /** + * Constant used to denote an invalid return value. + */ + public static final int INVALID_RESULT = -1; private IImsUt.Stub mServiceImpl = new IImsUt.Stub() { @Override @@ -247,15 +315,15 @@ public class ImsUtImplBase { /** * Updates the configuration of the call barring. */ - public int updateCallBarring(int cbType, int action, String[] barrList) { + public int updateCallBarring(@CallBarringMode int cbType, int action, String[] barrList) { return -1; } /** * Updates the configuration of the call barring for specified service class. */ - public int updateCallBarringForServiceClass(int cbType, int action, String[] barrList, - int serviceClass) { + public int updateCallBarringForServiceClass(@CallBarringMode int cbType, int action, + String[] barrList, int serviceClass) { return -1; } diff --git a/telephony/java/com/android/ims/ImsUtInterface.java b/telephony/java/com/android/ims/ImsUtInterface.java index 50b63bd254354..15f8371898436 100644 --- a/telephony/java/com/android/ims/ImsUtInterface.java +++ b/telephony/java/com/android/ims/ImsUtInterface.java @@ -21,6 +21,7 @@ import android.os.Handler; import android.os.Message; import android.telephony.ims.ImsCallForwardInfo; import android.telephony.ims.ImsSsInfo; +import android.telephony.ims.stub.ImsUtImplBase; /** * Provides APIs for the supplementary service settings using IMS (Ut interface). @@ -58,47 +59,48 @@ public interface ImsUtInterface { * CDIV (Communication Diversion, 3GPP TS 24.604) * actions: target, no reply timer */ - public static final int CDIV_CF_UNCONDITIONAL = 0; - public static final int CDIV_CF_BUSY = 1; - public static final int CDIV_CF_NO_REPLY = 2; - public static final int CDIV_CF_NOT_REACHABLE = 3; + public static final int CDIV_CF_UNCONDITIONAL = ImsCallForwardInfo.CDIV_CF_REASON_UNCONDITIONAL; + public static final int CDIV_CF_BUSY = ImsCallForwardInfo.CDIV_CF_REASON_BUSY; + public static final int CDIV_CF_NO_REPLY = ImsCallForwardInfo.CDIV_CF_REASON_NO_REPLY; + public static final int CDIV_CF_NOT_REACHABLE = ImsCallForwardInfo.CDIV_CF_REASON_NOT_REACHABLE; // For CS service code: 002 - public static final int CDIV_CF_ALL = 4; + public static final int CDIV_CF_ALL = ImsCallForwardInfo.CDIV_CF_REASON_ALL; // For CS service code: 004 - public static final int CDIV_CF_ALL_CONDITIONAL = 5; + public static final int CDIV_CF_ALL_CONDITIONAL = + ImsCallForwardInfo.CDIV_CF_REASON_ALL_CONDITIONAL; // It's only supported in the IMS service (CS does not define it). // IR.92 recommends that an UE activates both the CFNRc and the CFNL // (CDIV using condition not-registered) to the same target. - public static final int CDIV_CF_NOT_LOGGED_IN = 6; + public static final int CDIV_CF_NOT_LOGGED_IN = ImsCallForwardInfo.CDIV_CF_REASON_NOT_LOGGED_IN; /** * CB (Communication Barring, 3GPP TS 24.611) */ // Barring of All Incoming Calls - public static final int CB_BAIC = 1; + public static final int CB_BAIC = ImsUtImplBase.CALL_BARRING_ALL_INCOMING; // Barring of All Outgoing Calls - public static final int CB_BAOC = 2; + public static final int CB_BAOC = ImsUtImplBase.CALL_BARRING_ALL_OUTGOING; // Barring of Outgoing International Calls - public static final int CB_BOIC = 3; + public static final int CB_BOIC = ImsUtImplBase.CALL_BARRING_OUTGOING_INTL; // Barring of Outgoing International Calls - excluding Home Country - public static final int CB_BOIC_EXHC = 4; + public static final int CB_BOIC_EXHC = ImsUtImplBase.CALL_BARRING_OUTGOING_INTL_EXCL_HOME; // Barring of Incoming Calls - when roaming - public static final int CB_BIC_WR = 5; + public static final int CB_BIC_WR = ImsUtImplBase.CALL_BLOCKING_INCOMING_WHEN_ROAMING; // Barring of Anonymous Communication Rejection (ACR) - a particular case of ICB service - public static final int CB_BIC_ACR = 6; + public static final int CB_BIC_ACR = ImsUtImplBase.CALL_BARRING_ANONYMOUS_INCOMING; // Barring of All Calls - public static final int CB_BA_ALL = 7; + public static final int CB_BA_ALL = ImsUtImplBase.CALL_BARRING_ALL; // Barring of Outgoing Services (Service Code 333 - 3GPP TS 22.030 Table B-1) - public static final int CB_BA_MO = 8; + public static final int CB_BA_MO = ImsUtImplBase.CALL_BARRING_OUTGOING_ALL_SERVICES; // Barring of Incoming Services (Service Code 353 - 3GPP TS 22.030 Table B-1) - public static final int CB_BA_MT = 9; + public static final int CB_BA_MT = ImsUtImplBase.CALL_BARRING_INCOMING_ALL_SERVICES; // Barring of Specific Incoming calls - public static final int CB_BS_MT = 10; + public static final int CB_BS_MT = ImsUtImplBase.CALL_BARRING_SPECIFIC_INCOMING_CALLS; /** * Invalid result value. */ - public static final int INVALID = (-1); + public static final int INVALID = ImsUtImplBase.INVALID_RESULT;