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

Commit 2553c12e authored by Chris Poultney's avatar Chris Poultney Committed by Android (Google) Code Review
Browse files

Merge "Prevent picker crash when clock init crashes" into main

parents 58e2c219 b4bdc9ed
Loading
Loading
Loading
Loading
+25 −15
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.app.Activity
import android.app.WallpaperColors
import android.app.WallpaperManager
import android.graphics.Rect
import android.util.Log
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.ColorInt
@@ -187,6 +188,7 @@ constructor(
    }

    private fun initClockController(clockId: String): ClockController? {
        try {
            val isWallpaperDark = isLockscreenWallpaperDark()
            return registry.createExampleClock(activity, clockId)?.also { controller ->
                controller.initialize(isWallpaperDark, 0f, 0f)
@@ -204,6 +206,14 @@ constructor(
                controller.smallClock.events.onTargetRegionChanged(getSmallClockRegion())
                controller.events.onWeatherDataChanged(WeatherData.getPlaceholderWeatherData())
            }
        } catch (e: Exception) {
            Log.e(
                "ThemePickerClockViewFactory",
                "caught clock init exception, proceeding without clocks",
                e,
            )
            return null
        }
    }

    /**