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

Commit 336d8fd2 authored by Justin Koh's avatar Justin Koh
Browse files

Creates Dream Tile.

Adds a new tile which starts the dream.
- Listens for changes in settings (enabled, changing dream)
- Listens for dream state

Bug: 230352363
Test: Added unit test, tested manually
Change-Id: I1bf52c4ea5bf36e02e5926fbbbbf85f8f2a9b4aa
parent a18965d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,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,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
        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
    </string>

    <!-- The tiles to display in QuickSettings -->
+2 −0
Original line number Diff line number Diff line
@@ -578,6 +578,8 @@
    <!-- QuickSettings: Location [CHAR LIMIT=NONE] -->
    <string name="quick_settings_location_label">Location</string>
    <!-- QuickSettings: Location (Off) [CHAR LIMIT=NONE] -->
    <!-- QuickSettings: Screen saver [CHAR LIMIT=NONE] -->
    <string name="quick_settings_screensaver_label">Screen saver</string>
    <!-- QuickSettings: Camera [CHAR LIMIT=NONE] -->
    <string name="quick_settings_camera_label">Camera access</string>
    <!-- QuickSettings: Microphone [CHAR LIMIT=NONE] -->
+10 −0
Original line number Diff line number Diff line
@@ -308,4 +308,14 @@
        <item>Off</item>
        <item>On</item>
    </string-array>

    <!-- State names for dream (screensaver) 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_dream">
        <item>Unavailable</item>
        <item>Off</item>
        <item>On</item>
    </string-array>
</resources>
 No newline at end of file
+7 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.systemui.qs.tiles.ColorInversionTile;
import com.android.systemui.qs.tiles.DataSaverTile;
import com.android.systemui.qs.tiles.DeviceControlsTile;
import com.android.systemui.qs.tiles.DndTile;
import com.android.systemui.qs.tiles.DreamTile;
import com.android.systemui.qs.tiles.FlashlightTile;
import com.android.systemui.qs.tiles.HotspotTile;
import com.android.systemui.qs.tiles.InternetTile;
@@ -96,6 +97,7 @@ public class QSFactoryImpl implements QSFactory {
    private final Provider<QuickAccessWalletTile> mQuickAccessWalletTileProvider;
    private final Provider<QRCodeScannerTile> mQRCodeScannerTileProvider;
    private final Provider<OneHandedModeTile> mOneHandedModeTileProvider;
    private final Provider<DreamTile> mDreamTileProvider;

    private final Lazy<QSHost> mQsHostLazy;
    private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
@@ -132,7 +134,8 @@ public class QSFactoryImpl implements QSFactory {
            Provider<QuickAccessWalletTile> quickAccessWalletTileProvider,
            Provider<QRCodeScannerTile> qrCodeScannerTileProvider,
            Provider<OneHandedModeTile> oneHandedModeTileProvider,
            Provider<ColorCorrectionTile> colorCorrectionTileProvider) {
            Provider<ColorCorrectionTile> colorCorrectionTileProvider,
            Provider<DreamTile> dreamTileProvider) {
        mQsHostLazy = qsHostLazy;
        mCustomTileBuilderProvider = customTileBuilderProvider;

@@ -165,6 +168,7 @@ public class QSFactoryImpl implements QSFactory {
        mQRCodeScannerTileProvider = qrCodeScannerTileProvider;
        mOneHandedModeTileProvider = oneHandedModeTileProvider;
        mColorCorrectionTileProvider = colorCorrectionTileProvider;
        mDreamTileProvider = dreamTileProvider;
    }

    /** Creates a tile with a type based on {@code tileSpec} */
@@ -238,6 +242,8 @@ public class QSFactoryImpl implements QSFactory {
                return mOneHandedModeTileProvider.get();
            case "color_correction":
                return mColorCorrectionTileProvider.get();
            case "dream":
                return mDreamTileProvider.get();
        }

        // Custom tiles
+2 −1
Original line number Diff line number Diff line
@@ -670,7 +670,8 @@ internal object SubtitleArrayMapping {
        "qr_code_scanner" to R.array.tile_states_qr_code_scanner,
        "alarm" to R.array.tile_states_alarm,
        "onehanded" to R.array.tile_states_onehanded,
        "color_correction" to R.array.tile_states_color_correction
        "color_correction" to R.array.tile_states_color_correction,
        "dream" to R.array.tile_states_dream
    )

    fun getSubtitleId(spec: String?): Int {
Loading