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

Commit 132505ce authored by Will Leshner's avatar Will Leshner
Browse files

Fix an NPE in DisplayScreenTest.

A new implementation of the screensaver settings screen causes
DisplayScreenTest to fail with an NPE. This change is a fix for that
failure.

Bug: 411793272
Test: atest DisplayScreenTest
Flag: com.android.settings.flags.catalyst_screensaver
NO_IFTTT=No change necessary

Change-Id: I6efa949883d5f3bdb4a2f1bf21a4bab5ba147e58
parent 13396aeb
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ class ScreensaverScreen(fooContext: Context) :
        override fun dreamOn(context: Context, activeDreamName: CharSequence) =
            context.resources.getString(
                R.string.screensaver_settings_summary_on,
                dreamBackend.activeDreamName
                activeDreamName
            )

        override fun dreamOffBedtime(context: Context) =
@@ -103,7 +103,10 @@ class ScreensaverScreen(fooContext: Context) :

    private fun getSummaryTextWithDreamName(context: Context): CharSequence {
        return if (dreamBackend.isEnabled) {
            summaryStringsProvider.dreamOn(context, dreamBackend.activeDreamName)
            // In practice, activeDreamName would not be null, but it can be in tests and in that
            // case it needs to have the same behavior as the corresponding method in
            // DreamSettings (see b/411793272).
            summaryStringsProvider.dreamOn(context, dreamBackend.activeDreamName ?: "null")
        } else {
            summaryStringsProvider.dreamOff(context)
        }