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