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 /** 54 * Indicates whether the device should run in headless system user mode, 55 * in which user 0 only runs the system, not a real user. 56 * <p>WARNING about changing this value during an non-wiping update (OTA): 57 * <li>If this value is modified via an update, the change will have no effect, since an 58 * already-existing system user cannot change its mode. 59 * <li>Changing this value during an OTA from a pre-R device is not permitted; attempting to 60 * do so will corrupt the system user. 61 */ 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_ENCRYPTED = 72 CRYPTO_STATE == CryptoProperties.state_values.ENCRYPTED; 73 public static final boolean CRYPTO_FILE_ENCRYPTED = 74 CRYPTO_TYPE == CryptoProperties.type_values.FILE; 75 76 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG = 77 "log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS); 78 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_ENFORCE = 79 "enforce".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS); 80 public static final boolean CONTROL_PRIVAPP_PERMISSIONS_DISABLE = 81 !CONTROL_PRIVAPP_PERMISSIONS_LOG && !CONTROL_PRIVAPP_PERMISSIONS_ENFORCE; 82 83 } 84