Govinda Wasserman | 48cdd68 | 2019-06-04 12:15:23 -0400 | [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 | |
| 17 | package com.android.systemui.assist; |
| 18 | |
| 19 | import android.provider.DeviceConfig; |
| 20 | |
| 21 | import androidx.annotation.Nullable; |
| 22 | |
| 23 | import java.util.concurrent.Executor; |
| 24 | |
Matt Casey | e1ff28d | 2019-06-18 17:58:44 -0400 | [diff] [blame] | 25 | public class PhenotypeHelper { |
Govinda Wasserman | 48cdd68 | 2019-06-04 12:15:23 -0400 | [diff] [blame] | 26 | |
Matt Casey | e1ff28d | 2019-06-18 17:58:44 -0400 | [diff] [blame] | 27 | public PhenotypeHelper() {} |
Govinda Wasserman | 48cdd68 | 2019-06-04 12:15:23 -0400 | [diff] [blame] | 28 | |
Matt Casey | e1ff28d | 2019-06-18 17:58:44 -0400 | [diff] [blame] | 29 | public long getLong(String name, long defaultValue) { |
Govinda Wasserman | 48cdd68 | 2019-06-04 12:15:23 -0400 | [diff] [blame] | 30 | return DeviceConfig.getLong(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue); |
| 31 | } |
| 32 | |
Matt Casey | e1ff28d | 2019-06-18 17:58:44 -0400 | [diff] [blame] | 33 | public int getInt(String name, int defaultValue) { |
Govinda Wasserman | 48cdd68 | 2019-06-04 12:15:23 -0400 | [diff] [blame] | 34 | return DeviceConfig.getInt(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue); |
| 35 | } |
| 36 | |
| 37 | @Nullable |
Matt Casey | e1ff28d | 2019-06-18 17:58:44 -0400 | [diff] [blame] | 38 | public String getString(String name, @Nullable String defaultValue) { |
Govinda Wasserman | 48cdd68 | 2019-06-04 12:15:23 -0400 | [diff] [blame] | 39 | return DeviceConfig.getString(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue); |
| 40 | } |
| 41 | |
Matt Casey | e1ff28d | 2019-06-18 17:58:44 -0400 | [diff] [blame] | 42 | public boolean getBoolean(String name, boolean defaultValue) { |
Govinda Wasserman | 48cdd68 | 2019-06-04 12:15:23 -0400 | [diff] [blame] | 43 | return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue); |
| 44 | } |
| 45 | |
Matt Casey | e1ff28d | 2019-06-18 17:58:44 -0400 | [diff] [blame] | 46 | public void addOnPropertiesChangedListener( |
Govinda Wasserman | 48cdd68 | 2019-06-04 12:15:23 -0400 | [diff] [blame] | 47 | Executor executor, DeviceConfig.OnPropertiesChangedListener listener) { |
| 48 | DeviceConfig.addOnPropertiesChangedListener( |
| 49 | DeviceConfig.NAMESPACE_SYSTEMUI, executor, listener); |
| 50 | } |
| 51 | } |