Loading packages/SystemUI/shared/src/com/android/systemui/shared/clocks/ClockRegistry.kt +20 −11 Original line number Diff line number Diff line Loading @@ -74,18 +74,27 @@ open class ClockRegistry( open var currentClockId: ClockId get() { return try { val json = Settings.Secure.getString( context.contentResolver, Settings.Secure.LOCK_SCREEN_CUSTOM_CLOCK_FACE ) return gson.fromJson(json, ClockSetting::class.java)?.clockId ?: DEFAULT_CLOCK_ID gson.fromJson(json, ClockSetting::class.java)?.clockId ?: DEFAULT_CLOCK_ID } catch (ex: Exception) { Log.e(TAG, "Failed to parse clock setting", ex) DEFAULT_CLOCK_ID } } set(value) { try { val json = gson.toJson(ClockSetting(value, System.currentTimeMillis())) Settings.Secure.putString( context.contentResolver, Settings.Secure.LOCK_SCREEN_CUSTOM_CLOCK_FACE, json ) } catch (ex: Exception) { Log.e(TAG, "Failed to set clock setting", ex) } } init { Loading Loading @@ -183,6 +192,6 @@ open class ClockRegistry( private data class ClockSetting( val clockId: ClockId, val _applied_timestamp: Long val _applied_timestamp: Long? ) } Loading
packages/SystemUI/shared/src/com/android/systemui/shared/clocks/ClockRegistry.kt +20 −11 Original line number Diff line number Diff line Loading @@ -74,18 +74,27 @@ open class ClockRegistry( open var currentClockId: ClockId get() { return try { val json = Settings.Secure.getString( context.contentResolver, Settings.Secure.LOCK_SCREEN_CUSTOM_CLOCK_FACE ) return gson.fromJson(json, ClockSetting::class.java)?.clockId ?: DEFAULT_CLOCK_ID gson.fromJson(json, ClockSetting::class.java)?.clockId ?: DEFAULT_CLOCK_ID } catch (ex: Exception) { Log.e(TAG, "Failed to parse clock setting", ex) DEFAULT_CLOCK_ID } } set(value) { try { val json = gson.toJson(ClockSetting(value, System.currentTimeMillis())) Settings.Secure.putString( context.contentResolver, Settings.Secure.LOCK_SCREEN_CUSTOM_CLOCK_FACE, json ) } catch (ex: Exception) { Log.e(TAG, "Failed to set clock setting", ex) } } init { Loading Loading @@ -183,6 +192,6 @@ open class ClockRegistry( private data class ClockSetting( val clockId: ClockId, val _applied_timestamp: Long val _applied_timestamp: Long? ) }