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

Commit 49251b67 authored by Chloris Kuo's avatar Chloris Kuo
Browse files

Feedback Inline Setting change

Show change status in inline setting description

Bug: 173460479
Test: atest com.android.systemui.statusbar.notification
Change-Id: Icda82041e6248b6430b58fcec03084aeb2754861
parent 5965368e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1876,6 +1876,18 @@
    <!-- [CHAR LIMIT=150] Notification Importance title: automatic importance level summary -->
    <string name="notification_channel_summary_automatic">Have the system determine if this notification should make sound or vibration</string>

    <!-- [CHAR LIMIT=150] Notification Importance title: automatic importance level summary (alerted) -->
    <string name="notification_channel_summary_automatic_alerted">&lt;b>Status:&lt;/b> Promoted to Default</string>

    <!-- [CHAR LIMIT=150] Notification Importance title: automatic importance level summary (silenced) -->
    <string name="notification_channel_summary_automatic_silenced">&lt;b>Status:&lt;/b> Demoted to Silent</string>

    <!-- [CHAR LIMIT=150] Notification Importance title: automatic importance level summary (promoted) -->
    <string name="notification_channel_summary_automatic_promoted">&lt;b>Status:&lt;/b> Ranked Higher</string>

    <!-- [CHAR LIMIT=150] Notification Importance title: automatic importance level summary (demoted) -->
    <string name="notification_channel_summary_automatic_demoted">&lt;b>Status:&lt;/b> Ranked Lower</string>

    <!-- [CHAR LIMIT=150] Notification Importance title: important conversation level summary -->
    <string name="notification_channel_summary_priority">Shows at top of conversation section, appears as floating bubble, displays profile picture on lock screen</string>

+24 −0
Original line number Diff line number Diff line
@@ -149,4 +149,28 @@ public class AssistantFeedbackController extends ContentObserver {
                return 0;
        }
    }

    /**
     * Get the inline settings description resource according to assistant's changes on this
     * notification's rank or importance.
     *
     * @param entry Notification Entry to show feedback for
     */
    public int getInlineDescriptionResource(NotificationEntry entry) {
        int feedbackStatus = getFeedbackStatus(entry);
        switch (feedbackStatus) {
            case STATUS_ALERTED:
                return com.android.systemui.R.string.notification_channel_summary_automatic_alerted;
            case STATUS_SILENCED:
                return com.android.systemui.R.string
                        .notification_channel_summary_automatic_silenced;
            case STATUS_PROMOTED:
                return com.android.systemui.R.string
                        .notification_channel_summary_automatic_promoted;
            case STATUS_DEMOTED:
                return com.android.systemui.R.string.notification_channel_summary_automatic_demoted;
            default:
                return com.android.systemui.R.string.notification_channel_summary_automatic;
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
                mDeviceProvisionedController.isDeviceProvisioned(),
                row.getIsNonblockable(),
                mHighPriorityProvider.isHighPriority(row.getEntry()),
                mAssistantFeedbackController.isFeedbackEnabled());
                mAssistantFeedbackController);
    }

    /**
+8 −2
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.metrics.LogMaker;
import android.os.Handler;
import android.os.RemoteException;
import android.service.notification.StatusBarNotification;
import android.text.Html;
import android.text.TextUtils;
import android.transition.ChangeBounds;
import android.transition.Fade;
@@ -60,6 +61,7 @@ import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.AssistantFeedbackController;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;

import java.lang.annotation.Retention;
@@ -96,6 +98,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
    private PackageManager mPm;
    private MetricsLogger mMetricsLogger;
    private ChannelEditorDialogController mChannelEditorDialogController;
    private AssistantFeedbackController mAssistantFeedbackController;

    private String mPackageName;
    private String mAppName;
@@ -200,12 +203,13 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
            boolean isDeviceProvisioned,
            boolean isNonblockable,
            boolean wasShownHighPriority,
            boolean showAutomaticSetting)
            AssistantFeedbackController assistantFeedbackController)
            throws RemoteException {
        mINotificationManager = iNotificationManager;
        mMetricsLogger = Dependency.get(MetricsLogger.class);
        mOnUserInteractionCallback = onUserInteractionCallback;
        mChannelEditorDialogController = channelEditorDialogController;
        mAssistantFeedbackController = assistantFeedbackController;
        mPackageName = pkg;
        mUniqueChannelsInRow = uniqueChannelsInRow;
        mNumUniqueChannelsInRow = uniqueChannelsInRow.size();
@@ -222,7 +226,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
        mAppUid = mSbn.getUid();
        mDelegatePkg = mSbn.getOpPkg();
        mIsDeviceProvisioned = isDeviceProvisioned;
        mShowAutomaticSetting = showAutomaticSetting;
        mShowAutomaticSetting = mAssistantFeedbackController.isFeedbackEnabled();
        mUiEventLogger = uiEventLogger;

        int numTotalChannels = mINotificationManager.getNumNotificationChannelsForPackage(
@@ -280,6 +284,8 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G

        View automatic = findViewById(R.id.automatic);
        if (mShowAutomaticSetting) {
            mAutomaticDescriptionView.setText(Html.fromHtml(mContext.getText(
                    mAssistantFeedbackController.getInlineDescriptionResource(mEntry)).toString()));
            automatic.setVisibility(VISIBLE);
            automatic.setOnClickListener(mOnAutomatic);
        } else {
+3 −3
Original line number Diff line number Diff line
@@ -374,7 +374,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
                eq(false),
                eq(false),
                eq(true), /* wasShownHighPriority */
                eq(false) /* showAutomaticSetting */);
                eq(mAssistantFeedbackController));
    }

    @Test
@@ -408,7 +408,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
                eq(true),
                eq(false),
                eq(false), /* wasShownHighPriority */
                eq(false) /* showAutomaticSetting */);
                eq(mAssistantFeedbackController));
    }

    @Test
@@ -440,7 +440,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
                eq(false),
                eq(false),
                eq(false), /* wasShownHighPriority */
                eq(false) /* showAutomaticSetting */);
                eq(mAssistantFeedbackController));
    }

    @Test
Loading