summaryrefslogtreecommitdiff
path: root/core/java/android/app/Notification.java
diff options
context:
space:
mode:
authorJeff DeCew <jeffdq@google.com>2021-04-08 20:39:58 -0400
committerJeff DeCew <jeffdq@google.com>2021-04-08 21:40:53 -0400
commitf3c0dac014f019299742aab580702d47fffd1bfc (patch)
tree8f4aebedf61c1643252618b6a01716eab2984b19 /core/java/android/app/Notification.java
parent6a39b82e8bac1a4f263f8e0bae90ec0d3d757eca (diff)
Add CallStyle.setIsVideo(boolean)
Fixes: 184869759 Test: cts Change-Id: Ie798a5d67db0e5fb689166340dc648bda1cc6571
Diffstat (limited to 'core/java/android/app/Notification.java')
-rw-r--r--core/java/android/app/Notification.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 3de78f6e3cab..22a25210aef7 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -1388,6 +1388,12 @@ public class Notification implements Parcelable
public static final String EXTRA_CALL_TYPE = "android.callType";
/**
+ * {@link #extras} key: whether the {@link android.app.Notification.CallStyle} notification
+ * is for a call that will activate video when answered. This extra is a boolean.
+ */
+ public static final String EXTRA_CALL_IS_VIDEO = "android.callIsVideo";
+
+ /**
* {@link #extras} key: the person to be displayed as calling for the
* {@link android.app.Notification.CallStyle} notification. This extra is a {@link Person}.
*/
@@ -9167,6 +9173,7 @@ public class Notification implements Parcelable
private PendingIntent mAnswerIntent;
private PendingIntent mDeclineIntent;
private PendingIntent mHangUpIntent;
+ private boolean mIsVideo;
private Integer mAnswerButtonColor;
private Integer mDeclineButtonColor;
private Icon mVerificationIcon;
@@ -9259,6 +9266,16 @@ public class Notification implements Parcelable
}
/**
+ * Sets whether the call is a video call, which may affect the icons or text used on the
+ * required action buttons.
+ */
+ @NonNull
+ public CallStyle setIsVideo(boolean isVideo) {
+ mIsVideo = isVideo;
+ return this;
+ }
+
+ /**
* Optional icon to be displayed with {@link #setVerificationText(CharSequence) text}
* as a verification status of the caller.
*/
@@ -9386,8 +9403,10 @@ public class Notification implements Parcelable
@Nullable
private Action makeAnswerAction() {
- return mAnswerIntent == null ? null : makeAction(R.drawable.ic_call_answer,
- R.string.call_notification_answer_action,
+ return mAnswerIntent == null ? null : makeAction(
+ mIsVideo ? R.drawable.ic_call_answer_video : R.drawable.ic_call_answer,
+ mIsVideo ? R.string.call_notification_answer_video_action
+ : R.string.call_notification_answer_action,
mAnswerButtonColor, R.color.call_notification_answer_color,
mAnswerIntent);
}
@@ -9566,6 +9585,7 @@ public class Notification implements Parcelable
public void addExtras(Bundle extras) {
super.addExtras(extras);
extras.putInt(EXTRA_CALL_TYPE, mCallType);
+ extras.putBoolean(EXTRA_CALL_IS_VIDEO, mIsVideo);
extras.putParcelable(EXTRA_CALL_PERSON, mPerson);
if (mVerificationIcon != null) {
extras.putParcelable(EXTRA_VERIFICATION_ICON, mVerificationIcon);
@@ -9608,6 +9628,7 @@ public class Notification implements Parcelable
protected void restoreFromExtras(Bundle extras) {
super.restoreFromExtras(extras);
mCallType = extras.getInt(EXTRA_CALL_TYPE);
+ mIsVideo = extras.getBoolean(EXTRA_CALL_IS_VIDEO);
mPerson = extras.getParcelable(EXTRA_CALL_PERSON);
mVerificationIcon = extras.getParcelable(EXTRA_VERIFICATION_ICON);
mVerificationText = extras.getCharSequence(EXTRA_VERIFICATION_TEXT);