Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cee4f02 authored by Julia Tuttle's avatar Julia Tuttle
Browse files

CallStyle: add flag for new action layout

Now that there's a bugfix flow for flags, we can use a real flag instead
of a makeshift boolean!

Bug: 268733030
Flag: ACONFIG com.android.systemui.new_call_style_action_layout DEVELOPMENT
Test: manual: disable/enable flag, post callstyle notif, observe actions
Change-Id: I6df281cc7d6850b9bc4cd156c699f970f3a661b5
parent 1927527c
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.app.admin.DevicePolicyResources.Drawables.WORK_PROFILE_ICO
import static android.app.admin.DevicePolicyResources.UNDEFINED;
import static android.graphics.drawable.Icon.TYPE_URI;
import static android.graphics.drawable.Icon.TYPE_URI_ADAPTIVE_BITMAP;
import static android.app.Flags.evenlyDividedCallStyleActionLayout;
import static java.util.Objects.requireNonNull;
@@ -5957,7 +5958,7 @@ public class Notification implements Parcelable
                // there is enough space to do so (and fall back to the left edge if not).
                big.setInt(R.id.actions, "setCollapsibleIndentDimen",
                        R.dimen.call_notification_collapsible_indent);
                if (CallStyle.USE_NEW_ACTION_LAYOUT) {
                if (evenlyDividedCallStyleActionLayout()) {
                    if (CallStyle.DEBUG_NEW_ACTION_LAYOUT) {
                        Log.d(TAG, "setting evenly divided mode on action list");
                    }
@@ -6439,7 +6440,7 @@ public class Notification implements Parcelable
                    title = ContrastColorUtil.ensureColorSpanContrast(title, buttonFillColor);
                }
                final CharSequence label = ensureColorSpanContrast(title, p);
                if (p.mCallStyleActions && CallStyle.USE_NEW_ACTION_LAYOUT) {
                if (p.mCallStyleActions && evenlyDividedCallStyleActionLayout()) {
                    if (CallStyle.DEBUG_NEW_ACTION_LAYOUT) {
                        Log.d(TAG, "new action layout enabled, gluing instead of setting text");
                    }
@@ -6463,7 +6464,7 @@ public class Notification implements Parcelable
                button.setColorStateList(R.id.action0, "setButtonBackground",
                        ColorStateList.valueOf(buttonFillColor));
                if (p.mCallStyleActions) {
                    if (CallStyle.USE_NEW_ACTION_LAYOUT) {
                    if (evenlyDividedCallStyleActionLayout()) {
                        if (CallStyle.DEBUG_NEW_ACTION_LAYOUT) {
                            Log.d(TAG, "new action layout enabled, gluing instead of setting icon");
                        }
@@ -9597,11 +9598,6 @@ public class Notification implements Parcelable
     * </pre>
     */
    public static class CallStyle extends Style {
        /**
         * @hide
         */
        public static final boolean USE_NEW_ACTION_LAYOUT = false;
        /**
         * @hide
         */
+10 −0
Original line number Diff line number Diff line
@@ -57,3 +57,13 @@ flag {
  description: "This flag enables the API to allow setting VibrationEffect for NotificationChannels"
  bug: "241732519"
}

flag {
  name: "evenly_divided_call_style_action_layout"
  namespace: "systemui"
  description: "Evenly divides horizontal space for action buttons in CallStyle notifications."
  bug: "268733030"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
 No newline at end of file
+4 −4
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

package com.android.internal.widget;

import static android.app.Flags.evenlyDividedCallStyleActionLayout;
import static android.app.Notification.CallStyle.DEBUG_NEW_ACTION_LAYOUT;
import static android.app.Notification.CallStyle.USE_NEW_ACTION_LAYOUT;
import static android.text.style.DynamicDrawableSpan.ALIGN_CENTER;

import android.annotation.NonNull;
@@ -166,7 +166,7 @@ public class EmphasizedNotificationButton extends Button {
    }

    private void setIconToGlue(@Nullable Drawable icon) {
        if (!USE_NEW_ACTION_LAYOUT) {
        if (!evenlyDividedCallStyleActionLayout()) {
            Log.e(TAG, "glueIcon: new action layout disabled; doing nothing");
            return;
        }
@@ -207,7 +207,7 @@ public class EmphasizedNotificationButton extends Button {
    }

    private void setLabelToGlue(@Nullable CharSequence label) {
        if (!USE_NEW_ACTION_LAYOUT) {
        if (!evenlyDividedCallStyleActionLayout()) {
            Log.e(TAG, "glueLabel: new action layout disabled; doing nothing");
            return;
        }
@@ -255,7 +255,7 @@ public class EmphasizedNotificationButton extends Button {
            return;
        }

        if (!USE_NEW_ACTION_LAYOUT) {
        if (!evenlyDividedCallStyleActionLayout()) {
            Log.e(TAG, "glueIconAndLabelIfNeeded: new action layout disabled; doing nothing");
            return;
        }
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.internal.widget;

import static android.app.Notification.CallStyle.DEBUG_NEW_ACTION_LAYOUT;
import static android.app.Notification.CallStyle.USE_NEW_ACTION_LAYOUT;
import static android.app.Flags.evenlyDividedCallStyleActionLayout;

import android.annotation.DimenRes;
import android.app.Notification;
@@ -410,7 +410,7 @@ public class NotificationActionListLayout extends LinearLayout {
     */
    @RemotableViewMethod
    public void setEvenlyDividedMode(boolean evenlyDividedMode) {
        if (evenlyDividedMode && !USE_NEW_ACTION_LAYOUT) {
        if (evenlyDividedMode && !evenlyDividedCallStyleActionLayout()) {
            Log.e(TAG, "setEvenlyDividedMode(true) called with new action layout disabled; "
                    + "leaving evenly divided mode disabled");
            return;