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_LOW_RAM =
35             SystemProperties.getBoolean("ro.config.low_ram", false);
36 
37     // ------ ro.fw.* ------------ //
38     public static final boolean FW_SYSTEM_USER_SPLIT =
39             SystemProperties.getBoolean("ro.fw.system_user_split", false);
40 
41     // ------ ro.crypto.* -------- //
42     public static final String CRYPTO_STATE = SystemProperties.get("ro.crypto.state");
43     public static final String CRYPTO_TYPE = SystemProperties.get("ro.crypto.type");
44     // These are pseudo-properties
45     public static final boolean CRYPTO_ENCRYPTABLE =
46             !CRYPTO_STATE.isEmpty() && !"unsupported".equals(CRYPTO_STATE);
47     public static final boolean CRYPTO_ENCRYPTED =
48             "encrypted".equalsIgnoreCase(CRYPTO_STATE);
49     public static final boolean CRYPTO_FILE_ENCRYPTED =
50             "file".equalsIgnoreCase(CRYPTO_TYPE);
51     public static final boolean CRYPTO_BLOCK_ENCRYPTED =
52             "block".equalsIgnoreCase(CRYPTO_TYPE);
53 
54     public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG =
55             "log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS);
56     public static final boolean CONTROL_PRIVAPP_PERMISSIONS_ENFORCE =
57             "enforce".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS);
58     public static final boolean CONTROL_PRIVAPP_PERMISSIONS_DISABLE =
59             !CONTROL_PRIVAPP_PERMISSIONS_LOG && !CONTROL_PRIVAPP_PERMISSIONS_ENFORCE;
60 
61 }
62