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

Commit 7bfe11ae authored by András Kurucz's avatar András Kurucz
Browse files

Convert HeadsUpEntry statusbar texts to flows

Bug: 328393714
Test: SystemUITests
Flag: NONE
Change-Id: Ifd010945dd0b9a5d63d5ca227ab4a7393e121373
parent 3f8b4f96
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -117,9 +117,9 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
        mShowingEntry = entry;

        if (mShowingEntry != null) {
            CharSequence text = entry.headsUpStatusBarText;
            CharSequence text = entry.getHeadsUpStatusBarText().getValue();
            if (entry.isSensitive().getValue()) {
                text = entry.headsUpStatusBarTextPublic;
                text = entry.getHeadsUpStatusBarTextPublic().getValue();
            }
            mTextView.setText(text);
            mShowingEntry.addOnSensitivityChangedListener(mOnSensitivityChangedListener);
+31 −2
Original line number Diff line number Diff line
@@ -154,8 +154,11 @@ public final class NotificationEntry extends ListEntry {
    public CharSequence remoteInputTextWhenReset;
    public long lastRemoteInputSent = NOT_LAUNCHED_YET;
    public final ArraySet<Integer> mActiveAppOps = new ArraySet<>(3);
    public CharSequence headsUpStatusBarText;
    public CharSequence headsUpStatusBarTextPublic;

    private final MutableStateFlow<CharSequence> mHeadsUpStatusBarText =
            StateFlowKt.MutableStateFlow(null);
    private final MutableStateFlow<CharSequence> mHeadsUpStatusBarTextPublic =
            StateFlowKt.MutableStateFlow(null);

    // indicates when this entry's view was first attached to a window
    // this value will reset when the view is completely removed from the shade (ie: filtered out)
@@ -970,6 +973,32 @@ public final class NotificationEntry extends ListEntry {
        mOnSensitivityChangedListeners.remove(listener);
    }

    /** @see #setHeadsUpStatusBarText(CharSequence) */
    public StateFlow<CharSequence> getHeadsUpStatusBarText() {
        return mHeadsUpStatusBarText;
    }

    /**
     * Sets the text to be displayed on the StatusBar, when this notification is the top pinned
     * heads up.
     */
    public void setHeadsUpStatusBarText(CharSequence headsUpStatusBarText) {
        this.mHeadsUpStatusBarText.setValue(headsUpStatusBarText);
    }

    /** @see #setHeadsUpStatusBarTextPublic(CharSequence) */
    public StateFlow<CharSequence> getHeadsUpStatusBarTextPublic() {
        return mHeadsUpStatusBarTextPublic;
    }

    /**
     * Sets the text to be displayed on the StatusBar, when this notification is the top pinned
     * heads up, and its content is sensitive right now.
     */
    public void setHeadsUpStatusBarTextPublic(CharSequence headsUpStatusBarTextPublic) {
        this.mHeadsUpStatusBarTextPublic.setValue(headsUpStatusBarTextPublic);
    }

    public boolean isPulseSuppressed() {
        return mPulseSupressed;
    }
+2 −2
Original line number Diff line number Diff line
@@ -988,8 +988,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
            }
        }

        entry.headsUpStatusBarText = result.headsUpStatusBarText;
        entry.headsUpStatusBarTextPublic = result.headsUpStatusBarTextPublic;
        entry.setHeadsUpStatusBarText(result.headsUpStatusBarText);
        entry.setHeadsUpStatusBarTextPublic(result.headsUpStatusBarTextPublic);
        Trace.endAsyncSection(APPLY_TRACE_METHOD, System.identityHashCode(row));
        if (endListener != null) {
            endListener.onAsyncInflationFinished(entry);