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

Commit a05b7e33 authored by Marcello Galhardo's avatar Marcello Galhardo
Browse files

Fix "No Notification" text not gradually showing on LockScreen

The problem and solution can be summarised in 3 aspects:
- EmptyShadeView visibility was not synchronized with the parent container. To fix that, we will update the `EmptyShadeView` when the container is set to visible (see `NotificationStackScrollLayoutController#updateVisibility`).
- EmptyShadeView visibility rule did not consider transitions when deciding to hide itself on keyguard screen. To fix that, we will compare in the current state is different from the outgoing state in addition to the outgoing state been `Keyguard` (see `NotificaitonStackScrollLayoutController#updateShowEmptyShadeView`).
- The notification layout is visible while on keyguard when in split mode (large screen), different from the phone where a transition is executed. To fix that, we will manually animate the `EmptyShadeView` while in lock screen using `ShadeInterpolation.getAlphaContent` to reproduce the nice fade transition we have in phones (see `StackScrollAlgorithm#updateAlphaState`).

Test: manual (tablet)
  - Turn on your device.
  - If you have notifications:
    - Expand your notifications.
    - Tap "Clear All" button.
  - Expand your notifications slowly.
  - Notice "No Notifications" text will gradually fade in with your movement.

Test: manual (phone)
  - Behaviour did not change.

Test: atest ~/tm-qpr-dev/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt

Fixes: 239903210

Change-Id: I25c0d3fdb484d27eb319e4e22e23facb32c6f6fa
parent 2c5fcf44
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.android.systemui.R;
import com.android.systemui.statusbar.notification.row.StackScrollerDecorView;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
@@ -73,6 +75,7 @@ public class EmptyShadeView extends StackScrollerDecorView {
    }

    @Override
    @NonNull
    public ExpandableViewState createExpandableViewState() {
        return new EmptyShadeViewState();
    }
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;

import androidx.annotation.NonNull;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.policy.SystemBarUtils;
import com.android.systemui.R;
@@ -153,6 +155,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
    }

    @Override
    @NonNull
    public ExpandableViewState createExpandableViewState() {
        return new ShelfState();
    }
+4 −2
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.INotificationManager;
import android.app.Notification;
import android.app.NotificationChannel;
@@ -68,6 +66,9 @@ import android.widget.Chronometer;
import android.widget.FrameLayout;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -3247,6 +3248,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    }

    @Override
    @NonNull
    public ExpandableViewState createExpandableViewState() {
        return new NotificationViewState();
    }
+9 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.systemui.Dumpable;
@@ -66,7 +67,7 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
    protected float mContentTransformationAmount;
    protected boolean mIsLastChild;
    protected int mContentShift;
    private final ExpandableViewState mViewState;
    @NonNull private final ExpandableViewState mViewState;
    private float mContentTranslation;
    protected boolean mLastInSection;
    protected boolean mFirstInSection;
@@ -610,6 +611,7 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {

    public void setActualHeightAnimating(boolean animating) {}

    @NonNull
    protected ExpandableViewState createExpandableViewState() {
        return new ExpandableViewState();
    }
@@ -642,7 +644,12 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
        return mViewState;
    }

    @Nullable public ExpandableViewState getViewState() {
    /**
     * Get the {@link ExpandableViewState} associated with the view.
     *
     * @return the ExpandableView's view state.
     */
    @NonNull public ExpandableViewState getViewState() {
        return mViewState;
    }

+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.util.AttributeSet;
import android.util.IndentingPrintWriter;
import android.view.View;

import androidx.annotation.NonNull;

import com.android.systemui.R;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.ViewState;
@@ -142,6 +144,7 @@ public class FooterView extends StackScrollerDecorView {
    }

    @Override
    @NonNull
    public ExpandableViewState createExpandableViewState() {
        return new FooterViewState();
    }
Loading