Add new API for new feature of display name.
Bug: 181383364
Test: BlockedNumberProvider test
Change-Id: I13c0ea3451b78ce5c7352f1f3fa15a28ae9bfa1f
diff --git a/core/api/current.txt b/core/api/current.txt
index 9922615..ead7aa4 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -33780,6 +33780,7 @@
field public static final int PRESENTATION_ALLOWED = 1; // 0x1
field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
+ field public static final int PRESENTATION_UNAVAILABLE = 5; // 0x5
field public static final int PRESENTATION_UNKNOWN = 3; // 0x3
field public static final String PRIORITY = "priority";
field public static final int PRIORITY_NORMAL = 0; // 0x0
@@ -40501,6 +40502,7 @@
field public static final int PRESENTATION_ALLOWED = 1; // 0x1
field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
+ field public static final int PRESENTATION_UNAVAILABLE = 5; // 0x5
field public static final int PRESENTATION_UNKNOWN = 3; // 0x3
field public static final int PRIORITY_NORMAL = 0; // 0x0
field public static final int PRIORITY_URGENT = 1; // 0x1
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 84a4a44..0f47b54 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -13047,6 +13047,7 @@
field public static final int OIR_PRESENTATION_NOT_RESTRICTED = 2; // 0x2
field public static final int OIR_PRESENTATION_PAYPHONE = 4; // 0x4
field public static final int OIR_PRESENTATION_RESTRICTED = 1; // 0x1
+ field public static final int OIR_PRESENTATION_UNAVAILABLE = 5; // 0x5
field public static final int OIR_PRESENTATION_UNKNOWN = 3; // 0x3
field public static final int PRIORITY_NORMAL = 0; // 0x0
field public static final int PRIORITY_URGENT = 1; // 0x1
diff --git a/core/java/android/provider/BlockedNumberContract.java b/core/java/android/provider/BlockedNumberContract.java
index dd2ea81..5d00b29 100644
--- a/core/java/android/provider/BlockedNumberContract.java
+++ b/core/java/android/provider/BlockedNumberContract.java
@@ -231,7 +231,7 @@
prefix = { "STATUS_" },
value = {STATUS_NOT_BLOCKED, STATUS_BLOCKED_IN_LIST, STATUS_BLOCKED_RESTRICTED,
STATUS_BLOCKED_UNKNOWN_NUMBER, STATUS_BLOCKED_PAYPHONE,
- STATUS_BLOCKED_NOT_IN_CONTACTS})
+ STATUS_BLOCKED_NOT_IN_CONTACTS, STATUS_BLOCKED_UNAVAILABLE})
public @interface BlockStatus {}
/**
@@ -277,6 +277,13 @@
public static final int STATUS_BLOCKED_NOT_IN_CONTACTS = 5;
/**
+ * Integer reason code used with {@link #RES_BLOCK_STATUS} to indicate that a call was blocked
+ * because it is from a number not available.
+ * @hide
+ */
+ public static final int STATUS_BLOCKED_UNAVAILABLE = 6;
+
+ /**
* Integer reason indicating whether a call was blocked, and if so why.
* @hide
*/
@@ -441,6 +448,9 @@
/* Preference key for whether should show an emergency call notification. */
public static final String ENHANCED_SETTING_KEY_SHOW_EMERGENCY_CALL_NOTIFICATION =
"show_emergency_call_notification";
+ /* Preference key of block unavailable calls setting. */
+ public static final String ENHANCED_SETTING_KEY_BLOCK_UNAVAILABLE =
+ "block_unavailable_calls_setting";
/**
* Notifies the provider that emergency services were contacted by the user.
@@ -547,6 +557,7 @@
* {@link #ENHANCED_SETTING_KEY_BLOCK_PRIVATE}
* {@link #ENHANCED_SETTING_KEY_BLOCK_PAYPHONE}
* {@link #ENHANCED_SETTING_KEY_BLOCK_UNKNOWN}
+ * {@link #ENHANCED_SETTING_KEY_BLOCK_UNAVAILABLE}
* {@link #ENHANCED_SETTING_KEY_EMERGENCY_CALL_NOTIFICATION_SHOWING}
* @return {@code true} if the setting is enabled. {@code false} otherwise.
*/
@@ -574,6 +585,7 @@
* {@link #ENHANCED_SETTING_KEY_BLOCK_PRIVATE}
* {@link #ENHANCED_SETTING_KEY_BLOCK_PAYPHONE}
* {@link #ENHANCED_SETTING_KEY_BLOCK_UNKNOWN}
+ * {@link #ENHANCED_SETTING_KEY_BLOCK_UNAVAILABLE}
* {@link #ENHANCED_SETTING_KEY_EMERGENCY_CALL_NOTIFICATION_SHOWING}
* @param value the enabled statue of the setting to set.
*/
@@ -603,6 +615,8 @@
return "blocked - payphone";
case STATUS_BLOCKED_NOT_IN_CONTACTS:
return "blocked - not in contacts";
+ case STATUS_BLOCKED_UNAVAILABLE:
+ return "blocked - unavailable";
}
return "unknown";
}
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index b4acb67..54270bf 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -910,6 +910,7 @@
* <li>{@link #PRESENTATION_RESTRICTED}</li>
* <li>{@link #PRESENTATION_UNKNOWN}</li>
* <li>{@link #PRESENTATION_PAYPHONE}</li>
+ * <li>{@link #PRESENTATION_UNAVAILABLE}</li>
* </ul>
* </p>
*
@@ -925,6 +926,8 @@
public static final int PRESENTATION_UNKNOWN = 3;
/** Number is a pay phone. */
public static final int PRESENTATION_PAYPHONE = 4;
+ /** Number is unavailable. */
+ public static final int PRESENTATION_UNAVAILABLE = 5;
/**
* The ISO 3166-1 two letters country code of the country where the
@@ -2028,6 +2031,10 @@
return presentation;
}
+ if (presentation == TelecomManager.PRESENTATION_UNAVAILABLE) {
+ return PRESENTATION_UNAVAILABLE;
+ }
+
if (TextUtils.isEmpty(number)
|| presentation == TelecomManager.PRESENTATION_UNKNOWN) {
return PRESENTATION_UNKNOWN;
diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java
index 7861b11..37b4e65 100644
--- a/telecomm/java/android/telecom/CallScreeningService.java
+++ b/telecomm/java/android/telecom/CallScreeningService.java
@@ -632,8 +632,9 @@
* post-dial digits are passed.
* <p>
* Calls with a {@link Call.Details#getHandlePresentation()} of
- * {@link TelecomManager#PRESENTATION_RESTRICTED}, {@link TelecomManager#PRESENTATION_UNKNOWN}
- * or {@link TelecomManager#PRESENTATION_PAYPHONE} presentation are not provided to the
+ * {@link TelecomManager#PRESENTATION_RESTRICTED}, {@link TelecomManager#PRESENTATION_UNKNOWN},
+ * {@link TelecomManager#PRESENTATION_UNAVAILABLE} or
+ * {@link TelecomManager#PRESENTATION_PAYPHONE} presentation are not provided to the
* {@link CallScreeningService}.
*
* @param callDetails Information about a new call, see {@link Call.Details}.
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index e000265..c9cf2ff 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -987,6 +987,11 @@
*/
public static final int PRESENTATION_PAYPHONE = 4;
+ /**
+ * Indicates that the address or number of a call is unavailable.
+ */
+ public static final int PRESENTATION_UNAVAILABLE = 5;
+
/*
* Values for the adb property "persist.radio.videocall.audio.output"
@@ -1003,7 +1008,7 @@
@IntDef(
prefix = { "PRESENTATION_" },
value = {PRESENTATION_ALLOWED, PRESENTATION_RESTRICTED, PRESENTATION_UNKNOWN,
- PRESENTATION_PAYPHONE})
+ PRESENTATION_PAYPHONE, PRESENTATION_UNAVAILABLE})
public @interface Presentation {}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 5ffe45f..3011f05 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -2233,6 +2233,7 @@
* android.provider.BlockedNumberContract.SystemContract#ENHANCED_SETTING_KEY_BLOCK_PRIVATE
* android.provider.BlockedNumberContract.SystemContract#ENHANCED_SETTING_KEY_BLOCK_PAYPHONE
* android.provider.BlockedNumberContract.SystemContract#ENHANCED_SETTING_KEY_BLOCK_UNKNOWN
+ * android.provider.BlockedNumberContract.SystemContract#ENHANCED_SETTING_KEY_BLOCK_UNAVAILABLE
*
* <p>
* 1. For Single SIM(SS) device, it can be customized in both carrier_config_mccmnc.xml
diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java
index 486f746..c04060d 100644
--- a/telephony/java/android/telephony/ims/ImsCallProfile.java
+++ b/telephony/java/android/telephony/ims/ImsCallProfile.java
@@ -317,6 +317,10 @@
* Payphone presentation for Originating Identity.
*/
public static final int OIR_PRESENTATION_PAYPHONE = 4;
+ /**
+ * Unavailable presentation for Originating Identity.
+ */
+ public static final int OIR_PRESENTATION_UNAVAILABLE = 5;
//Values for EXTRA_DIALSTRING
/**
@@ -989,6 +993,8 @@
return ImsCallProfile.OIR_PRESENTATION_PAYPHONE;
case PhoneConstants.PRESENTATION_UNKNOWN:
return ImsCallProfile.OIR_PRESENTATION_UNKNOWN;
+ case PhoneConstants.PRESENTATION_UNAVAILABLE:
+ return ImsCallProfile.OIR_PRESENTATION_UNAVAILABLE;
default:
return ImsCallProfile.OIR_DEFAULT;
}
@@ -1017,6 +1023,8 @@
return PhoneConstants.PRESENTATION_ALLOWED;
case ImsCallProfile.OIR_PRESENTATION_PAYPHONE:
return PhoneConstants.PRESENTATION_PAYPHONE;
+ case ImsCallProfile.OIR_PRESENTATION_UNAVAILABLE:
+ return PhoneConstants.PRESENTATION_UNAVAILABLE;
case ImsCallProfile.OIR_PRESENTATION_UNKNOWN:
return PhoneConstants.PRESENTATION_UNKNOWN;
default:
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index 3a99f0e0..5cb7e30 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -95,6 +95,7 @@
public static final int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network
@UnsupportedAppUsage
public static final int PRESENTATION_PAYPHONE = 4; // show pay phone info
+ public static final int PRESENTATION_UNAVAILABLE = 5; // show unavailable
public static final String PHONE_NAME_KEY = "phoneName";
public static final String DATA_NETWORK_TYPE_KEY = "networkType";