Merge "Add CallStyle.setIsVideo(boolean)" into sc-dev

This commit is contained in:
Jeff DeCew
2021-04-14 00:37:12 +00:00
committed by Android (Google) Code Review
5 changed files with 56 additions and 2 deletions

View File

@@ -5666,6 +5666,7 @@ package android.app {
field public static final String EXTRA_AUDIO_CONTENTS_URI = "android.audioContents";
field public static final String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
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_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID";
field public static final String EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID";
@@ -5972,6 +5973,7 @@ package android.app {
method @NonNull public static android.app.Notification.CallStyle forScreeningCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent, @NonNull android.app.PendingIntent);
method @NonNull public android.app.Notification.CallStyle setAnswerButtonColorHint(@ColorInt int);
method @NonNull public android.app.Notification.CallStyle setDeclineButtonColorHint(@ColorInt int);
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);
}

View File

@@ -1387,6 +1387,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}.
@@ -9146,6 +9152,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;
@@ -9237,6 +9244,16 @@ public class Notification implements Parcelable
mHangUpIntent = hangUpIntent;
}
/**
* 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.
@@ -9365,8 +9382,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);
}
@@ -9545,6 +9564,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);
@@ -9587,6 +9607,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);

View File

@@ -0,0 +1,27 @@
<!--
Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="20"
android:viewportHeight="20"
android:tint="?android:attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="#FF000000"
android:pathData="M15,8v8H5V8h10m1,-2H4c-0.55,0 -1,0.45 -1,1v10c0,0.55 0.45,1 1,1h12c0.55,0
1,-0.45 1,-1v-3.5l4,4v-11l-4,4V7c0,-0.55 -0.45,-1 -1,-1z"/>
</vector>

View File

@@ -5151,6 +5151,8 @@
<!-- Action text to be displayed for the "answer" action of an incoming call [CHAR LIMIT=13] -->
<string name="call_notification_answer_action">Answer</string>
<!-- Action text to be displayed for the "answer" action of an incoming VIDEO call [CHAR LIMIT=13] -->
<string name="call_notification_answer_video_action">Video</string>
<!-- Action text to be displayed for the "decline" action of an incoming call [CHAR LIMIT=13] -->
<string name="call_notification_decline_action">Decline</string>
<!-- Action text to be displayed for the "hang up" action of an ongoing call [CHAR LIMIT=13] -->

View File

@@ -3115,6 +3115,7 @@
<java-symbol type="layout" name="notification_template_material_call" />
<java-symbol type="layout" name="notification_template_material_big_call" />
<java-symbol type="string" name="call_notification_answer_action" />
<java-symbol type="string" name="call_notification_answer_video_action" />
<java-symbol type="string" name="call_notification_decline_action" />
<java-symbol type="string" name="call_notification_hang_up_action" />
<java-symbol type="string" name="call_notification_incoming_text" />
@@ -3124,6 +3125,7 @@
<java-symbol type="color" name="call_notification_answer_color"/>
<java-symbol type="dimen" name="call_notification_collapsible_indent"/>
<java-symbol type="drawable" name="ic_call_answer" />
<java-symbol type="drawable" name="ic_call_answer_video" />
<java-symbol type="drawable" name="ic_call_decline" />
<java-symbol type="id" name="verification_divider" />
<java-symbol type="id" name="verification_icon" />