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 public static final boolean SUPPORT_ONE_HANDED_MODE = 35 SystemProperties.getBoolean("ro.support_one_handed_mode", /* def= */ false); 36 37 // ------ ro.hdmi.* -------- // 38 /** 39 * Property to indicate if a CEC audio device should forward volume keys when system audio 40 * mode is off. 41 */ 42 public static final boolean CEC_AUDIO_DEVICE_FORWARD_VOLUME_KEYS_SYSTEM_AUDIO_MODE_OFF = 43 HdmiProperties.forward_volume_keys_when_system_audio_mode_off().orElse(false); 44 45 // ------ ro.config.* -------- // 46 public static final boolean CONFIG_AVOID_GFX_ACCEL = 47 SystemProperties.getBoolean("ro.config.avoid_gfx_accel", false); 48 public static final boolean CONFIG_LOW_RAM = 49 SystemProperties.getBoolean("ro.config.low_ram", false); 50 public static final boolean CONFIG_SMALL_BATTERY = 51 SystemProperties.getBoolean("ro.config.small_battery", false); 52 53 // ------ ro.fw.* ------------ // 54 public static final boolean FW_SYSTEM_USER_SPLIT = 55 SystemProperties.getBoolean("ro.fw.system_user_split", false); 56 public static final boolean MULTIUSER_HEADLESS_SYSTEM_USER = 57 SystemProperties.getBoolean("ro.fw.mu.headless_system_user", false); 58 59 // ------ ro.crypto.* -------- // 60 public static final CryptoProperties.state_values CRYPTO_STATE = 61 CryptoProperties.state().orElse(CryptoProperties.state_values.UNSUPPORTED); 62 public static final CryptoProperties.type_values CRYPTO_TYPE = 63 CryptoProperties.type().orElse(CryptoProperties.type_values.NONE); 64 // These are pseudo-properties 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 70 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG = 71 "log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS); 72 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_ENFORCE = 73 "enforce".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS); 74 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_DISABLE = 75 !CONTROL_PRIVAPP_PERMISSIONS_LOG && !CONTROL_PRIVAPP_PERMISSIONS_ENFORCE; 76 77 } 78