diff --git a/core/api/current.txt b/core/api/current.txt index 1e0a5be82c0f3..88dab8199e20b 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -5933,6 +5933,7 @@ package android.app { field public static final String EXTRA_BIG_TEXT = "android.bigText"; field public static final String EXTRA_CALL_IS_VIDEO = "android.callIsVideo"; field public static final String EXTRA_CALL_PERSON = "android.callPerson"; + field public static final String EXTRA_CALL_TYPE = "android.callType"; field public static final String EXTRA_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID"; field public static final String EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID"; field public static final String EXTRA_CHRONOMETER_COUNT_DOWN = "android.chronometerCountDown"; @@ -6240,6 +6241,10 @@ package android.app { method @NonNull public android.app.Notification.CallStyle setIsVideo(boolean); method @NonNull public android.app.Notification.CallStyle setVerificationIcon(@Nullable android.graphics.drawable.Icon); method @NonNull public android.app.Notification.CallStyle setVerificationText(@Nullable CharSequence); + field public static final int CALL_TYPE_INCOMING = 1; // 0x1 + field public static final int CALL_TYPE_ONGOING = 2; // 0x2 + field public static final int CALL_TYPE_SCREENING = 3; // 0x3 + field public static final int CALL_TYPE_UNKNOWN = 0; // 0x0 } public static final class Notification.CarExtender implements android.app.Notification.Extender { diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 343adb82c8eb8..9bbebc85255a3 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1421,7 +1421,6 @@ public class Notification implements Parcelable /** * {@link #extras} key: the type of call represented by the * {@link android.app.Notification.CallStyle} notification. This extra is an int. - * @hide */ public static final String EXTRA_CALL_TYPE = "android.callType"; @@ -9301,11 +9300,43 @@ public class Notification implements Parcelable * */ public static class CallStyle extends Style { - /** @hide */ + + /** + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({ + CALL_TYPE_UNKNOWN, + CALL_TYPE_INCOMING, + CALL_TYPE_ONGOING, + CALL_TYPE_SCREENING + }) + public @interface CallType {}; + + /** + * Unknown call type. + * + * See {@link #EXTRA_CALL_TYPE}. + */ + public static final int CALL_TYPE_UNKNOWN = 0; + + /** + * Call type for incoming calls. + * + * See {@link #EXTRA_CALL_TYPE}. + */ public static final int CALL_TYPE_INCOMING = 1; - /** @hide */ + /** + * Call type for ongoing calls. + * + * See {@link #EXTRA_CALL_TYPE}. + */ public static final int CALL_TYPE_ONGOING = 2; - /** @hide */ + /** + * Call type for calls that are being screened. + * + * See {@link #EXTRA_CALL_TYPE}. + */ public static final int CALL_TYPE_SCREENING = 3; /** @@ -9392,13 +9423,14 @@ public class Notification implements Parcelable } /** + * @param callType The type of the call * @param person The person displayed for the incoming call. * The user also needs to have a non-empty name associated with it. * @param hangUpIntent The intent to be sent when the user taps the hang up action * @param declineIntent The intent to be sent when the user taps the decline action * @param answerIntent The intent to be sent when the user taps the answer action */ - private CallStyle(int callType, @NonNull Person person, + private CallStyle(@CallType int callType, @NonNull Person person, @Nullable PendingIntent hangUpIntent, @Nullable PendingIntent declineIntent, @Nullable PendingIntent answerIntent) { if (person == null || TextUtils.isEmpty(person.getName())) {