blob: b3f57afc0753a3caa57ab8dd12b3438188d03d56 [file] [log] [blame]
Govinda Wasserman48cdd682019-06-04 12:15:23 -04001/*
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
17package com.android.systemui.assist;
18
19import android.provider.DeviceConfig;
20
21import androidx.annotation.Nullable;
22
23import java.util.concurrent.Executor;
24
Matt Caseye1ff28d2019-06-18 17:58:44 -040025public class PhenotypeHelper {
Govinda Wasserman48cdd682019-06-04 12:15:23 -040026
Matt Caseye1ff28d2019-06-18 17:58:44 -040027 public PhenotypeHelper() {}
Govinda Wasserman48cdd682019-06-04 12:15:23 -040028
Matt Caseye1ff28d2019-06-18 17:58:44 -040029 public long getLong(String name, long defaultValue) {
Govinda Wasserman48cdd682019-06-04 12:15:23 -040030 return DeviceConfig.getLong(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue);
31 }
32
Matt Caseye1ff28d2019-06-18 17:58:44 -040033 public int getInt(String name, int defaultValue) {
Govinda Wasserman48cdd682019-06-04 12:15:23 -040034 return DeviceConfig.getInt(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue);
35 }
36
37 @Nullable
Matt Caseye1ff28d2019-06-18 17:58:44 -040038 public String getString(String name, @Nullable String defaultValue) {
Govinda Wasserman48cdd682019-06-04 12:15:23 -040039 return DeviceConfig.getString(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue);
40 }
41
Matt Caseye1ff28d2019-06-18 17:58:44 -040042 public boolean getBoolean(String name, boolean defaultValue) {
Govinda Wasserman48cdd682019-06-04 12:15:23 -040043 return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue);
44 }
45
Matt Caseye1ff28d2019-06-18 17:58:44 -040046 public void addOnPropertiesChangedListener(
Govinda Wasserman48cdd682019-06-04 12:15:23 -040047 Executor executor, DeviceConfig.OnPropertiesChangedListener listener) {
48 DeviceConfig.addOnPropertiesChangedListener(
49 DeviceConfig.NAMESPACE_SYSTEMUI, executor, listener);
50 }
51}