Loading core/java/android/app/Notification.java +58 −4 Original line number Diff line number Diff line Loading @@ -4924,7 +4924,8 @@ public class Notification implements Parcelable CharSequence[] replyText = mN.extras.getCharSequenceArray(EXTRA_REMOTE_INPUT_HISTORY); if (!p.ambient && validRemoteInput && replyText != null && replyText.length > 0 && !TextUtils.isEmpty(replyText[0])) { && replyText.length > 0 && !TextUtils.isEmpty(replyText[0]) && p.maxRemoteInputHistory > 0) { boolean showSpinner = mN.extras.getBoolean(EXTRA_SHOW_REMOTE_INPUT_SPINNER); big.setViewVisibility(R.id.notification_material_reply_container, View.VISIBLE); big.setViewVisibility(R.id.notification_material_reply_text_1_container, Loading @@ -4939,13 +4940,15 @@ public class Notification implements Parcelable ColorStateList.valueOf( isColorized() ? getPrimaryTextColor() : resolveContrastColor())); if (replyText.length > 1 && !TextUtils.isEmpty(replyText[1])) { if (replyText.length > 1 && !TextUtils.isEmpty(replyText[1]) && p.maxRemoteInputHistory > 1) { big.setViewVisibility(R.id.notification_material_reply_text_2, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_2, processTextSpans(replyText[1])); setTextViewColorSecondary(big, R.id.notification_material_reply_text_2); if (replyText.length > 2 && !TextUtils.isEmpty(replyText[2])) { if (replyText.length > 2 && !TextUtils.isEmpty(replyText[2]) && p.maxRemoteInputHistory > 2) { big.setViewVisibility( R.id.notification_material_reply_text_3, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_3, Loading Loading @@ -5108,7 +5111,13 @@ public class Notification implements Parcelable return null; } return applyStandardTemplateWithActions(getBigBaseLayoutResource(), null /* result */); // We only want at most a single remote input history to be shown here, otherwise // the content would become squished. StandardTemplateParams p = mParams.reset().fillTextsFrom(this) .setMaxRemoteInputHistory(1); return applyStandardTemplateWithActions(getBigBaseLayoutResource(), p, null /* result */); } /** Loading Loading @@ -5977,6 +5986,12 @@ public class Notification implements Parcelable * object. */ public static abstract class Style { /** * The number of items allowed simulatanously in the remote input history. * @hide */ static final int MAX_REMOTE_INPUT_HISTORY_LINES = 3; private CharSequence mBigContentTitle; /** Loading Loading @@ -7436,6 +7451,11 @@ public class Notification implements Parcelable * @see Notification#bigContentView */ public static class InboxStyle extends Style { /** * The number of lines of remote input history allowed until we start reducing lines. */ private static final int NUMBER_OF_HISTORY_ALLOWED_UNTIL_REDUCTION = 1; private ArrayList<CharSequence> mTexts = new ArrayList<CharSequence>(5); public InboxStyle() { Loading Loading @@ -7535,6 +7555,28 @@ public class Notification implements Parcelable if (mBuilder.mActions.size() > 0) { maxRows--; } CharSequence[] remoteInputHistory = mBuilder.mN.extras.getCharSequenceArray( EXTRA_REMOTE_INPUT_HISTORY); if (remoteInputHistory != null && remoteInputHistory.length > NUMBER_OF_HISTORY_ALLOWED_UNTIL_REDUCTION) { // Let's remove some messages to make room for the remote input history. // 1 is always able to fit, but let's remove them if they are 2 or 3 int numRemoteInputs = Math.min(remoteInputHistory.length, MAX_REMOTE_INPUT_HISTORY_LINES); int totalNumRows = mTexts.size() + numRemoteInputs - NUMBER_OF_HISTORY_ALLOWED_UNTIL_REDUCTION; if (totalNumRows > maxRows) { int overflow = totalNumRows - maxRows; if (mTexts.size() > maxRows) { // Heuristic: if the Texts don't fit anyway, we'll rather drop the last // few messages, even with the remote input maxRows -= overflow; } else { // otherwise we drop the first messages i = overflow; } } } while (i < mTexts.size() && i < maxRows) { CharSequence str = mTexts.get(i); if (!TextUtils.isEmpty(str)) { Loading Loading @@ -9605,6 +9647,7 @@ public class Notification implements Parcelable CharSequence title; CharSequence text; CharSequence headerTextSecondary; int maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES; boolean hideLargeIcon; boolean hideReplyIcon; Loading @@ -9614,6 +9657,7 @@ public class Notification implements Parcelable title = null; text = null; headerTextSecondary = null; maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES; return this; } Loading Loading @@ -9665,5 +9709,15 @@ public class Notification implements Parcelable this.text = b.processLegacyText(text, ambient); return this; } /** * Set the maximum lines of remote input history lines allowed. * @param maxRemoteInputHistory The number of lines. * @return The builder for method chaining. */ public StandardTemplateParams setMaxRemoteInputHistory(int maxRemoteInputHistory) { this.maxRemoteInputHistory = maxRemoteInputHistory; return this; } } } packages/SystemUI/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -960,6 +960,10 @@ add about 88dp of height to the notifications. --> <dimen name="smart_reply_button_max_height">100dp</dimen> <!-- The extra height that we allow a notification with a remote input history to be taller than the regular notification, when we have remote input history texts present. --> <dimen name="remote_input_history_extra_height">60dp</dimen> <!-- Fingerprint Dialog values --> <dimen name="fingerprint_dialog_fp_icon_size">64dp</dimen> <dimen name="fingerprint_dialog_animation_translation_offset">350dp</dimen> Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +1 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public class NotificationContentView extends FrameLayout { if (mExpandedSmartReplyView != null) { notificationMaxHeight += mExpandedSmartReplyView.getHeightUpperLimit(); } notificationMaxHeight += mExpandedWrapper.getExtraMeasureHeight(); int size = notificationMaxHeight; ViewGroup.LayoutParams layoutParams = mExpandedChild.getLayoutParams(); boolean useExactly = false; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java +8 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.widget.TextView; import com.android.internal.util.NotificationColorUtil; import com.android.internal.widget.NotificationActionListLayout; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.UiOffloadThread; import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.ExpandableNotificationRow; Loading @@ -58,6 +59,7 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp private NotificationActionListLayout mActions; private ArraySet<PendingIntent> mCancelledPendingIntents = new ArraySet<>(); private UiOffloadThread mUiOffloadThread; private View mRemoteInputHistory; protected NotificationTemplateViewWrapper(Context ctx, View view, ExpandableNotificationRow row) { Loading Loading @@ -146,6 +148,8 @@ 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(); } Loading Loading @@ -329,6 +333,10 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp if (mActions != null) { extra = mActions.getExtraMeasureHeight(); } if (mRemoteInputHistory != null && mRemoteInputHistory.getVisibility() != View.GONE) { extra += mRow.getContext().getResources().getDimensionPixelSize( R.dimen.remote_input_history_extra_height); } return extra + super.getExtraMeasureHeight(); } } Loading
core/java/android/app/Notification.java +58 −4 Original line number Diff line number Diff line Loading @@ -4924,7 +4924,8 @@ public class Notification implements Parcelable CharSequence[] replyText = mN.extras.getCharSequenceArray(EXTRA_REMOTE_INPUT_HISTORY); if (!p.ambient && validRemoteInput && replyText != null && replyText.length > 0 && !TextUtils.isEmpty(replyText[0])) { && replyText.length > 0 && !TextUtils.isEmpty(replyText[0]) && p.maxRemoteInputHistory > 0) { boolean showSpinner = mN.extras.getBoolean(EXTRA_SHOW_REMOTE_INPUT_SPINNER); big.setViewVisibility(R.id.notification_material_reply_container, View.VISIBLE); big.setViewVisibility(R.id.notification_material_reply_text_1_container, Loading @@ -4939,13 +4940,15 @@ public class Notification implements Parcelable ColorStateList.valueOf( isColorized() ? getPrimaryTextColor() : resolveContrastColor())); if (replyText.length > 1 && !TextUtils.isEmpty(replyText[1])) { if (replyText.length > 1 && !TextUtils.isEmpty(replyText[1]) && p.maxRemoteInputHistory > 1) { big.setViewVisibility(R.id.notification_material_reply_text_2, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_2, processTextSpans(replyText[1])); setTextViewColorSecondary(big, R.id.notification_material_reply_text_2); if (replyText.length > 2 && !TextUtils.isEmpty(replyText[2])) { if (replyText.length > 2 && !TextUtils.isEmpty(replyText[2]) && p.maxRemoteInputHistory > 2) { big.setViewVisibility( R.id.notification_material_reply_text_3, View.VISIBLE); big.setTextViewText(R.id.notification_material_reply_text_3, Loading Loading @@ -5108,7 +5111,13 @@ public class Notification implements Parcelable return null; } return applyStandardTemplateWithActions(getBigBaseLayoutResource(), null /* result */); // We only want at most a single remote input history to be shown here, otherwise // the content would become squished. StandardTemplateParams p = mParams.reset().fillTextsFrom(this) .setMaxRemoteInputHistory(1); return applyStandardTemplateWithActions(getBigBaseLayoutResource(), p, null /* result */); } /** Loading Loading @@ -5977,6 +5986,12 @@ public class Notification implements Parcelable * object. */ public static abstract class Style { /** * The number of items allowed simulatanously in the remote input history. * @hide */ static final int MAX_REMOTE_INPUT_HISTORY_LINES = 3; private CharSequence mBigContentTitle; /** Loading Loading @@ -7436,6 +7451,11 @@ public class Notification implements Parcelable * @see Notification#bigContentView */ public static class InboxStyle extends Style { /** * The number of lines of remote input history allowed until we start reducing lines. */ private static final int NUMBER_OF_HISTORY_ALLOWED_UNTIL_REDUCTION = 1; private ArrayList<CharSequence> mTexts = new ArrayList<CharSequence>(5); public InboxStyle() { Loading Loading @@ -7535,6 +7555,28 @@ public class Notification implements Parcelable if (mBuilder.mActions.size() > 0) { maxRows--; } CharSequence[] remoteInputHistory = mBuilder.mN.extras.getCharSequenceArray( EXTRA_REMOTE_INPUT_HISTORY); if (remoteInputHistory != null && remoteInputHistory.length > NUMBER_OF_HISTORY_ALLOWED_UNTIL_REDUCTION) { // Let's remove some messages to make room for the remote input history. // 1 is always able to fit, but let's remove them if they are 2 or 3 int numRemoteInputs = Math.min(remoteInputHistory.length, MAX_REMOTE_INPUT_HISTORY_LINES); int totalNumRows = mTexts.size() + numRemoteInputs - NUMBER_OF_HISTORY_ALLOWED_UNTIL_REDUCTION; if (totalNumRows > maxRows) { int overflow = totalNumRows - maxRows; if (mTexts.size() > maxRows) { // Heuristic: if the Texts don't fit anyway, we'll rather drop the last // few messages, even with the remote input maxRows -= overflow; } else { // otherwise we drop the first messages i = overflow; } } } while (i < mTexts.size() && i < maxRows) { CharSequence str = mTexts.get(i); if (!TextUtils.isEmpty(str)) { Loading Loading @@ -9605,6 +9647,7 @@ public class Notification implements Parcelable CharSequence title; CharSequence text; CharSequence headerTextSecondary; int maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES; boolean hideLargeIcon; boolean hideReplyIcon; Loading @@ -9614,6 +9657,7 @@ public class Notification implements Parcelable title = null; text = null; headerTextSecondary = null; maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES; return this; } Loading Loading @@ -9665,5 +9709,15 @@ public class Notification implements Parcelable this.text = b.processLegacyText(text, ambient); return this; } /** * Set the maximum lines of remote input history lines allowed. * @param maxRemoteInputHistory The number of lines. * @return The builder for method chaining. */ public StandardTemplateParams setMaxRemoteInputHistory(int maxRemoteInputHistory) { this.maxRemoteInputHistory = maxRemoteInputHistory; return this; } } }
packages/SystemUI/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -960,6 +960,10 @@ add about 88dp of height to the notifications. --> <dimen name="smart_reply_button_max_height">100dp</dimen> <!-- The extra height that we allow a notification with a remote input history to be taller than the regular notification, when we have remote input history texts present. --> <dimen name="remote_input_history_extra_height">60dp</dimen> <!-- Fingerprint Dialog values --> <dimen name="fingerprint_dialog_fp_icon_size">64dp</dimen> <dimen name="fingerprint_dialog_animation_translation_offset">350dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +1 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public class NotificationContentView extends FrameLayout { if (mExpandedSmartReplyView != null) { notificationMaxHeight += mExpandedSmartReplyView.getHeightUpperLimit(); } notificationMaxHeight += mExpandedWrapper.getExtraMeasureHeight(); int size = notificationMaxHeight; ViewGroup.LayoutParams layoutParams = mExpandedChild.getLayoutParams(); boolean useExactly = false; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java +8 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.widget.TextView; import com.android.internal.util.NotificationColorUtil; import com.android.internal.widget.NotificationActionListLayout; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.UiOffloadThread; import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.ExpandableNotificationRow; Loading @@ -58,6 +59,7 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp private NotificationActionListLayout mActions; private ArraySet<PendingIntent> mCancelledPendingIntents = new ArraySet<>(); private UiOffloadThread mUiOffloadThread; private View mRemoteInputHistory; protected NotificationTemplateViewWrapper(Context ctx, View view, ExpandableNotificationRow row) { Loading Loading @@ -146,6 +148,8 @@ 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(); } Loading Loading @@ -329,6 +333,10 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp if (mActions != null) { extra = mActions.getExtraMeasureHeight(); } if (mRemoteInputHistory != null && mRemoteInputHistory.getVisibility() != View.GONE) { extra += mRow.getContext().getResources().getDimensionPixelSize( R.dimen.remote_input_history_extra_height); } return extra + super.getExtraMeasureHeight(); } }