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 import android.sysprop.CryptoProperties; 21 22 /** 23 * This is a cache of various ro.* properties so that they can be read just once 24 * at class init time. 25 */ 26 public class RoSystemProperties { 27 public static final boolean DEBUGGABLE = 28 SystemProperties.getInt("ro.debuggable", 0) == 1; 29 public static final int FACTORYTEST = 30 SystemProperties.getInt("ro.factorytest", 0); 31 public static final String CONTROL_PRIVAPP_PERMISSIONS = 32 SystemProperties.get("ro.control_privapp_permissions"); 33 34 // ------ ro.hdmi.* -------- // 35 /** 36 * Property to indicate if a CEC audio device should forward volume keys when system audio 37 * mode is off. 38 */ 39 public static final boolean CEC_AUDIO_DEVICE_FORWARD_VOLUME_KEYS_SYSTEM_AUDIO_MODE_OFF = 40 SystemProperties.getBoolean( 41 "ro.hdmi.cec_audio_device_forward_volume_keys_system_audio_mode_off", false); 42 43 /** 44 * Property to indicate if the current device is a cec switch device. 45 * 46 * <p> Default is false. 47 */ 48 public static final String PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH = 49 "ro.hdmi.property_is_device_hdmi_cec_switch"; 50 51 // ------ ro.config.* -------- // 52 public static final boolean CONFIG_AVOID_GFX_ACCEL = 53 SystemProperties.getBoolean("ro.config.avoid_gfx_accel", false); 54 public static final boolean CONFIG_LOW_RAM = 55 SystemProperties.getBoolean("ro.config.low_ram", false); 56 public static final boolean CONFIG_SMALL_BATTERY = 57 SystemProperties.getBoolean("ro.config.small_battery", false); 58 59 // ------ ro.fw.* ------------ // 60 public static final boolean FW_SYSTEM_USER_SPLIT = 61 SystemProperties.getBoolean("ro.fw.system_user_split", false); 62 public static final boolean MULTIUSER_HEADLESS_SYSTEM_USER = 63 SystemProperties.getBoolean("ro.fw.mu.headless_system_user", false); 64 65 // ------ ro.crypto.* -------- // 66 public static final CryptoProperties.state_values CRYPTO_STATE = 67 CryptoProperties.state().orElse(CryptoProperties.state_values.UNSUPPORTED); 68 public static final CryptoProperties.type_values CRYPTO_TYPE = 69 CryptoProperties.type().orElse(CryptoProperties.type_values.NONE); 70 // These are pseudo-properties 71 public static final boolean CRYPTO_ENCRYPTABLE = 72 CRYPTO_STATE != CryptoProperties.state_values.UNSUPPORTED; 73 public static final boolean CRYPTO_ENCRYPTED = 74 CRYPTO_STATE == CryptoProperties.state_values.ENCRYPTED; 75 public static final boolean CRYPTO_FILE_ENCRYPTED = 76 CRYPTO_TYPE == CryptoProperties.type_values.FILE; 77 public static final boolean CRYPTO_BLOCK_ENCRYPTED = 78 CRYPTO_TYPE == CryptoProperties.type_values.BLOCK; 79 80 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG = 81 "log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS); 82 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_ENFORCE = 83 "enforce".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS); 84 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_DISABLE = 85 !CONTROL_PRIVAPP_PERMISSIONS_LOG && !CONTROL_PRIVAPP_PERMISSIONS_ENFORCE; 86 87 } 88