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

Commit c2b519b8 authored by Hawkwood Glazier's avatar Hawkwood Glazier
Browse files

Override for testing when clock is not set

Bug: 259097187
Test: Manually verified default clock was correctly used
Change-Id: I4fe2572aa95edf34cb7e6a4745e7dda35776c8f0
parent d8251475
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1932,6 +1932,9 @@
    <!-- SysUI Tuner: Summary of no shortcut being selected [CHAR LIMIT=60] -->
    <string name="lockscreen_none">None</string>

    <!-- ClockId to use when none is set by user -->
    <string name="lockscreen_clock_id_fallback" translatable="false">DEFAULT</string>

    <!-- SysUI Tuner: Format string for describing launching an app [CHAR LIMIT=60] -->
    <string name="tuner_launch_app">Launch <xliff:g id="app" example="Settings">%1$s</xliff:g></string>

+6 −2
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ open class ClockRegistry(
    val isEnabled: Boolean,
    userHandle: Int,
    defaultClockProvider: ClockProvider,
    val fallbackClockId: ClockId = DEFAULT_CLOCK_ID,
) {
    // Usually this would be a typealias, but a SAM provides better java interop
    fun interface ClockChangeListener {
@@ -69,10 +70,13 @@ open class ClockRegistry(
                    context.contentResolver,
                    Settings.Secure.LOCK_SCREEN_CUSTOM_CLOCK_FACE
                )
                ClockSetting.deserialize(json)?.clockId ?: DEFAULT_CLOCK_ID
                if (json == null || json.isEmpty()) {
                    return fallbackClockId
                }
                ClockSetting.deserialize(json).clockId
            } catch (ex: Exception) {
                Log.e(TAG, "Failed to parse clock setting", ex)
                DEFAULT_CLOCK_ID
                fallbackClockId
            }
        }
        set(value) {
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context;
import android.os.Handler;
import android.os.UserHandle;

import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Application;
import com.android.systemui.dagger.qualifiers.Main;
@@ -50,6 +51,7 @@ public abstract class ClockRegistryModule {
                handler,
                featureFlags.isEnabled(Flags.LOCKSCREEN_CUSTOM_CLOCKS),
                UserHandle.USER_ALL,
                defaultClockProvider);
                defaultClockProvider,
                context.getString(R.string.lockscreen_clock_id_fallback));
    }
}