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

Commit 41311ea8 authored by Steve Elliott's avatar Steve Elliott Committed by Automerger Merge Worker
Browse files

Merge changes from topic "shelf-refactor-flag" into udc-dev am: 4fb6d541

parents 7ed821d3 4fb6d541
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -103,6 +103,11 @@ object Flags {
    val FILTER_UNSEEN_NOTIFS_ON_KEYGUARD =
    val FILTER_UNSEEN_NOTIFS_ON_KEYGUARD =
        releasedFlag(254647461, "filter_unseen_notifs_on_keyguard")
        releasedFlag(254647461, "filter_unseen_notifs_on_keyguard")


    // TODO(b/277338665): Tracking Bug
    @JvmField
    val NOTIFICATION_SHELF_REFACTOR =
        unreleasedFlag(271161129, "notification_shelf_refactor")

    // TODO(b/263414400): Tracking Bug
    // TODO(b/263414400): Tracking Bug
    @JvmField
    @JvmField
    val NOTIFICATION_ANIMATE_BIG_PICTURE =
    val NOTIFICATION_ANIMATE_BIG_PICTURE =
+9 −24
Original line number Original line Diff line number Diff line
@@ -25,7 +25,6 @@ import com.android.systemui.statusbar.notification.row.ActivatableNotificationVi
import com.android.systemui.statusbar.notification.row.dagger.NotificationRowScope;
import com.android.systemui.statusbar.notification.row.dagger.NotificationRowScope;
import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationIconContainer;
import com.android.systemui.statusbar.phone.NotificationIconContainer;


@@ -35,7 +34,7 @@ import javax.inject.Inject;
 * Controller class for {@link NotificationShelf}.
 * Controller class for {@link NotificationShelf}.
 */
 */
@NotificationRowScope
@NotificationRowScope
public class NotificationShelfController {
public class LegacyNotificationShelfControllerImpl implements NotificationShelfController {
    private final NotificationShelf mView;
    private final NotificationShelf mView;
    private final ActivatableNotificationViewController mActivatableNotificationViewController;
    private final ActivatableNotificationViewController mActivatableNotificationViewController;
    private final KeyguardBypassController mKeyguardBypassController;
    private final KeyguardBypassController mKeyguardBypassController;
@@ -44,7 +43,7 @@ public class NotificationShelfController {
    private AmbientState mAmbientState;
    private AmbientState mAmbientState;


    @Inject
    @Inject
    public NotificationShelfController(
    public LegacyNotificationShelfControllerImpl(
            NotificationShelf notificationShelf,
            NotificationShelf notificationShelf,
            ActivatableNotificationViewController activatableNotificationViewController,
            ActivatableNotificationViewController activatableNotificationViewController,
            KeyguardBypassController keyguardBypassController,
            KeyguardBypassController keyguardBypassController,
@@ -79,56 +78,42 @@ public class NotificationShelfController {
        }
        }
    }
    }


    @Override
    public NotificationShelf getView() {
    public NotificationShelf getView() {
        return mView;
        return mView;
    }
    }


    @Override
    public boolean canModifyColorOfNotifications() {
    public boolean canModifyColorOfNotifications() {
        return mAmbientState.isShadeExpanded()
        return mAmbientState.isShadeExpanded()
                && !(mAmbientState.isOnKeyguard() && mKeyguardBypassController.getBypassEnabled());
                && !(mAmbientState.isOnKeyguard() && mKeyguardBypassController.getBypassEnabled());
    }
    }


    @Override
    public NotificationIconContainer getShelfIcons() {
    public NotificationIconContainer getShelfIcons() {
        return mView.getShelfIcons();
        return mView.getShelfIcons();
    }
    }


    public @View.Visibility int getVisibility() {
    @Override
        return mView.getVisibility();
    }

    public void setCollapsedIcons(NotificationIconContainer notificationIcons) {
        mView.setCollapsedIcons(notificationIcons);
    }

    public void bind(AmbientState ambientState,
    public void bind(AmbientState ambientState,
            NotificationStackScrollLayoutController notificationStackScrollLayoutController) {
            NotificationStackScrollLayoutController notificationStackScrollLayoutController) {
        mView.bind(ambientState, notificationStackScrollLayoutController);
        mView.bind(ambientState, notificationStackScrollLayoutController);
        mAmbientState = ambientState;
        mAmbientState = ambientState;
    }
    }


    public int getHeight() {
    @Override
        return mView.getHeight();
    }

    public void updateState(StackScrollAlgorithm.StackScrollAlgorithmState algorithmState,
            AmbientState ambientState) {
        mAmbientState = ambientState;
        mView.updateState(algorithmState, ambientState);
    }

    public int getIntrinsicHeight() {
    public int getIntrinsicHeight() {
        return mView.getIntrinsicHeight();
        return mView.getIntrinsicHeight();
    }
    }


    @Override
    public void setOnActivatedListener(ActivatableNotificationView.OnActivatedListener listener) {
    public void setOnActivatedListener(ActivatableNotificationView.OnActivatedListener listener) {
        mView.setOnActivatedListener(listener);
        mView.setOnActivatedListener(listener);
    }
    }


    @Override
    public void setOnClickListener(View.OnClickListener onClickListener) {
    public void setOnClickListener(View.OnClickListener onClickListener) {
        mView.setOnClickListener(onClickListener);
        mView.setOnClickListener(onClickListener);
    }
    }


    public int getNotGoneIndex() {
        return mView.getNotGoneIndex();
    }
}
}
+1 −35
Original line number Original line Diff line number Diff line
@@ -64,8 +64,7 @@ import java.io.PrintWriter;
 * A notification shelf view that is placed inside the notification scroller. It manages the
 * A notification shelf view that is placed inside the notification scroller. It manages the
 * overflow icons that don't fit into the regular list anymore.
 * overflow icons that don't fit into the regular list anymore.
 */
 */
public class NotificationShelf extends ActivatableNotificationView implements
public class NotificationShelf extends ActivatableNotificationView implements StateListener {
        View.OnLayoutChangeListener, StateListener {


    private static final int TAG_CONTINUOUS_CLIPPING = R.id.continuous_clipping_tag;
    private static final int TAG_CONTINUOUS_CLIPPING = R.id.continuous_clipping_tag;
    private static final String TAG = "NotificationShelf";
    private static final String TAG = "NotificationShelf";
@@ -78,7 +77,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
    private static final SourceType SHELF_SCROLL = SourceType.from("ShelfScroll");
    private static final SourceType SHELF_SCROLL = SourceType.from("ShelfScroll");


    private NotificationIconContainer mShelfIcons;
    private NotificationIconContainer mShelfIcons;
    private int[] mTmp = new int[2];
    private boolean mHideBackground;
    private boolean mHideBackground;
    private int mStatusBarHeight;
    private int mStatusBarHeight;
    private boolean mEnableNotificationClipping;
    private boolean mEnableNotificationClipping;
@@ -87,7 +85,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
    private int mPaddingBetweenElements;
    private int mPaddingBetweenElements;
    private int mNotGoneIndex;
    private int mNotGoneIndex;
    private boolean mHasItemsInStableShelf;
    private boolean mHasItemsInStableShelf;
    private NotificationIconContainer mCollapsedIcons;
    private int mScrollFastThreshold;
    private int mScrollFastThreshold;
    private int mStatusBarState;
    private int mStatusBarState;
    private boolean mInteractive;
    private boolean mInteractive;
@@ -868,10 +865,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
        return mShelfIcons.getIconState(icon);
        return mShelfIcons.getIconState(icon);
    }
    }


    private float getFullyClosedTranslation() {
        return -(getIntrinsicHeight() - mStatusBarHeight) / 2;
    }

    @Override
    @Override
    public boolean hasNoContentHeight() {
    public boolean hasNoContentHeight() {
        return true;
        return true;
@@ -893,7 +886,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
    @Override
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        super.onLayout(changed, left, top, right, bottom);
        updateRelativeOffset();


        // we always want to clip to our sides, such that nothing can draw outside of these bounds
        // we always want to clip to our sides, such that nothing can draw outside of these bounds
        int height = getResources().getDisplayMetrics().heightPixels;
        int height = getResources().getDisplayMetrics().heightPixels;
@@ -903,13 +895,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
        }
        }
    }
    }


    private void updateRelativeOffset() {
        if (mCollapsedIcons != null) {
            mCollapsedIcons.getLocationOnScreen(mTmp);
        }
        getLocationOnScreen(mTmp);
    }

    /**
    /**
     * @return the index of the notification at which the shelf visually resides
     * @return the index of the notification at which the shelf visually resides
     */
     */
