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

Commit 76b4b884 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz
Browse files

[SB][ComposeIcons] Replace legacy status icons in the UI

Previously, the composable icons were added towards the
center of the screen and the existing icons were kept visible.
The icons are close to ready for staging now so this CL replaces
the `statusIcons` view with the new composable.

Bug: 406922954
Test: Manual, Screenshot test TBA.
Flag: com.android.systemui.status_bar_system_status_icons_in_compose
Change-Id: I3ec7fcafb7856940dddf04b579e0102c0dce7bb0
parent d92ae20d
Loading
Loading
Loading
Loading
+27 −25
Original line number Diff line number Diff line
@@ -186,18 +186,6 @@ fun StatusBarRoot(
            val phoneStatusBarView =
                inflater.inflate(R.layout.status_bar, parent, false) as PhoneStatusBarView

            // For now, just set up the system icons the same way we used to
            val statusIconContainer =
                phoneStatusBarView.requireViewById<StatusIconContainer>(R.id.statusIcons)
            // TODO(b/364360986): turn this into a repo/intr/viewmodel
            val darkIconManager =
                darkIconManagerFactory.create(
                    statusIconContainer,
                    StatusBarLocation.HOME,
                    darkIconDispatcher,
                )
            iconController.addIconGroup(darkIconManager)

            if (StatusBarChipsModernization.isEnabled) {
                addStartSideChipsComposable(
                    phoneStatusBarView = phoneStatusBarView,
@@ -208,12 +196,6 @@ fun StatusBarRoot(
                )
            }

            HomeStatusBarIconBlockListBinder.bind(
                statusIconContainer,
                darkIconManager,
                statusBarViewModel.iconBlockList,
            )

            if (StatusBarChipsModernization.isEnabled) {
                // Make sure the primary chip is hidden when StatusBarChipsModernization is
                // enabled. OngoingActivityChips will be shown in a composable container
@@ -281,14 +263,33 @@ fun StatusBarRoot(
            // If the flag is enabled, create and add a compose section to the end
            // of the system_icons container
            if (SystemStatusIconsInCompose.isEnabled) {
                phoneStatusBarView.requireViewById<View>(R.id.system_icons).visibility = View.GONE
                addSystemStatusIconsComposable(phoneStatusBarView, statusBarViewModel)
            } else if (NewStatusBarIcons.isEnabled) {
            } else {
                val statusIconContainer =
                    phoneStatusBarView.requireViewById<StatusIconContainer>(R.id.statusIcons)
                val darkIconManager =
                    darkIconManagerFactory.create(
                        statusIconContainer,
                        StatusBarLocation.HOME,
                        darkIconDispatcher,
                    )
                iconController.addIconGroup(darkIconManager)

                HomeStatusBarIconBlockListBinder.bind(
                    statusIconContainer,
                    darkIconManager,
                    statusBarViewModel.iconBlockList,
                )

                if (NewStatusBarIcons.isEnabled) {
                    addBatteryComposable(phoneStatusBarView, statusBarViewModel)
                    // Also adjust the paddings :)
                    SystemStatusIconsLayoutHelper.configurePaddingForNewStatusBarIcons(
                        phoneStatusBarView.requireViewById(R.id.statusIcons)
                    )
                }
            }

            notificationIconsBinder.bindWhileAttached(notificationIconContainer, context.displayId)

@@ -510,8 +511,9 @@ private fun addSystemStatusIconsComposable(
                }
            }
        }
    phoneStatusBarView.findViewById<ViewGroup>(R.id.status_bar_end_side_container).apply {
        addView(systemStatusIconsComposeView, -1)

    phoneStatusBarView.findViewById<ViewGroup>(R.id.status_bar_end_side_content).apply {
        addView(systemStatusIconsComposeView)
    }
}