diff options
13 files changed, 6 insertions, 215 deletions
diff --git a/config/hiddenapi-max-target-o.txt b/config/hiddenapi-max-target-o.txt index eefe493efbc4..592b4aedf952 100644 --- a/config/hiddenapi-max-target-o.txt +++ b/config/hiddenapi-max-target-o.txt @@ -92442,7 +92442,6 @@ Lcom/android/internal/R$id;->remote_input_send:I Lcom/android/internal/R$id;->replaceText:I Lcom/android/internal/R$id;->replace_app_icon:I Lcom/android/internal/R$id;->replace_message:I -Lcom/android/internal/R$id;->reply_icon_action:I Lcom/android/internal/R$id;->resolver_list:I Lcom/android/internal/R$id;->rew:I Lcom/android/internal/R$id;->rightSpacer:I diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 113ec4df3c9f..1e673cf0305c 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -4884,7 +4884,7 @@ public class Notification implements Parcelable final Bundle ex = mN.extras; updateBackgroundColor(contentView, p); bindNotificationHeader(contentView, p); - bindLargeIconAndReply(contentView, p, result); + bindLargeIconAndApplyMargin(contentView, p, result); boolean showProgress = handleProgressBar(contentView, ex, p); if (p.title != null && p.title.length() > 0) { contentView.setViewVisibility(R.id.title, View.VISIBLE); @@ -5101,16 +5101,14 @@ public class Notification implements Parcelable } } - private void bindLargeIconAndReply(RemoteViews contentView, + private void bindLargeIconAndApplyMargin(RemoteViews contentView, @NonNull StandardTemplateParams p, @Nullable TemplateBindResult result) { if (result == null) { result = new TemplateBindResult(); } boolean largeIconShown = bindLargeIcon(contentView, p); - boolean replyIconShown = bindReplyIcon(contentView, p); calculateLargeIconMarginEnd(largeIconShown, result); - calculateReplyIconMarginEnd(replyIconShown, result); if (p.mHeaderless) { // views in the headerless (collapsed) state contentView.setViewLayoutMarginEnd(R.id.notification_standard_view_column, @@ -5138,21 +5136,6 @@ public class Notification implements Parcelable result.setRightIconState(largeIconShown, extraMarginEnd, expanderSize); } - private void calculateReplyIconMarginEnd(boolean replyIconShown, - @NonNull TemplateBindResult result) { - int marginEnd = 0; - if (replyIconShown) { - int iconSize = mContext.getResources().getDimensionPixelSize( - R.dimen.notification_reply_icon_size); - int contentMargin = mContext.getResources().getDimensionPixelSize( - R.dimen.notification_content_margin_end); - int replyInset = mContext.getResources().getDimensionPixelSize( - R.dimen.notification_reply_inset); - marginEnd = iconSize + contentMargin - replyInset * 2; - } - result.setReplyIconState(replyIconShown, marginEnd); - } - /** * Bind the large icon. * @return if the largeIcon is visible @@ -5173,48 +5156,6 @@ public class Notification implements Parcelable return showLargeIcon; } - /** - * Bind the reply icon. - * @return if the reply icon is visible - */ - private boolean bindReplyIcon(RemoteViews contentView, StandardTemplateParams p) { - boolean actionVisible = !p.hideReplyIcon && !p.mHeaderless; - Action action = null; - if (actionVisible) { - action = findReplyAction(); - actionVisible = action != null; - } - if (actionVisible) { - contentView.setViewVisibility(R.id.reply_icon_action, View.VISIBLE); - contentView.setDrawableTint(R.id.reply_icon_action, - false /* targetBackground */, - getNeutralColor(p), - PorterDuff.Mode.SRC_ATOP); - contentView.setOnClickPendingIntent(R.id.reply_icon_action, action.actionIntent); - contentView.setRemoteInputs(R.id.reply_icon_action, action.mRemoteInputs); - } else { - contentView.setRemoteInputs(R.id.reply_icon_action, null); - } - contentView.setViewVisibility(R.id.reply_icon_action, - actionVisible ? View.VISIBLE : View.GONE); - return actionVisible; - } - - private Action findReplyAction() { - ArrayList<Action> actions = mActions; - if (mOriginalActions != null) { - actions = mOriginalActions; - } - int numActions = actions.size(); - for (int i = 0; i < numActions; i++) { - Action action = actions.get(i); - if (hasValidRemoteInput(action)) { - return action; - } - } - return null; - } - private void bindNotificationHeader(RemoteViews contentView, StandardTemplateParams p) { bindSmallIcon(contentView, p); bindHeaderAppName(contentView, p); @@ -7131,10 +7072,7 @@ public class Notification implements Parcelable StandardTemplateParams p = mBuilder.mParams.reset() .viewType(StandardTemplateParams.VIEW_TYPE_BIG) .fillTextsFrom(mBuilder).text(null); - TemplateBindResult result = new TemplateBindResult(); - RemoteViews contentView = getStandardView(mBuilder.getBigTextLayoutResource(), p, - result); - contentView.setInt(R.id.big_text, "setImageEndMargin", result.getTextMarginEnd()); + RemoteViews contentView = getStandardView(mBuilder.getBigTextLayoutResource(), p, null); CharSequence bigTextText = mBuilder.processLegacyText(mBigText); if (TextUtils.isEmpty(bigTextText)) { @@ -7147,8 +7085,6 @@ public class Notification implements Parcelable mBuilder.setTextViewColorSecondary(contentView, R.id.big_text, p); contentView.setViewVisibility(R.id.big_text, TextUtils.isEmpty(bigTextText) ? View.GONE : View.VISIBLE); - contentView.setBoolean(R.id.big_text, "setHasImage", - result.isReplyIconVisible()); return contentView; } @@ -7738,7 +7674,6 @@ public class Notification implements Parcelable .title(conversationTitle) .text(null) .hideLargeIcon(hideRightIcons || isOneToOne) - .hideReplyIcon(hideRightIcons) .headerTextSecondary(conversationTitle); RemoteViews contentView = mBuilder.applyStandardTemplateWithActions( isConversationLayout @@ -10998,8 +10933,6 @@ public class Notification implements Parcelable boolean mRightIconVisible; int mRightIconMarginEnd; int mExpanderSize; - boolean mReplyIconVisible; - int mReplyIconMarginEnd; /** * @return the margin end that needs to be added to the heading so that it won't overlap @@ -11023,31 +10956,11 @@ public class Notification implements Parcelable /** * @return the margin end that needs to be added to the title text of the big state - * so that it won't overlap with either the large icon or the reply action. + * so that it won't overlap with the large icon, but assuming the text can run under + * the expander when that icon is not visible. */ public int getTitleMarginEnd() { - return mRightIconVisible ? getHeadingFullMarginEnd() : mReplyIconMarginEnd; - } - - /** - * @return the margin end that needs to be added to the topmost content of the big state - * so that it won't overlap with the reply action. - */ - public int getTextMarginEnd() { - return mReplyIconMarginEnd; - } - - /** - * Is the icon container visible on the right size because of the reply button or the - * right icon. - */ - public boolean isReplyIconVisible() { - return mReplyIconVisible; - } - - public void setReplyIconState(boolean visible, int marginEnd) { - mReplyIconVisible = visible; - mReplyIconMarginEnd = marginEnd; + return mRightIconVisible ? getHeadingFullMarginEnd() : 0; } public void setRightIconState(boolean visible, int marginEnd, int expanderSize) { @@ -11074,7 +10987,6 @@ public class Notification implements Parcelable CharSequence summaryText; int maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES; boolean hideLargeIcon; - boolean hideReplyIcon; boolean allowColorization = true; boolean forceDefaultColor = false; @@ -11132,11 +11044,6 @@ public class Notification implements Parcelable return this; } - final StandardTemplateParams hideReplyIcon(boolean hideReplyIcon) { - this.hideReplyIcon = hideReplyIcon; - return this; - } - final StandardTemplateParams disallowColorization() { this.allowColorization = false; return this; diff --git a/core/res/res/drawable/ic_reply_notification.xml b/core/res/res/drawable/ic_reply_notification.xml deleted file mode 100644 index a9864b09207a..000000000000 --- a/core/res/res/drawable/ic_reply_notification.xml +++ /dev/null @@ -1,32 +0,0 @@ -<!-- - ~ Copyright (C) 2017 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 - --> -<inset xmlns:android="http://schemas.android.com/apk/res/android" - android:inset="@dimen/notification_reply_inset"> - <vector android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - - <path - android:fillColor="#000000" - android:strokeWidth="1" - android:pathData="M16,10 L6.83,10 L9,7.83 L10.41,6.42 L9,5 L3,11 L9,17 L10.41,15.59 L9,14.17 L6.83,12 L16,12 C17.65,12 19,13.35 19,15 L19,19 L21,19 L21,15 C21,12.24 18.76,10 16,10 Z" /> - <path - android:fillColor="#000000" - android:strokeWidth="1" - android:pathData="M16,10 L6.83,10 L9,7.83 L10.41,6.42 L9,5 L3,11 L9,17 L10.41,15.59 L9,14.17 L6.83,12 L16,12 C17.65,12 19,13.35 19,15 L19,19 L21,19 L21,15 C21,12.24 18.76,10 16,10 Z" /> - </vector> -</inset> diff --git a/core/res/res/layout/notification_template_material_big_base.xml b/core/res/res/layout/notification_template_material_big_base.xml index c9592a793cdf..36903fffb26c 100644 --- a/core/res/res/layout/notification_template_material_big_base.xml +++ b/core/res/res/layout/notification_template_material_big_base.xml @@ -67,7 +67,6 @@ </LinearLayout> <include layout="@layout/notification_template_right_icon" /> - <include layout="@layout/notification_template_reply_icon" /> </FrameLayout> <ViewStub diff --git a/core/res/res/layout/notification_template_material_big_picture.xml b/core/res/res/layout/notification_template_material_big_picture.xml index dd975eb27ac9..91243b8eb9dc 100644 --- a/core/res/res/layout/notification_template_material_big_picture.xml +++ b/core/res/res/layout/notification_template_material_big_picture.xml @@ -31,8 +31,6 @@ <include layout="@layout/notification_template_right_icon" /> - <include layout="@layout/notification_template_reply_icon" /> - <LinearLayout android:id="@+id/notification_action_list_margin_target" android:layout_width="match_parent" diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml index 117991bc6beb..b8e827d7d10f 100644 --- a/core/res/res/layout/notification_template_material_big_text.xml +++ b/core/res/res/layout/notification_template_material_big_text.xml @@ -96,5 +96,4 @@ </com.android.internal.widget.RemeasuringLinearLayout> <include layout="@layout/notification_template_right_icon" /> - <include layout="@layout/notification_template_reply_icon" /> </FrameLayout> diff --git a/core/res/res/layout/notification_template_material_inbox.xml b/core/res/res/layout/notification_template_material_inbox.xml index 4bf70736b883..eb8925819cd3 100644 --- a/core/res/res/layout/notification_template_material_inbox.xml +++ b/core/res/res/layout/notification_template_material_inbox.xml @@ -129,5 +129,4 @@ <include layout="@layout/notification_material_action_list" /> </LinearLayout> <include layout="@layout/notification_template_right_icon" /> - <include layout="@layout/notification_template_reply_icon" /> </FrameLayout> diff --git a/core/res/res/layout/notification_template_material_messaging.xml b/core/res/res/layout/notification_template_material_messaging.xml index f37bda5cc5f6..de9814b9f1f1 100644 --- a/core/res/res/layout/notification_template_material_messaging.xml +++ b/core/res/res/layout/notification_template_material_messaging.xml @@ -58,5 +58,4 @@ <include layout="@layout/notification_material_action_list" /> </com.android.internal.widget.RemeasuringLinearLayout> <include layout="@layout/notification_template_right_icon" /> - <include layout="@layout/notification_template_reply_icon" /> </com.android.internal.widget.MessagingLayout> diff --git a/core/res/res/layout/notification_template_reply_icon.xml b/core/res/res/layout/notification_template_reply_icon.xml deleted file mode 100644 index 695f7c8b5c6f..000000000000 --- a/core/res/res/layout/notification_template_reply_icon.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2015 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 - --> -<ImageView xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/reply_icon_action" - android:layout_width="@dimen/notification_reply_icon_size" - android:layout_height="@dimen/notification_reply_icon_size" - android:layout_gravity="top|end" - android:layout_marginEnd="8dp" - android:layout_marginTop="@dimen/notification_content_margin_top" - android:contentDescription="@string/notification_reply_button_accessibility" - android:scaleType="centerCrop" - android:src="@drawable/ic_reply_notification" /> - diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index a5e5fbf763f7..9c9e3a91a41f 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -216,9 +216,6 @@ <!-- The margin on the end of the top-line content views (accommodates the expander) --> <dimen name="notification_heading_margin_end">48dp</dimen> - <!-- The inset of the reply icon. --> - <dimen name="notification_reply_inset">8dp</dimen> - <!-- The margin for text at the end of the image view for media notifications --> <dimen name="notification_media_image_margin_end">72dp</dimen> @@ -710,8 +707,6 @@ <dimen name="notification_right_icon_size">52dp</dimen> <!-- The top margin of the right icon in the "big" notification states --> <dimen name="notification_right_icon_big_margin_top">16dp</dimen> - <!-- The size of the reply icon --> - <dimen name="notification_reply_icon_size">36dp</dimen> <!-- The alpha of a disabled notification button --> <item type="dimen" format="float" name="notification_action_disabled_alpha">0.5</item> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 065aef50f297..41323c91ea96 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2873,7 +2873,6 @@ <java-symbol type="dimen" name="notification_content_margin_start" /> <java-symbol type="dimen" name="notification_content_margin_end" /> <java-symbol type="dimen" name="notification_heading_margin_end" /> - <java-symbol type="dimen" name="notification_reply_inset" /> <java-symbol type="dimen" name="notification_content_margin_top" /> <java-symbol type="dimen" name="notification_content_margin" /> <java-symbol type="dimen" name="notification_header_background_height" /> @@ -3379,7 +3378,6 @@ <java-symbol type="dimen" name="notification_media_image_max_width"/> <java-symbol type="dimen" name="notification_media_image_max_height"/> <java-symbol type="dimen" name="notification_right_icon_size"/> - <java-symbol type="dimen" name="notification_reply_icon_size"/> <java-symbol type="dimen" name="notification_custom_view_max_image_height"/> <java-symbol type="dimen" name="notification_custom_view_max_image_width"/> @@ -3400,7 +3398,6 @@ <java-symbol type="bool" name="config_allowEscrowTokenForTrustAgent"/> <java-symbol type="string" name="config_defaultTrustAgent" /> - <java-symbol type="id" name="reply_icon_action"/> <java-symbol type="id" name="toggle_mode"/> <java-symbol type="id" name="input_mode"/> <java-symbol type="id" name="input_header"/> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java index 9a8cff0f8dc1..20d10d3e0a6c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java @@ -456,9 +456,6 @@ public class TransformState { if (view instanceof ImageView) { ImageTransformState result = ImageTransformState.obtain(); result.initFrom(view, transformInfo); - if (view.getId() == com.android.internal.R.id.reply_icon_action) { - ((TransformState) result).setIsSameAsAnyView(true); - } return result; } if (view instanceof ProgressBar) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java index 76ec59e0ec28..4f2cf6e4c165 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java @@ -22,8 +22,6 @@ import android.app.PendingIntent; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Color; -import android.graphics.PorterDuffColorFilter; -import android.graphics.drawable.Drawable; import android.service.notification.StatusBarNotification; import android.util.ArraySet; import android.view.View; @@ -56,7 +54,6 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp private TextView mTitle; private TextView mText; protected View mActionsContainer; - private ImageView mReplyAction; private int mContentHeight; private int mMinHeightHint; @@ -156,7 +153,6 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp } mActionsContainer = mView.findViewById(com.android.internal.R.id.actions_container); mActions = mView.findViewById(com.android.internal.R.id.actions); - mReplyAction = mView.findViewById(com.android.internal.R.id.reply_icon_action); mRemoteInputHistory = mView.findViewById( com.android.internal.R.id.notification_material_reply_container); updatePendingIntentCancellations(); @@ -190,31 +186,6 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp }); } } - if (mReplyAction != null) { - // Let's reset the view on update, assuming the new pending intent isn't cancelled - // anymore. The color filter automatically resets when it's updated. - mReplyAction.setEnabled(true); - performOnPendingIntentCancellation(mReplyAction, () -> { - if (mReplyAction != null && mReplyAction.isEnabled()) { - mReplyAction.setEnabled(false); - // The visual appearance doesn't look disabled enough yet, let's add the - // alpha as well. Since Alpha doesn't play nicely right now with the - // transformation, we rather blend it manually with the background color. - Drawable drawable = mReplyAction.getDrawable().mutate(); - PorterDuffColorFilter colorFilter = - (PorterDuffColorFilter) drawable.getColorFilter(); - float disabledAlpha = mView.getResources().getFloat( - com.android.internal.R.dimen.notification_action_disabled_alpha); - if (colorFilter != null) { - int color = colorFilter.getColor(); - color = blendColorWithBackground(color, disabledAlpha); - drawable.mutate().setColorFilter(color, colorFilter.getMode()); - } else { - mReplyAction.setAlpha(disabledAlpha); - } - } - }); - } } private int blendColorWithBackground(int color, float alpha) { @@ -260,16 +231,6 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp } @Override - public boolean disallowSingleClick(float x, float y) { - if (mReplyAction != null && mReplyAction.getVisibility() == View.VISIBLE) { - if (isOnView(mReplyAction, x, y) || isOnView(mPicture, x, y)) { - return true; - } - } - return super.disallowSingleClick(x, y); - } - - @Override public void onContentUpdated(ExpandableNotificationRow row) { // Reinspect the notification. Before the super call, because the super call also updates // the transformation types and we need to have our values set by then. |