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 android.car.settings; 18 19 import static android.car.feature.Flags.FLAG_CAR_NIGHT_GLOBAL_SETTING; 20 import static android.car.feature.Flags.FLAG_PERSIST_AP_SETTINGS; 21 22 import android.annotation.FlaggedApi; 23 import android.annotation.SystemApi; 24 25 /** 26 * System-level, car-related settings. 27 * 28 * @hide 29 */ 30 @SystemApi 31 public class CarSettings { 32 CarSettings()33 private CarSettings() { 34 throw new UnsupportedOperationException("this class only provide constants"); 35 } 36 37 /** 38 * Global car settings, containing preferences that always apply identically 39 * to all defined users. Applications can read these but are not allowed to write; 40 * like the "Secure" settings, these are for preferences that the user must 41 * explicitly modify through the system UI or specialized APIs for those values. 42 * 43 * <p>To read/write the global car settings, use {@link android.provider.Settings.Global} 44 * with the keys defined here. 45 * 46 * @hide 47 */ 48 @SystemApi 49 public static final class Global { 50 Global()51 private Global() { 52 throw new UnsupportedOperationException("this class only provide constants"); 53 } 54 55 /** 56 * Whether default restrictions for users have been set. 57 * 58 * @hide 59 */ 60 public static final String DEFAULT_USER_RESTRICTIONS_SET = 61 "android.car.DEFAULT_USER_RESTRICTIONS_SET"; 62 63 /** 64 * Developer settings String used to explicitly disable the instrumentation service (when 65 * set to {@code "true"}. 66 * 67 * @hide 68 */ 69 public static final String DISABLE_INSTRUMENTATION_SERVICE = 70 "android.car.DISABLE_INSTRUMENTATION_SERVICE"; 71 72 /** 73 * Developer settings String used to explicitly enable the user switch message when 74 * set to {@code "true"}. 75 * 76 * @hide 77 */ 78 public static final String ENABLE_USER_SWITCH_DEVELOPER_MESSAGE = 79 "android.car.ENABLE_USER_SWITCH_DEVELOPER_MESSAGE"; 80 81 /** 82 * User id of the last foreground user 83 * 84 * @hide 85 */ 86 public static final String LAST_ACTIVE_USER_ID = 87 "android.car.LAST_ACTIVE_USER_ID"; 88 89 /** 90 * User id of the last persistent (i.e, not counting ephemeral guests) foreground user 91 * 92 * @hide 93 */ 94 public static final String LAST_ACTIVE_PERSISTENT_USER_ID = 95 "android.car.LAST_ACTIVE_PERSISTENT_USER_ID"; 96 97 /** 98 * Defines global runtime overrides to system bar policy. 99 * 100 * See {@link com.android.systemui.wm.BarControlPolicy} for value format. 101 * 102 * @hide 103 */ 104 public static final String SYSTEM_BAR_VISIBILITY_OVERRIDE = 105 "android.car.SYSTEM_BAR_VISIBILITY_OVERRIDE"; 106 107 /** 108 * Defines non-current visible users to assign per each occupant zone. 109 * 110 * <p>The value of this will be a ',' separated list of zoneId:userId. zoneId and userId 111 * should be a string of decimal integer. Example can be "1:10,2:11" where zone 1 has 112 * user 10 and zone 2 has user 11 allocated. 113 * 114 * <p>When system boots up, car service will allocate those users to the specified zones. 115 * If any entry in the value is invalid or if there are duplicate entries, the value will be 116 * ignored and no user will be assigned. 117 * 118 * @hide 119 */ 120 @SystemApi 121 public static final String GLOBAL_VISIBLE_USER_ALLOCATION_PER_ZONE = 122 "android.car.GLOBAL_VISIBLE_USER_ALLOCATION_PER_ZONE"; 123 124 /** 125 * Defines passenger displays to lock their touch input. 126 * 127 * <p> The value of this will be a ',' separated list of display's unique id. For example, 128 * "local:4630946674560563248,local:4630946674560563349" with input lock enabled for both 129 * displays. 130 * 131 * <p> Input lock will be applied to those passenger displays. If any entry in the value 132 * is invalid, then the invalid entry is ignored. If there are duplicate entries, then 133 * only one entry is valid and the other duplicates are ignored. 134 * @hide 135 */ 136 @SystemApi 137 public static final String DISPLAY_INPUT_LOCK = 138 "android.car.DISPLAY_INPUT_LOCK"; 139 140 /** 141 * Defines display power mode to assign per each display. 142 * 143 * <p>The value of this will be a ',' separated list of displayPort:mode. 144 * display port and mode should be a string of decimal integer. 145 * Example can be "0:2,1:0,2:1" where display 0 set mode 2, display 1 set mode 0 146 * and display 2 set mode 1 allocated. 147 * 148 * <p>When system boots up, car service will set those modes to the specified displays. 149 * If any entry in the value is invalid, the value will be ignored and no mode will be set. 150 * If there are duplicate entries, the last entry will be applied. 151 * 152 * <p>The mode is an integer (0, 1 or 2) where: 153 * <ul> 154 * <li>0 indicates OFF should applied to intentionally turn off the display and not be 155 * allowed to manually turn on the display 156 * <li>1 indicates ON should be applied to screen off timeout and allowed to manually turn 157 * off the display. 158 * <li>2 indicates ALWAYS ON should be applied to keep the display on and allowed to 159 * manually turn off the display 160 * </ul> 161 * 162 * @hide 163 */ 164 @SystemApi 165 public static final String DISPLAY_POWER_MODE = "android.car.DISPLAY_POWER_MODE"; 166 167 /** 168 * Indicates which {@link CarNightService.DayNightSensorMode} is currently set. 169 * 170 * <p>The mode is an integer (0, 1 or 2) where: 171 * <ul> 172 * <li>0 indicates sensor mode, where the {@link VehicleProperty.NIGHT_MODE} will be used 173 * to set the system's UI mode. 174 * <li>1 indicates the day UI mode should always be used 175 * <li>2 indicates the night UI mode should always be used 176 * </ul> 177 * 178 * @hide 179 */ 180 @FlaggedApi(FLAG_CAR_NIGHT_GLOBAL_SETTING) 181 @SystemApi 182 public static final String FORCED_DAY_NIGHT_MODE = "android.car.FORCED_DAY_NIGHT_MODE"; 183 184 /** 185 * Enables persistent tethering when set to {@code "true"}. 186 * 187 * <p>When enabled, tethering is started when the car is started given that the hotspot 188 * was enabled at shutdown and all tethering sessions will remain on even if no devices are 189 * connected to it. 190 * 191 * <p>When disabled, hotspot will turn off automatically if no devices are connected and 192 * will no longer persist through drives. 193 * 194 * @hide 195 */ 196 @FlaggedApi(FLAG_PERSIST_AP_SETTINGS) 197 @SystemApi 198 public static final String ENABLE_PERSISTENT_TETHERING = 199 "android.car.ENABLE_PERSISTENT_TETHERING"; 200 } 201 202 /** 203 * Default garage mode wake up time 00:00 204 * 205 * @hide 206 */ 207 public static final int[] DEFAULT_GARAGE_MODE_WAKE_UP_TIME = {0, 0}; 208 209 /** 210 * Default garage mode maintenance window 10 mins. 211 * 212 * @hide 213 */ 214 public static final int DEFAULT_GARAGE_MODE_MAINTENANCE_WINDOW = 10 * 60 * 1000; 215 216 /** 217 * @hide 218 */ 219 @SystemApi 220 public static final class Secure { 221 Secure()222 private Secure() { 223 throw new UnsupportedOperationException("this class only provide constants"); 224 } 225 226 /** 227 * Key to indicate whether audio focus requests for 228 * {@link android.hardware.automotive.audiocontrol.V1_0.ContextNumber.NAVIGATION} should 229 * be rejected if focus is currently held by 230 * {@link android.hardware.automotive.audiocontrol.V1_0.ContextNumber.CALL}. 231 * <p>The value is a boolean (1 or 0) where: 232 * <ul> 233 * <li>1 indicates {@code NAVIGATION} should be rejected when a {@code CALL} is in progress. 234 * <li>0 indicates {@code NAVIGATION} and {@code CALL} should be allowed to hold focus 235 * concurrently. 236 * </ul> 237 * 238 * <p>Recommended {@code false} as default value. 239 * 240 * @hide 241 */ 242 @SystemApi 243 public static final String KEY_AUDIO_FOCUS_NAVIGATION_REJECTED_DURING_CALL = 244 "android.car.KEY_AUDIO_FOCUS_NAVIGATION_REJECTED_DURING_CALL"; 245 246 /** 247 * Key to indicate if mute state should be persisted across boot cycles. 248 * <p>The value is a boolean (1 or 0) where: 249 * <ul> 250 * <li>1 indicates volume group mute states should be persisted across boot cycles. 251 * <li>0 indicates volume group mute states should not be persisted across boot cycles. 252 * </ul> 253 * 254 * @hide 255 */ 256 @SystemApi 257 public static final String KEY_AUDIO_PERSIST_VOLUME_GROUP_MUTE_STATES = 258 "android.car.KEY_AUDIO_PERSIST_VOLUME_GROUP_MUTE_STATES"; 259 260 /** 261 * Key for a list of devices to automatically connect on Bluetooth. 262 * Written to and read by {@link com.android.car.BluetoothDeviceManager} 263 * @hide 264 */ 265 public static final String KEY_BLUETOOTH_DEVICES = 266 "android.car.KEY_BLUETOOTH_DEVICES"; 267 268 /** 269 * Key for storing temporarily-disconnected devices and profiles. 270 * Read and written by {@link com.android.car.BluetoothProfileInhibitManager}. 271 * @hide 272 */ 273 public static final String KEY_BLUETOOTH_PROFILES_INHIBITED = 274 "android.car.BLUETOOTH_PROFILES_INHIBITED"; 275 276 /** 277 * Key to enable / disable rotary key event filtering. When enabled, a USB keyboard can be 278 * used as a stand-in for a rotary controller. 279 * The value is boolean (1 or 0). 280 * @hide 281 */ 282 @SystemApi 283 public static final String KEY_ROTARY_KEY_EVENT_FILTER = 284 "android.car.ROTARY_KEY_EVENT_FILTER"; 285 286 /** 287 * Key to enable / disable initial notice screen that will be shown for all user-starting 288 * moments including cold boot, wake up from suspend, and user switching. 289 * The value is boolean (1 or 0). 290 * @hide 291 */ 292 @SystemApi 293 public static final String KEY_ENABLE_INITIAL_NOTICE_SCREEN_TO_USER = 294 "android.car.ENABLE_INITIAL_NOTICE_SCREEN_TO_USER"; 295 296 /** 297 * Key to indicate Setup Wizard is in progress. It differs from USER_SETUP_COMPLETE in 298 * that this flag can be reset to 0 in deferred Setup Wizard flow. 299 * The value is boolean (1 or 0). 300 * @hide 301 */ 302 @SystemApi 303 public static final String KEY_SETUP_WIZARD_IN_PROGRESS = 304 "android.car.SETUP_WIZARD_IN_PROGRESS"; 305 306 /** 307 * Key for a {@code ;} separated list of packages disabled on resource overuse. 308 * 309 * <p>The value is written by {@link com.android.car.watchdog.CarWatchdogService}. 310 * 311 * <p>The value is read by user interfaces (such as launcher) that show applications 312 * disabled on resource overuse. When a user selects any application from this list, 313 * the user interface should either enable the application immediately or provide user 314 * affordance to enable the application when the driving conditions are safe. 315 * 316 * <p>When an application (which is on this list) is enabled, CarService will immediately 317 * remove the application's package name form the list. 318 * @hide 319 */ 320 @SystemApi 321 public static final String KEY_PACKAGES_DISABLED_ON_RESOURCE_OVERUSE = 322 "android.car.KEY_PACKAGES_DISABLED_ON_RESOURCE_OVERUSE"; 323 324 /** 325 * Key for an int value to indicate whether the user has accepted the Terms of 326 * Service. 327 * 328 * <p>The value is an int value where: 329 * <ul> 330 * <li>0 - the acceptance value is unknown. In this case, functionality 331 * should not be restricted. 332 * <li>1 - the acceptance value is {@code false}. In this case, some system 333 * functionality is restricted. 334 * <li>2 - the acceptance value is {@code true}. In this case, system functionality is 335 * not restricted. 336 * </ul> 337 * 338 * <p>Recommended 0 as default value. 339 * 340 * @hide 341 */ 342 @SystemApi 343 public static final String KEY_USER_TOS_ACCEPTED = "android.car.KEY_USER_TOS_ACCEPTED"; 344 345 346 /** 347 * Key for a string value to indicate which apps are disabled because the 348 * user has not accepted the Terms of Service. 349 * 350 * <p>The value is a string value of comma-separated package names. For example, 351 * {@code "com.company.maps,com.company.voiceassistant,com.company.appstore"} 352 * 353 * <p>Recommended "" as default value. 354 * 355 * @hide 356 */ 357 @SystemApi 358 public static final String KEY_UNACCEPTED_TOS_DISABLED_APPS = 359 "android.car.KEY_UNACCEPTED_TOS_DISABLED_APPS"; 360 361 /** 362 * Defines non-current visible users to assign per each occupant zone. 363 * 364 * <p>For the format of the value, check {@link Global#VISIBLE_USER_ALLOCATION_PER_ZONE}. 365 * This is per user setting and system will apply this when this user is the 366 * current user during the boot up. 367 * 368 * <p>If both {@link Global#VISIBLE_USER_ALLOCATION_PER_ZONE} and this value is 369 * set, this value will be used and {@link Global#VISIBLE_USER_ALLOCATION_PER_ZONE} will 370 * be ignored. 371 * 372 * @hide 373 */ 374 @SystemApi 375 public static final String VISIBLE_USER_ALLOCATION_PER_ZONE = 376 "android.car.VISIBLE_USER_ALLOCATION_PER_ZONE"; 377 378 /** 379 * Key to indicate whether to allow the driver user to allow controlling media sessions of 380 * a passenger user. 381 * 382 * <p>This is per user setting and the drvier's Media Control Center app will query this 383 * to check whether it can connect/control other user's media session. 384 * The value type is boolean (1 for true, or 0 for false. false by default). 385 * 386 * @hide 387 */ 388 @SystemApi 389 public static final String KEY_DRIVER_ALLOWED_TO_CONTROL_MEDIA = 390 "android.car.DRIVER_ALLOWED_TO_CONTROL_MEDIA"; 391 } 392 } 393