@@ -924,19 +909,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
        }
        }
    }
    }


    /**
     * @return whether the shelf has any icons in it when a potential animation has finished, i.e
     * if the current state would be applied right now
     */
    public boolean hasItemsInStableShelf() {
        return mHasItemsInStableShelf;
    }

    public void setCollapsedIcons(NotificationIconContainer collapsedIcons) {
        mCollapsedIcons = collapsedIcons;
        mCollapsedIcons.addOnLayoutChangeListener(this);
    }

    @Override
    @Override
    public void onStateChanged(int newState) {
    public void onStateChanged(int newState) {
        mStatusBarState = newState;
        mStatusBarState = newState;
@@ -982,12 +954,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
        }
        }
    }
    }


    @Override
    public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
                               int oldTop, int oldRight, int oldBottom) {
        updateRelativeOffset();
    }

    @Override
    @Override
    public boolean needsClippingToShelf() {
    public boolean needsClippingToShelf() {
        return false;
        return false;
+54 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.statusbar

import android.view.View
import android.view.View.OnClickListener
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView.OnActivatedListener
import com.android.systemui.statusbar.notification.row.ExpandableView
import com.android.systemui.statusbar.notification.stack.AmbientState
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.phone.NotificationIconContainer

/** Controller interface for [NotificationShelf]. */
interface NotificationShelfController {
    /** The [NotificationShelf] controlled by this Controller. */
    val view: NotificationShelf

    /** @see ExpandableView.getIntrinsicHeight */
    val intrinsicHeight: Int

    /** Container view for icons displayed in the shelf. */
    val shelfIcons: NotificationIconContainer

    /** Whether or not the shelf can modify the color of notifications in the shade. */
    fun canModifyColorOfNotifications(): Boolean

    /** @see ActivatableNotificationView.setOnActivatedListener */
    fun setOnActivatedListener(listener: OnActivatedListener)

    /** Binds the shelf to the host [NotificationStackScrollLayout], via its Controller. */
    fun bind(
        ambientState: AmbientState,
        notificationStackScrollLayoutController: NotificationStackScrollLayoutController,
    )

    /** @see View.setOnClickListener */
    fun setOnClickListener(listener: OnClickListener)
}
+3 −2
Original line number Original line Diff line number Diff line
@@ -16,8 +16,8 @@


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


import com.android.systemui.statusbar.LegacyNotificationShelfControllerImpl;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;


import dagger.Binds;
import dagger.Binds;
@@ -46,7 +46,8 @@ public interface NotificationShelfComponent {
     * Creates a NotificationShelfController.
     * Creates a NotificationShelfController.
     */
     */
    @NotificationRowScope
    @NotificationRowScope
    NotificationShelfController getNotificationShelfController();
    LegacyNotificationShelfControllerImpl getNotificationShelfController();

    /**
    /**
     * Dagger Module that extracts interesting properties from a NotificationShelf.
     * Dagger Module that extracts interesting properties from a NotificationShelf.
     */
     */
Loading