Robert Snoeberger | b300a4e | 2019-02-13 20:13:53 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package com.android.keyguard.clock; |
| 17 | |
| 18 | import android.content.ContentResolver; |
| 19 | import android.provider.Settings; |
| 20 | |
| 21 | /** |
| 22 | * Wrapper around Settings used for testing. |
| 23 | */ |
| 24 | public class SettingsWrapper { |
| 25 | |
| 26 | private static final String CUSTOM_CLOCK_FACE = Settings.Secure.LOCK_SCREEN_CUSTOM_CLOCK_FACE; |
| 27 | private static final String DOCKED_CLOCK_FACE = Settings.Secure.DOCKED_CLOCK_FACE; |
| 28 | |
| 29 | private ContentResolver mContentResolver; |
| 30 | |
| 31 | public SettingsWrapper(ContentResolver contentResolver) { |
| 32 | mContentResolver = contentResolver; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Gets the value stored in settings for the custom clock face. |
Robert Snoeberger | 372e13f | 2019-04-08 17:07:14 -0400 | [diff] [blame] | 37 | * |
| 38 | * @param userId ID of the user. |
Robert Snoeberger | b300a4e | 2019-02-13 20:13:53 +0000 | [diff] [blame] | 39 | */ |
Robert Snoeberger | 372e13f | 2019-04-08 17:07:14 -0400 | [diff] [blame] | 40 | public String getLockScreenCustomClockFace(int userId) { |
| 41 | return Settings.Secure.getStringForUser(mContentResolver, CUSTOM_CLOCK_FACE, userId); |
Robert Snoeberger | b300a4e | 2019-02-13 20:13:53 +0000 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Gets the value stored in settings for the clock face to use when docked. |
Robert Snoeberger | 372e13f | 2019-04-08 17:07:14 -0400 | [diff] [blame] | 46 | * |
| 47 | * @param userId ID of the user. |
Robert Snoeberger | b300a4e | 2019-02-13 20:13:53 +0000 | [diff] [blame] | 48 | */ |
Robert Snoeberger | 372e13f | 2019-04-08 17:07:14 -0400 | [diff] [blame] | 49 | public String getDockedClockFace(int userId) { |
| 50 | return Settings.Secure.getStringForUser(mContentResolver, DOCKED_CLOCK_FACE, userId); |
Robert Snoeberger | b300a4e | 2019-02-13 20:13:53 +0000 | [diff] [blame] | 51 | } |
| 52 | } |