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