• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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.settings.development.graphicsdriver;
17 import android.annotation.NonNull;
18 import android.annotation.Nullable;
19 import android.os.SystemProperties;
20 /**
21  * Wrapper interface to access {@link SystemProperties}.
22  *
23  * @hide
24  */
25 interface GraphicsDriverSystemPropertiesWrapper {
26     /**
27      * Get the String value for the given {@code key}.
28      *
29      * @param key the key to lookup
30      * @param def the default value in case the property is not set or empty
31      * @return if the {@code key} isn't found, return {@code def} if it isn't null, or an empty
32      * string otherwise
33      */
34     @NonNull
get(@onNull String key, @Nullable String def)35     String get(@NonNull String key, @Nullable String def);
36     /**
37      * Set the value for the given {@code key} to {@code val}.
38      *
39      * @throws IllegalArgumentException if the {@code val} exceeds 91 characters
40      * @throws RuntimeException if the property cannot be set, for example, if it was blocked by
41      * SELinux. libc will log the underlying reason.
42      */
set(@onNull String key, @Nullable String val)43     void set(@NonNull String key, @Nullable String val);
44 
45     /**
46      * Get the boolean value for the given {@code key}.
47      *
48      * @param key the key to lookup
49      * @param def the default value in case the property is not set or empty
50      * @return if the {@code key} isn't found, return {@code def}.
51      */
getBoolean(@onNull String key, @NonNull boolean def)52     boolean getBoolean(@NonNull String key, @NonNull boolean def);
53 }
54