1 /*
2  * Copyright (C) 2016 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.internal.os;
18 
19 import android.os.SystemProperties;
20 
21 /**
22  * This is a cache of various ro.* properties so that they can be read just once
23  * at class init time.
24  */
25 public class RoSystemProperties {
26     public static final boolean DEBUGGABLE =
27             SystemProperties.getInt("ro.debuggable", 0) == 1;
28     public static final int FACTORYTEST =
29             SystemProperties.getInt("ro.factorytest", 0);
30     public static final String CONTROL_PRIVAPP_PERMISSIONS =
31             SystemProperties.get("ro.control_privapp_permissions");
32 
33     // ------ ro.config.* -------- //
34     public static final boolean CONFIG_AVOID_GFX_ACCEL =
35             SystemProperties.getBoolean("ro.config.avoid_gfx_accel", false);
36     public static final boolean CONFIG_LOW_RAM =
37             SystemProperties.getBoolean("ro.config.low_ram", false);
38     public static final boolean CONFIG_SMALL_BATTERY =
39             SystemProperties.getBoolean("ro.config.small_battery", false);
40 
41     // ------ ro.fw.* ------------ //
42     public static final boolean FW_SYSTEM_USER_SPLIT =
43             SystemProperties.getBoolean("ro.fw.system_user_split", false);
44 
45     // ------ ro.crypto.* -------- //
46     public static final String CRYPTO_STATE = SystemProperties.get("ro.crypto.state");
47     public static final String CRYPTO_TYPE = SystemProperties.get("ro.crypto.type");
48     // These are pseudo-properties
49     public static final boolean CRYPTO_ENCRYPTABLE =
50             !CRYPTO_STATE.isEmpty() && !"unsupported".equals(CRYPTO_STATE);
51     public static final boolean CRYPTO_ENCRYPTED =
52             "encrypted".equalsIgnoreCase(CRYPTO_STATE);
53     public static final boolean CRYPTO_FILE_ENCRYPTED =
54             "file".equalsIgnoreCase(CRYPTO_TYPE);
55     public static final boolean CRYPTO_BLOCK_ENCRYPTED =
56             "block".equalsIgnoreCase(CRYPTO_TYPE);
57 
58     public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG =
59             "log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS);
60     public static final boolean CONTROL_PRIVAPP_PERMISSIONS_ENFORCE =
61             "enforce".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS);
62     public static final boolean CONTROL_PRIVAPP_PERMISSIONS_DISABLE =
63             !CONTROL_PRIVAPP_PERMISSIONS_LOG && !CONTROL_PRIVAPP_PERMISSIONS_ENFORCE;
64 
65 }
66