• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
SettingsWrapper(ContentResolver contentResolver)31     public SettingsWrapper(ContentResolver contentResolver) {
32         mContentResolver = contentResolver;
33     }
34 
35     /**
36      * Gets the value stored in settings for the custom clock face.
37      *
38      * @param userId ID of the user.
39      */
getLockScreenCustomClockFace(int userId)40     public String getLockScreenCustomClockFace(int userId) {
41         return Settings.Secure.getStringForUser(mContentResolver, CUSTOM_CLOCK_FACE, userId);
42     }
43 
44     /**
45      * Gets the value stored in settings for the clock face to use when docked.
46      *
47      * @param userId ID of the user.
48      */
getDockedClockFace(int userId)49     public String getDockedClockFace(int userId) {
50         return Settings.Secure.getStringForUser(mContentResolver, DOCKED_CLOCK_FACE, userId);
51     }
52 }
53