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

Commit 2a45b590 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Bind ModesTile to DND tile spec

This will essentially replace the DND tile with the new Priority Modes
tile.

Fix: 352303010
Bug: 346519570
Test: manually tested the tile is in the correct position and there's no DND tile + no change with the flag off
Flag: android.app.modes_ui
Change-Id: I49085151f79cb5c33a407cd3df7d7eaba600ad3f
parent fa00cbb6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@

    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    <string name="quick_settings_tiles_stock" translatable="false">
        internet,bt,flashlight,dnd,modes,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,record_issue,hearing_devices
        internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,record_issue,hearing_devices
    </string>

    <!-- The tiles to display in QuickSettings -->
+0 −10
Original line number Diff line number Diff line
@@ -85,16 +85,6 @@
        <item>On</item>
    </string-array>

    <!-- State names for modes (Priority modes) tile: unavailable, off, on.
         This subtitle is shown when the tile is in that particular state but does not set its own
         subtitle, so some of these may never appear on screen. They should still be translated as
         if they could appear. [CHAR LIMIT=32] -->
    <string-array name="tile_states_modes">
        <item>Unavailable</item>
        <item>Off</item>
        <item>On</item>
    </string-array>

    <!-- State names for flashlight tile: unavailable, off, on.
         This subtitle is shown when the tile is in that particular state but does not set its own
         subtitle, so some of these may never appear on screen. They should still be translated as
+7 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha
        // Internal notification backend dependencies
        crossAppPoliteNotifications dependsOn politeNotifications
        vibrateWhileUnlockedToken dependsOn politeNotifications
        modesUi dependsOn modesApi

        // Internal notification frontend dependencies
        NotificationsLiveDataStoreRefactor.token dependsOn NotificationIconContainerRefactor.token
@@ -85,6 +86,12 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha
    private inline val vibrateWhileUnlockedToken: FlagToken
        get() = FlagToken(FLAG_VIBRATE_WHILE_UNLOCKED, vibrateWhileUnlocked())

    private inline val modesUi
        get() = FlagToken(android.app.Flags.FLAG_MODES_UI, android.app.Flags.modesUi())

    private inline val modesApi
        get() = FlagToken(android.app.Flags.FLAG_MODES_API, android.app.Flags.modesApi())

    private inline val communalHub
        get() = FlagToken(FLAG_COMMUNAL_HUB, communalHub())
}
+0 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ object SubtitleArrayMapping {
        subtitleIdsMap["cell"] = R.array.tile_states_cell
        subtitleIdsMap["battery"] = R.array.tile_states_battery
        subtitleIdsMap["dnd"] = R.array.tile_states_dnd
        subtitleIdsMap["modes"] = R.array.tile_states_modes
        subtitleIdsMap["flashlight"] = R.array.tile_states_flashlight
        subtitleIdsMap["rotation"] = R.array.tile_states_rotation
        subtitleIdsMap["bt"] = R.array.tile_states_bt
+11 −3
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import com.android.systemui.animation.DialogTransitionAnimator;
import com.android.systemui.animation.Expandable;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.RefactorFlagUtils;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.qs.QSTile.BooleanState;
@@ -105,6 +106,11 @@ public class DndTile extends QSTileImpl<BooleanState> {
    ) {
        super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger,
                statusBarStateController, activityStarter, qsLogger);

        // If the flag is on, this shouldn't run at all since the modes tile replaces the DND tile.
        RefactorFlagUtils.INSTANCE.assertInLegacyMode(android.app.Flags.modesUi(),
                android.app.Flags.FLAG_MODES_UI);

        mController = zenModeController;
        mSharedPreferences = sharedPreferences;
        mController.observe(getLifecycle(), mZenCallback);
@@ -258,13 +264,15 @@ public class DndTile extends QSTileImpl<BooleanState> {
            case Global.ZEN_MODE_NO_INTERRUPTIONS:
                state.contentDescription =
                        mContext.getString(R.string.accessibility_quick_settings_dnd) + ", " +
                        mContext.getString(R.string.accessibility_quick_settings_dnd_none_on)
                                mContext.getString(
                                        R.string.accessibility_quick_settings_dnd_none_on)
                                + ", " + state.secondaryLabel;
                break;
            case ZEN_MODE_ALARMS:
                state.contentDescription =
                        mContext.getString(R.string.accessibility_quick_settings_dnd) + ", " +
                        mContext.getString(R.string.accessibility_quick_settings_dnd_alarms_on)
                                mContext.getString(
                                        R.string.accessibility_quick_settings_dnd_alarms_on)
                                + ", " + state.secondaryLabel;
                break;
            default:
Loading