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

Commit 28020faf authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge "Convert HeadsUpEntry statusbar texts to flows" into main

parents a390648f 7bfe11ae
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -117,9 +117,9 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
        mShowingEntry = entry;
        mShowingEntry = entry;


        if (mShowingEntry != null) {
        if (mShowingEntry != null) {
            CharSequence text = entry.headsUpStatusBarText;
            CharSequence text = entry.getHeadsUpStatusBarText().getValue();
            if (entry.isSensitive().getValue()) {
            if (entry.isSensitive().getValue()) {
                text = entry.headsUpStatusBarTextPublic;
                text = entry.getHeadsUpStatusBarTextPublic().getValue();
            }
            }
            mTextView.setText(text);
            mTextView.setText(text);
            mShowingEntry.addOnSensitivityChangedListener(mOnSensitivityChangedListener);
            mShowingEntry.addOnSensitivityChangedListener(mOnSensitivityChangedListener);
+31 −2
Original line number Original line Diff line number Diff line
@@ -154,8 +154,11 @@ public final class NotificationEntry extends ListEntry {
    public CharSequence remoteInputTextWhenReset;
    public CharSequence remoteInputTextWhenReset;
    public long lastRemoteInputSent = NOT_LAUNCHED_YET;
    public long lastRemoteInputSent = NOT_LAUNCHED_YET;
    public final ArraySet<Integer> mActiveAppOps = new ArraySet<>(3);
    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
    // 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)
    // 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);
        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() {
    public boolean isPulseSuppressed() {
        return mPulseSupressed;
        return mPulseSupressed;
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -988,8 +988,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
            }
            }
        }
        }


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