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

Commit d833c981 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Call chip] Update call chip to use icon from notification.

This change:
1) Has notification/icon/IconManager.kt create a new icon for the call
   chip. The icon is based on Notification.smallIcon.
2) Updates OngoingCallController to pass that icon to CallChipViewModel.
3) Updates CallChipViewModel to use the icon if the flag is enabled.
4) Updates CollapsedStatusBarViewBinder to use that icon if it exists,
   and manipulates all the view paddings such that things look correct.
   This is required because Notification.smallIcons are required to
   embed their own padding, and we need to account for that.

Note that this change only works if two other flags are also enabled:
- status_bar_use_repos_for_call_chip (due to b/355288215)
- status_bar_screen_sharing_chips (due to too much eng effort required
  to re-implement all these changes in OngoingCallController#updateChip)

Bug: 354930838
Flag: com.android.systemui.status_bar_call_chip_notification_icon

Test: With new flag off, start calls from various apps -> verify chip
always shows default phone icon with good padding
Test: With new flag on, start calls and receive calls from various apps
-> verify chip icon always matches the icon shown in the call
notification small icon slot with good padding
Test: Do screen record, share, and cast -> verify chip shows the right
icons with good padding
Test: Start call then change font size, display size, wallpaper color ->
verify chip updates correctly

Test: atest OngoingCallControllerTest CallChipViewModelTest

Change-Id: I2b0b35cb87041638b5e1c0e2ac5658ca8230b2b4
parent b2e6859a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -402,6 +402,13 @@ flag {
    }
}

flag {
    name: "status_bar_call_chip_notification_icon"
    namespace: "systemui"
    description: "Use the small icon set on the notification for the status bar call chip"
    bug: "354930838"
}

flag {
    name: "compose_bouncer"
    namespace: "systemui"
+9 −1
Original line number Diff line number Diff line
@@ -1729,10 +1729,18 @@
    <dimen name="wallet_button_vertical_padding">8dp</dimen>

    <!-- Ongoing activity chip -->
    <!-- The activity chip side padding, used with the default phone icon. -->
    <dimen name="ongoing_activity_chip_side_padding">12dp</dimen>
    <!-- The activity chip side padding, used with an icon that has embedded padding (e.g. if the icon comes from the notification's smallIcon field). If the icon has padding, the chip itself can have less padding. -->
    <dimen name="ongoing_activity_chip_side_padding_for_embedded_padding_icon">6dp</dimen>
    <!-- The icon size, used with the default phone icon. -->
    <dimen name="ongoing_activity_chip_icon_size">16dp</dimen>
    <!-- The padding between the icon and the text. -->
    <!-- The icon size, used with an icon that has embedded padding. (If the icon has embedded padding, we need to make the whole icon larger so the icon itself doesn't look small.) -->
    <dimen name="ongoing_activity_chip_embedded_padding_icon_size">22dp</dimen>
    <!-- The padding between the icon and the text. Only used if the default phone icon is used. -->
    <dimen name="ongoing_activity_chip_icon_text_padding">4dp</dimen>
    <!-- The end padding for the timer text view. Only used if an embedded padding icon is used. -->
    <dimen name="ongoing_activity_chip_text_end_padding_for_embedded_padding_icon">6dp</dimen>
    <dimen name="ongoing_activity_chip_corner_radius">28dp</dimen>

    <!-- Status bar user chip -->
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@

    <!-- Status bar -->
    <item type="id" name="status_bar_dot" />
    <item type="id" name="ongoing_activity_chip_custom_icon" />

    <!-- Default display cutout on the physical top of screen -->
    <item type="id" name="display_cutout" />
+0 −10
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.common.ui.binder

import android.view.View
import android.widget.ImageView
import com.android.systemui.common.shared.model.Icon

@@ -31,13 +30,4 @@ object IconViewBinder {
            is Icon.Resource -> view.setImageResource(icon.res)
        }
    }

    fun bindNullable(icon: Icon?, view: ImageView) {
        if (icon != null) {
            view.visibility = View.VISIBLE
            bind(icon, view)
        } else {
            view.visibility = View.GONE
        }
    }
}
+24 −1
Original line number Diff line number Diff line
@@ -23,7 +23,13 @@ import com.android.server.notification.Flags.crossAppPoliteNotifications
import com.android.server.notification.Flags.politeNotifications
import com.android.server.notification.Flags.vibrateWhileUnlocked
import com.android.systemui.Flags.FLAG_COMMUNAL_HUB
import com.android.systemui.Flags.FLAG_STATUS_BAR_CALL_CHIP_NOTIFICATION_ICON
import com.android.systemui.Flags.FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS
import com.android.systemui.Flags.FLAG_STATUS_BAR_USE_REPOS_FOR_CALL_CHIP
import com.android.systemui.Flags.communalHub
import com.android.systemui.Flags.statusBarCallChipNotificationIcon
import com.android.systemui.Flags.statusBarScreenSharingChips
import com.android.systemui.Flags.statusBarUseReposForCallChip
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.KeyguardBottomAreaRefactor
import com.android.systemui.keyguard.MigrateClocksToBlueprint
@@ -38,9 +44,9 @@ import com.android.systemui.statusbar.notification.interruption.VisualInterrupti
import com.android.systemui.statusbar.notification.shared.NotificationAvalancheSuppression
import com.android.systemui.statusbar.notification.shared.NotificationIconContainerRefactor
import com.android.systemui.statusbar.notification.shared.NotificationMinimalismPrototype
import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun
import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun
import com.android.systemui.statusbar.notification.shared.PriorityPeopleSection
import javax.inject.Inject

@@ -77,6 +83,10 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha

        // QS Fragment using Compose dependencies
        QSComposeFragment.token dependsOn NewQsUI.token

        // Status bar chip dependencies
        statusBarCallChipNotificationIconToken dependsOn statusBarUseReposForCallChipToken
        statusBarCallChipNotificationIconToken dependsOn statusBarScreenSharingChipsToken
    }

    private inline val politeNotifications
@@ -96,4 +106,17 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha

    private inline val communalHub
        get() = FlagToken(FLAG_COMMUNAL_HUB, communalHub())

    private inline val statusBarCallChipNotificationIconToken
        get() =
            FlagToken(
                FLAG_STATUS_BAR_CALL_CHIP_NOTIFICATION_ICON,
                statusBarCallChipNotificationIcon()
            )

    private inline val statusBarScreenSharingChipsToken
        get() = FlagToken(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, statusBarScreenSharingChips())

    private inline val statusBarUseReposForCallChipToken
        get() = FlagToken(FLAG_STATUS_BAR_USE_REPOS_FOR_CALL_CHIP, statusBarUseReposForCallChip())
}
Loading