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

Commit 063a151f authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge changes I85b2f4db,I3fc03c1d into main

* changes:
  [SB] Don't call SBWindowController#refreshSBHeight from PhoneSBView.
  [SB] Remove Dependency.get(SBContentInsetsProvider) from PhoneSBView.
parents f0b6d3c5 b4784e8e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -379,6 +379,17 @@ flag {
    }
}

flag {
    name: "status_bar_stop_updating_window_height"
    namespace: "systemui"
    description: "Don't have PhoneStatusBarView manually trigger an update of the height in "
        "StatusBarWindowController"
    bug: "360115167"
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "compose_bouncer"
    namespace: "systemui"
+0 −3
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager;
import com.android.systemui.statusbar.phone.LightBarController;
import com.android.systemui.statusbar.phone.ScreenOffAnimationController;
import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -140,7 +139,6 @@ public class Dependency {
    @Inject Lazy<SysUiState> mSysUiStateFlagsContainer;
    @Inject Lazy<CommandQueue> mCommandQueue;
    @Inject Lazy<UiEventLogger> mUiEventLogger;
    @Inject Lazy<StatusBarContentInsetsProvider> mContentInsetsProviderLazy;
    @Inject Lazy<FeatureFlags> mFeatureFlagsLazy;
    @Inject Lazy<NotificationSectionsManager> mNotificationSectionsManagerLazy;
    @Inject Lazy<ScreenOffAnimationController> mScreenOffAnimationController;
@@ -186,7 +184,6 @@ public class Dependency {
        mProviders.put(CommandQueue.class, mCommandQueue::get);
        mProviders.put(UiEventLogger.class, mUiEventLogger::get);
        mProviders.put(FeatureFlags.class, mFeatureFlagsLazy::get);
        mProviders.put(StatusBarContentInsetsProvider.class, mContentInsetsProviderLazy::get);
        mProviders.put(NotificationSectionsManager.class, mNotificationSectionsManagerLazy::get);
        mProviders.put(ScreenOffAnimationController.class, mScreenOffAnimationController::get);
        mProviders.put(AmbientState.class, mAmbientStateLazy::get);
+39 −5
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;

import com.android.internal.policy.SystemBarUtils;
import com.android.systemui.Dependency;
import com.android.systemui.Flags;
@@ -47,7 +49,6 @@ import java.util.Objects;

public class PhoneStatusBarView extends FrameLayout {
    private static final String TAG = "PhoneStatusBarView";
    private final StatusBarContentInsetsProvider mContentInsetsProvider;
    private final StatusBarWindowController mStatusBarWindowController;

    private int mRotationOrientation = -1;
@@ -60,6 +61,10 @@ public class PhoneStatusBarView extends FrameLayout {
    private int mStatusBarHeight;
    @Nullable
    private Gefingerpoken mTouchEventHandler;
    @Nullable
    private HasCornerCutoutFetcher mHasCornerCutoutFetcher;
    @Nullable
    private InsetsFetcher mInsetsFetcher;
    private int mDensity;
    private float mFontScale;

@@ -70,7 +75,6 @@ public class PhoneStatusBarView extends FrameLayout {

    public PhoneStatusBarView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContentInsetsProvider = Dependency.get(StatusBarContentInsetsProvider.class);
        mStatusBarWindowController = Dependency.get(StatusBarWindowController.class);
    }

@@ -78,6 +82,14 @@ public class PhoneStatusBarView extends FrameLayout {
        mTouchEventHandler = handler;
    }

    void setHasCornerCutoutFetcher(@NonNull HasCornerCutoutFetcher cornerCutoutFetcher) {
        mHasCornerCutoutFetcher = cornerCutoutFetcher;
    }

    void setInsetsFetcher(@NonNull InsetsFetcher insetsFetcher) {
        mInsetsFetcher = insetsFetcher;
    }

    void init(StatusBarUserChipViewModel viewModel) {
        StatusBarUserSwitcherContainer container = findViewById(R.id.user_switcher_container);
        StatusBarUserChipViewBinder.bind(container, viewModel);
@@ -270,7 +282,14 @@ public class PhoneStatusBarView extends FrameLayout {
            return;
        }

        boolean hasCornerCutout = mContentInsetsProvider.currentRotationHasCornerCutout();
        boolean hasCornerCutout;
        if (mHasCornerCutoutFetcher != null) {
            hasCornerCutout = mHasCornerCutoutFetcher.fetchHasCornerCutout();
        } else {
            Log.e(TAG, "mHasCornerCutoutFetcher unexpectedly null");
            hasCornerCutout = true;
        }

        if (mDisplayCutout == null || mDisplayCutout.isEmpty() || hasCornerCutout) {
            mCutoutSpace.setVisibility(View.GONE);
            return;
@@ -288,8 +307,12 @@ public class PhoneStatusBarView extends FrameLayout {
    }

    private void updateSafeInsets() {
        Insets insets = mContentInsetsProvider
                .getStatusBarContentInsetsForCurrentRotation();
        if (mInsetsFetcher == null) {
            Log.e(TAG, "mInsetsFetcher unexpectedly null");
            return;
        }

        Insets insets  = mInsetsFetcher.fetchInsets();
        setPadding(
                insets.left,
                insets.top,
@@ -298,6 +321,17 @@ public class PhoneStatusBarView extends FrameLayout {
    }

    private void updateWindowHeight() {
        if (Flags.statusBarStopUpdatingWindowHeight()) {
            return;
        }
        mStatusBarWindowController.refreshStatusBarHeight();
    }

    interface HasCornerCutoutFetcher {
        boolean fetchHasCornerCutout();
    }

    interface InsetsFetcher {
        Insets fetchInsets();
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ private constructor(
    private val configurationController: ConfigurationController,
    private val statusOverlayHoverListenerFactory: StatusOverlayHoverListenerFactory,
    private val darkIconDispatcher: DarkIconDispatcher,
    private val statusBarContentInsetsProvider: StatusBarContentInsetsProvider,
) : ViewController<PhoneStatusBarView>(view) {

    private lateinit var battery: BatteryMeterView
@@ -155,7 +156,14 @@ private constructor(
    }

    init {
        // These should likely be done in `onInit`, not `init`.
        mView.setTouchEventHandler(PhoneStatusBarViewTouchHandler())
        mView.setHasCornerCutoutFetcher {
            statusBarContentInsetsProvider.currentRotationHasCornerCutout()
        }
        mView.setInsetsFetcher {
            statusBarContentInsetsProvider.getStatusBarContentInsetsForCurrentRotation()
        }
        mView.init(userChipViewModel)
    }

@@ -310,6 +318,7 @@ private constructor(
        private val configurationController: ConfigurationController,
        private val statusOverlayHoverListenerFactory: StatusOverlayHoverListenerFactory,
        private val darkIconDispatcher: DarkIconDispatcher,
        private val statusBarContentInsetsProvider: StatusBarContentInsetsProvider,
    ) {
        fun create(view: PhoneStatusBarView): PhoneStatusBarViewController {
            val statusBarMoveFromCenterAnimationController =
@@ -335,6 +344,7 @@ private constructor(
                configurationController,
                statusOverlayHoverListenerFactory,
                darkIconDispatcher,
                statusBarContentInsetsProvider,
            )
        }
    }
+1 −0
Original line number Diff line number Diff line
@@ -391,6 +391,7 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() {
                configurationController,
                mStatusOverlayHoverListenerFactory,
                fakeDarkIconDispatcher,
                mock(StatusBarContentInsetsProvider::class.java),
            )
            .create(view)
            .also { it.init() }
Loading