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

Commit b1dbf69d authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Fix isRemoved not being set for rows

Bug: 417457086
Flag: com.android.systemui.notification_row_is_removed_fix
Test: manually fiddle with various ways to remove a row
Change-Id: I605f189c6d9031dcd84ffe56affce8d4ed320168
parent 50441480
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -76,6 +76,16 @@ flag {
   bug: "343942780"
}

flag {
   name: "notification_row_is_removed_fix"
   namespace: "systemui"
   description: "Fix incorrect isRemoved value in ExpandableNotificationRow"
   bug: "417457086"
   metadata {
        purpose: PURPOSE_BUGFIX
   }
}

flag {
   name: "notification_ambient_suppression_after_inflation"
   namespace: "systemui"
+0 −12
Original line number Diff line number Diff line
@@ -677,18 +677,6 @@ public final class NotificationEntry extends ListEntry {
        return row != null && row.isDismissed();
    }

    public boolean isRowRemoved() {
        return row != null && row.isRemoved();
    }

    /**
     * @return {@code true} if the row is null or removed
     */
    public boolean isRemoved() {
        //TODO: recycling invalidates this
        return row == null || row.isRemoved();
    }

    public boolean isRowPinned() {
        return getPinnedStatus().isPinned();
    }
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.statusbar.notification.row;

import static com.android.systemui.Flags.notificationRowIsRemovedFix;

import android.util.ArrayMap;
import android.util.ArraySet;
import android.widget.FrameLayout;
@@ -218,6 +220,13 @@ public final class NotifBindPipeline {
            mStage.deleteStageParams(entry);
            mStartProcessor.cancel(entry);
        }

        @Override
        public void onEntryRemoved(NotificationEntry entry, int reason) {
            if (notificationRowIsRemovedFix()) {
                entry.removeRow();
            }
        }
    };

    private @NonNull BindEntry getBindEntry(NotificationEntry entry) {
+9 −6
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.systemui.statusbar.notification.stack;

import static android.app.Flags.notificationsRedesignTemplates;

import static com.android.systemui.Flags.notificationRowIsRemovedFix;

import android.app.Notification;
import android.content.Context;
import android.content.res.Configuration;
@@ -432,13 +434,14 @@ public class NotificationChildrenContainer extends ViewGroup
    }

    private static boolean shouldRestoreChild(ExpandableNotificationRow row) {
        // TODO: b/417457086 - We're only checking for isChangingPosition here as a quick-and-dirty
        //  fix for b/415665263, but the real issue is that isRemoved is currently ALWAYS false.
        //  We need to fix that behind a flag, so this hack is temporary.
        if (USE_IS_CHANGING_POSITION_TO_RESTORE) {
            return !row.isRemoved() && row.isChangingPosition();
        } else {
        if (notificationRowIsRemovedFix() || !USE_IS_CHANGING_POSITION_TO_RESTORE) {
            return !row.isRemoved();
        } else {
            // TODO: b/417457086 - We're only checking for isChangingPosition here as a
            //  quick-and-dirty fix for b/415665263, but the real issue is that isRemoved is
            //  currently ALWAYS false. This should be fixed when notification_row_is_removed_fix
            //  is enabled.
            return !row.isRemoved() && row.isChangingPosition();
        }
    }