Merge "Revert "Add API to let apps color CallStyle notifications themse..."" into sc-dev am: 1d57fc25ae
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13676333 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I23293fb6b21937bcfdaaf3a48af3f3cf7a3cdabb
This commit is contained in:
@@ -5610,7 +5610,6 @@ package android.app {
|
|||||||
field public static final int DEFAULT_LIGHTS = 4; // 0x4
|
field public static final int DEFAULT_LIGHTS = 4; // 0x4
|
||||||
field public static final int DEFAULT_SOUND = 1; // 0x1
|
field public static final int DEFAULT_SOUND = 1; // 0x1
|
||||||
field public static final int DEFAULT_VIBRATE = 2; // 0x2
|
field public static final int DEFAULT_VIBRATE = 2; // 0x2
|
||||||
field public static final String EXTRA_ANSWER_COLOR = "android.answerColor";
|
|
||||||
field public static final String EXTRA_ANSWER_INTENT = "android.answerIntent";
|
field public static final String EXTRA_ANSWER_INTENT = "android.answerIntent";
|
||||||
field public static final String EXTRA_AUDIO_CONTENTS_URI = "android.audioContents";
|
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_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
|
||||||
@@ -5622,7 +5621,6 @@ package android.app {
|
|||||||
field public static final String EXTRA_COLORIZED = "android.colorized";
|
field public static final String EXTRA_COLORIZED = "android.colorized";
|
||||||
field public static final String EXTRA_COMPACT_ACTIONS = "android.compactActions";
|
field public static final String EXTRA_COMPACT_ACTIONS = "android.compactActions";
|
||||||
field public static final String EXTRA_CONVERSATION_TITLE = "android.conversationTitle";
|
field public static final String EXTRA_CONVERSATION_TITLE = "android.conversationTitle";
|
||||||
field public static final String EXTRA_DECLINE_COLOR = "android.declineColor";
|
|
||||||
field public static final String EXTRA_DECLINE_INTENT = "android.declineIntent";
|
field public static final String EXTRA_DECLINE_INTENT = "android.declineIntent";
|
||||||
field public static final String EXTRA_HANG_UP_INTENT = "android.hangUpIntent";
|
field public static final String EXTRA_HANG_UP_INTENT = "android.hangUpIntent";
|
||||||
field public static final String EXTRA_HISTORIC_MESSAGES = "android.messages.historic";
|
field public static final String EXTRA_HISTORIC_MESSAGES = "android.messages.historic";
|
||||||
@@ -5910,8 +5908,6 @@ package android.app {
|
|||||||
method @NonNull public static android.app.Notification.CallStyle forIncomingCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent, @NonNull android.app.PendingIntent);
|
method @NonNull public static android.app.Notification.CallStyle forIncomingCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent, @NonNull android.app.PendingIntent);
|
||||||
method @NonNull public static android.app.Notification.CallStyle forOngoingCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent);
|
method @NonNull public static android.app.Notification.CallStyle forOngoingCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent);
|
||||||
method @NonNull public static android.app.Notification.CallStyle forScreeningCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent, @NonNull android.app.PendingIntent);
|
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 setVerificationIcon(@Nullable android.graphics.drawable.Icon);
|
method @NonNull public android.app.Notification.CallStyle setVerificationIcon(@Nullable android.graphics.drawable.Icon);
|
||||||
method @NonNull public android.app.Notification.CallStyle setVerificationText(@Nullable CharSequence);
|
method @NonNull public android.app.Notification.CallStyle setVerificationText(@Nullable CharSequence);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1370,18 +1370,6 @@ public class Notification implements Parcelable
|
|||||||
*/
|
*/
|
||||||
public static final String EXTRA_HANG_UP_INTENT = "android.hangUpIntent";
|
public static final String EXTRA_HANG_UP_INTENT = "android.hangUpIntent";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link #extras} key: the color used as a hint for the Answer action button of a
|
|
||||||
* {@link android.app.Notification.CallStyle} notification. This extra is a {@link ColorInt}.
|
|
||||||
*/
|
|
||||||
public static final String EXTRA_ANSWER_COLOR = "android.answerColor";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link #extras} key: the color used as a hint for the Decline or Hang Up action button of a
|
|
||||||
* {@link android.app.Notification.CallStyle} notification. This extra is a {@link ColorInt}.
|
|
||||||
*/
|
|
||||||
public static final String EXTRA_DECLINE_COLOR = "android.declineColor";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link #extras} key: whether the notification should be colorized as
|
* {@link #extras} key: whether the notification should be colorized as
|
||||||
* supplied to {@link Builder#setColorized(boolean)}.
|
* supplied to {@link Builder#setColorized(boolean)}.
|
||||||
@@ -5456,11 +5444,6 @@ public class Notification implements Parcelable
|
|||||||
return p.allowColorization && mN.isColorized();
|
return p.allowColorization && mN.isColorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCallActionColorCustomizable(StandardTemplateParams p) {
|
|
||||||
return isColorized(p) && mContext.getResources().getBoolean(
|
|
||||||
R.bool.config_callNotificationActionColorsRequireColorized);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bindSmallIcon(RemoteViews contentView, StandardTemplateParams p) {
|
private void bindSmallIcon(RemoteViews contentView, StandardTemplateParams p) {
|
||||||
if (mN.mSmallIcon == null && mN.icon != 0) {
|
if (mN.mSmallIcon == null && mN.icon != 0) {
|
||||||
mN.mSmallIcon = Icon.createWithResource(mContext, mN.icon);
|
mN.mSmallIcon = Icon.createWithResource(mContext, mN.icon);
|
||||||
@@ -9083,8 +9066,6 @@ public class Notification implements Parcelable
|
|||||||
private PendingIntent mAnswerIntent;
|
private PendingIntent mAnswerIntent;
|
||||||
private PendingIntent mDeclineIntent;
|
private PendingIntent mDeclineIntent;
|
||||||
private PendingIntent mHangUpIntent;
|
private PendingIntent mHangUpIntent;
|
||||||
private Integer mAnswerButtonColor;
|
|
||||||
private Integer mDeclineButtonColor;
|
|
||||||
private Icon mVerificationIcon;
|
private Icon mVerificationIcon;
|
||||||
private CharSequence mVerificationText;
|
private CharSequence mVerificationText;
|
||||||
|
|
||||||
@@ -9194,28 +9175,6 @@ public class Notification implements Parcelable
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Optional color to be used as a hint for the Answer action button's color.
|
|
||||||
* The system may change this color to ensure sufficient contrast with the background.
|
|
||||||
* The system may choose to disregard this hint if the notification is not colorized.
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public CallStyle setAnswerButtonColorHint(@ColorInt int color) {
|
|
||||||
mAnswerButtonColor = color;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Optional color to be used as a hint for the Decline or Hang Up action button's color.
|
|
||||||
* The system may change this color to ensure sufficient contrast with the background.
|
|
||||||
* The system may choose to disregard this hint if the notification is not colorized.
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public CallStyle setDeclineButtonColorHint(@ColorInt int color) {
|
|
||||||
mDeclineButtonColor = color;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -9275,47 +9234,40 @@ public class Notification implements Parcelable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private Action makeNegativeAction(@NonNull StandardTemplateParams p) {
|
private Action makeNegativeAction() {
|
||||||
if (mDeclineIntent == null) {
|
if (mDeclineIntent == null) {
|
||||||
return makeAction(p, R.drawable.ic_call_decline,
|
return makeAction(R.drawable.ic_call_decline,
|
||||||
R.string.call_notification_hang_up_action,
|
R.string.call_notification_hang_up_action,
|
||||||
mDeclineButtonColor, R.color.call_notification_decline_color,
|
R.color.call_notification_decline_color, mHangUpIntent);
|
||||||
mHangUpIntent);
|
|
||||||
} else {
|
} else {
|
||||||
return makeAction(p, R.drawable.ic_call_decline,
|
return makeAction(R.drawable.ic_call_decline,
|
||||||
R.string.call_notification_decline_action,
|
R.string.call_notification_decline_action,
|
||||||
mDeclineButtonColor, R.color.call_notification_decline_color,
|
R.color.call_notification_decline_color, mDeclineIntent);
|
||||||
mDeclineIntent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private Action makeAnswerAction(@NonNull StandardTemplateParams p) {
|
private Action makeAnswerAction() {
|
||||||
return mAnswerIntent == null ? null : makeAction(p, R.drawable.ic_call_answer,
|
return mAnswerIntent == null ? null : makeAction(R.drawable.ic_call_answer,
|
||||||
R.string.call_notification_answer_action,
|
R.string.call_notification_answer_action,
|
||||||
mAnswerButtonColor, R.color.call_notification_answer_color,
|
R.color.call_notification_answer_color, mAnswerIntent);
|
||||||
mAnswerIntent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private Action makeAction(@NonNull StandardTemplateParams p,
|
private Action makeAction(@DrawableRes int icon, @StringRes int title,
|
||||||
@DrawableRes int icon, @StringRes int title,
|
@ColorRes int colorRes, PendingIntent intent) {
|
||||||
@ColorInt Integer colorInt, @ColorRes int defaultColorRes, PendingIntent intent) {
|
|
||||||
if (colorInt == null || !mBuilder.isCallActionColorCustomizable(p)) {
|
|
||||||
colorInt = mBuilder.mContext.getColor(defaultColorRes);
|
|
||||||
}
|
|
||||||
Action action = new Action.Builder(Icon.createWithResource("", icon),
|
Action action = new Action.Builder(Icon.createWithResource("", icon),
|
||||||
new SpannableStringBuilder().append(mBuilder.mContext.getString(title),
|
new SpannableStringBuilder().append(mBuilder.mContext.getString(title),
|
||||||
new ForegroundColorSpan(colorInt),
|
new ForegroundColorSpan(mBuilder.mContext.getColor(colorRes)),
|
||||||
SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE),
|
SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE),
|
||||||
intent).build();
|
intent).build();
|
||||||
action.getExtras().putBoolean(KEY_ACTION_PRIORITY, true);
|
action.getExtras().putBoolean(KEY_ACTION_PRIORITY, true);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Action> makeActionsList(@NonNull StandardTemplateParams p) {
|
private ArrayList<Action> makeActionsList() {
|
||||||
final Action negativeAction = makeNegativeAction(p);
|
final Action negativeAction = makeNegativeAction();
|
||||||
final Action answerAction = makeAnswerAction(p);
|
final Action answerAction = makeAnswerAction();
|
||||||
|
|
||||||
ArrayList<Action> actions = new ArrayList<>(MAX_ACTION_BUTTONS);
|
ArrayList<Action> actions = new ArrayList<>(MAX_ACTION_BUTTONS);
|
||||||
final Action lastAction;
|
final Action lastAction;
|
||||||
@@ -9404,7 +9356,7 @@ public class Notification implements Parcelable
|
|||||||
|
|
||||||
// Create the buttons for the generated actions list.
|
// Create the buttons for the generated actions list.
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Action action : makeActionsList(p)) {
|
for (Action action : makeActionsList()) {
|
||||||
final RemoteViews button = mBuilder.generateActionButton(action, emphasizedMode, p);
|
final RemoteViews button = mBuilder.generateActionButton(action, emphasizedMode, p);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
// Clear start margin from non-first buttons to reduce the gap between buttons.
|
// Clear start margin from non-first buttons to reduce the gap between buttons.
|
||||||
@@ -9469,12 +9421,6 @@ public class Notification implements Parcelable
|
|||||||
if (mHangUpIntent != null) {
|
if (mHangUpIntent != null) {
|
||||||
extras.putParcelable(EXTRA_HANG_UP_INTENT, mHangUpIntent);
|
extras.putParcelable(EXTRA_HANG_UP_INTENT, mHangUpIntent);
|
||||||
}
|
}
|
||||||
if (mAnswerButtonColor != null) {
|
|
||||||
extras.putInt(EXTRA_ANSWER_COLOR, mAnswerButtonColor);
|
|
||||||
}
|
|
||||||
if (mDeclineButtonColor != null) {
|
|
||||||
extras.putInt(EXTRA_DECLINE_COLOR, mDeclineButtonColor);
|
|
||||||
}
|
|
||||||
fixTitleAndTextExtras(extras);
|
fixTitleAndTextExtras(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9501,10 +9447,6 @@ public class Notification implements Parcelable
|
|||||||
mAnswerIntent = extras.getParcelable(EXTRA_ANSWER_INTENT);
|
mAnswerIntent = extras.getParcelable(EXTRA_ANSWER_INTENT);
|
||||||
mDeclineIntent = extras.getParcelable(EXTRA_DECLINE_INTENT);
|
mDeclineIntent = extras.getParcelable(EXTRA_DECLINE_INTENT);
|
||||||
mHangUpIntent = extras.getParcelable(EXTRA_HANG_UP_INTENT);
|
mHangUpIntent = extras.getParcelable(EXTRA_HANG_UP_INTENT);
|
||||||
mAnswerButtonColor = extras.containsKey(EXTRA_ANSWER_COLOR)
|
|
||||||
? extras.getInt(EXTRA_ANSWER_COLOR) : null;
|
|
||||||
mDeclineButtonColor = extras.containsKey(EXTRA_DECLINE_COLOR)
|
|
||||||
? extras.getInt(EXTRA_DECLINE_COLOR) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1173,9 +1173,6 @@
|
|||||||
<!-- Default value for LED off time when the battery is low on charge in miliseconds -->
|
<!-- Default value for LED off time when the battery is low on charge in miliseconds -->
|
||||||
<integer name="config_notificationsBatteryLedOff">2875</integer>
|
<integer name="config_notificationsBatteryLedOff">2875</integer>
|
||||||
|
|
||||||
<!-- If true, only colorized CallStyle notifications will apply custom colors -->
|
|
||||||
<bool name="config_callNotificationActionColorsRequireColorized">true</bool>
|
|
||||||
|
|
||||||
<!-- Number of notifications to keep in the notification service historical archive -->
|
<!-- Number of notifications to keep in the notification service historical archive -->
|
||||||
<integer name="config_notificationServiceArchiveSize">100</integer>
|
<integer name="config_notificationServiceArchiveSize">100</integer>
|
||||||
|
|
||||||
|
|||||||
@@ -2286,7 +2286,6 @@
|
|||||||
<java-symbol type="string" name="config_wifi_tether_enable" />
|
<java-symbol type="string" name="config_wifi_tether_enable" />
|
||||||
<java-symbol type="bool" name="config_intrusiveNotificationLed" />
|
<java-symbol type="bool" name="config_intrusiveNotificationLed" />
|
||||||
<java-symbol type="bool" name="config_notificationBadging" />
|
<java-symbol type="bool" name="config_notificationBadging" />
|
||||||
<java-symbol type="bool" name="config_callNotificationActionColorsRequireColorized" />
|
|
||||||
<java-symbol type="dimen" name="preference_fragment_padding_bottom" />
|
<java-symbol type="dimen" name="preference_fragment_padding_bottom" />
|
||||||
<java-symbol type="dimen" name="preference_fragment_padding_side" />
|
<java-symbol type="dimen" name="preference_fragment_padding_side" />
|
||||||
<java-symbol type="drawable" name="expander_ic_maximized" />
|
<java-symbol type="drawable" name="expander_ic_maximized" />
|
||||||
|
|||||||
Reference in New Issue
Block a user