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

Commit 9f186a2d authored by Shawn Lee's avatar Shawn Lee
Browse files

[flexiglass] Disable NPVC and NPV when flexiglass is on

When flexiglass is on, do not instantiate NPVC, and convert all logic in NPV to no-ops.

Bug: 303267342
Test: Manual
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Change-Id: Ie1d213246bbf573e902651ab5735d5464a6f7452
parent 4d4c754d
Loading
Loading
Loading
Loading
+27 −6
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;

import com.android.systemui.scene.shared.flag.SceneContainerFlag;

/** The shade view. */
public final class NotificationPanelView extends FrameLayout {
    static final boolean DEBUG = false;
@@ -41,14 +43,20 @@ public final class NotificationPanelView extends FrameLayout {

    public NotificationPanelView(Context context, AttributeSet attrs) {
        super(context, attrs);
        if (!SceneContainerFlag.isEnabled()) {
            setWillNotDraw(!DEBUG);
            mAlphaPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));

            setBackgroundColor(Color.TRANSPARENT);
        }
    }

    @Override
    public void onRtlPropertiesChanged(int layoutDirection) {
        if (SceneContainerFlag.isEnabled()) {
            super.onRtlPropertiesChanged(layoutDirection);
            return;
        }
        if (mRtlChangeListener != null) {
            mRtlChangeListener.onRtlPropertielsChanged(layoutDirection);
        }
@@ -56,16 +64,21 @@ public final class NotificationPanelView extends FrameLayout {

    @Override
    public boolean shouldDelayChildPressedState() {
        if (SceneContainerFlag.isEnabled()) {
            return super.shouldDelayChildPressedState();
        }
        return true;
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
        if (!SceneContainerFlag.isEnabled()) {
            if (mCurrentPanelAlpha != 255) {
                canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), mAlphaPaint);
            }
        }
    }

    float getCurrentPanelAlpha() {
        return mCurrentPanelAlpha;
@@ -83,6 +96,9 @@ public final class NotificationPanelView extends FrameLayout {

    @Override
    public boolean hasOverlappingRendering() {
        if (SceneContainerFlag.isEnabled()) {
            return super.hasOverlappingRendering();
        }
        return !mDozing;
    }

@@ -102,6 +118,9 @@ public final class NotificationPanelView extends FrameLayout {

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (SceneContainerFlag.isEnabled()) {
            return super.onInterceptTouchEvent(event);
        }
        return mTouchHandler.onInterceptTouchEvent(event);
    }

@@ -113,8 +132,10 @@ public final class NotificationPanelView extends FrameLayout {
    @Override
    public void dispatchConfigurationChanged(Configuration newConfig) {
        super.dispatchConfigurationChanged(newConfig);
        if (!SceneContainerFlag.isEnabled()) {
            mOnConfigurationChangedListener.onConfigurationChanged(newConfig);
        }
    }

    /** Callback for right-to-left setting changes. */
    interface RtlChangeListener {
+3 −2
Original line number Diff line number Diff line
@@ -982,6 +982,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
                });
        mAlternateBouncerInteractor = alternateBouncerInteractor;
        dumpManager.registerDumpable(this);
        SceneContainerFlag.assertInLegacyMode();
    }

    private void unlockAnimationFinished() {
@@ -3555,9 +3556,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    }

    @Override
    public ViewPropertyAnimator fadeOut(long startDelayMs, long durationMs, Runnable endAction) {
    public void fadeOut(long startDelayMs, long durationMs, Runnable endAction) {
        mView.animate().cancel();
        return mView.animate().alpha(0).setStartDelay(startDelayMs).setDuration(
        mView.animate().alpha(0).setStartDelay(startDelayMs).setDuration(
                durationMs).setInterpolator(Interpolators.ALPHA_OUT).withLayer().withEndAction(
                endAction);
    }
+1 −3
Original line number Diff line number Diff line
@@ -162,9 +162,7 @@ abstract class ShadeModule {

    @Binds
    @SysUISingleton
    abstract fun bindsShadeViewController(
        notificationPanelViewController: NotificationPanelViewController
    ): ShadeViewController
    abstract fun bindsShadeViewController(shadeSurface: ShadeSurface): ShadeViewController

    @Binds
    @SysUISingleton
+1 −2
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package com.android.systemui.shade

import android.view.ViewPropertyAnimator
import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor
import com.android.systemui.shade.domain.interactor.ShadeBackActionInteractor
import com.android.systemui.shade.domain.interactor.ShadeLockscreenInteractor
@@ -48,7 +47,7 @@ interface ShadeSurface :
    fun cancelAnimation()

    /** Animates the view from its current alpha to zero then runs the runnable. */
    fun fadeOut(startDelayMs: Long, durationMs: Long, endAction: Runnable): ViewPropertyAnimator
    fun fadeOut(startDelayMs: Long, durationMs: Long, endAction: Runnable)

    /** Set whether the bouncer is showing. */
    fun setBouncerShowing(bouncerShowing: Boolean)
+87 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.shade

import com.android.systemui.statusbar.GestureRecorder
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.statusbar.policy.HeadsUpManager
import javax.inject.Inject

class ShadeSurfaceImpl @Inject constructor() : ShadeSurface, ShadeViewControllerEmptyImpl() {
    override fun initDependencies(
        centralSurfaces: CentralSurfaces,
        recorder: GestureRecorder,
        hideExpandedRunnable: Runnable,
        headsUpManager: HeadsUpManager
    ) {}

    override fun cancelPendingCollapse() {
        // Do nothing
    }

    override fun cancelAnimation() {
        // Do nothing
    }

    override fun fadeOut(startDelayMs: Long, durationMs: Long, endAction: Runnable) {
        // Do nothing
    }

    override fun setBouncerShowing(bouncerShowing: Boolean) {
        // Do nothing
    }

    override fun setTouchAndAnimationDisabled(disabled: Boolean) {
        // TODO(b/322197941): determine if still needed
    }

    override fun setWillPlayDelayedDozeAmountAnimation(willPlay: Boolean) {
        // TODO(b/322494538): determine if still needed
    }

    override fun setDozing(dozing: Boolean, animate: Boolean) {
        // Do nothing
    }

    override fun setImportantForAccessibility(mode: Int) {
        // Do nothing
    }

    override fun resetTranslation() {
        // Do nothing
    }

    override fun resetAlpha() {
        // Do nothing
    }

    override fun onScreenTurningOn() {
        // Do nothing
    }

    override fun onThemeChanged() {
        // Do nothing
    }

    override fun updateExpansionAndVisibility() {
        // Do nothing
    }

    override fun updateResources() {
        // Do nothing
    }
}
Loading