Beyond the requirements described in Build parked apps for Android Automotive OS, there are a few additional requirements specific to browsers that are detailed on this page.
Allow users to block access to sensitive data
Unlike many Android devices, Android Automotive OS vehicles are often shared devices. To give users the ability to protect their sensitive data such as passwords and payments information, browsers built for Android Automotive OS must not save or allow access to passwords or payment information unless the user can block access to passwords using a profile lock. Authentication can be accomplished either by using the device credential or by building an authentication system within your app.
Additionally, before syncing sensitive data, browsers built for Android Automotive OS must prompt the user to authenticate and provide messaging to let the user know that their data is being synchronized to the car. If the user does not have any method of authentication set up, you can prompt them to set one up when they try to sync sensitive data, using either the device credential or one specific to your app.
Use the device credential for authentication
This section provides guidance on how to use the device credential and system authentication APIs to meet the sensitive data requirements described prior.
Check if there is a device credential set
To determine if the user has secured their device with a PIN, pattern, or
password, you can use the KeyguardManager::isDeviceSecure
method.
Kotlin
val keyguardManager = context.getSystemService(KeyguardManager::class.java) val isDeviceSecure = keyguardManager.isDeviceSecure()
Java
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); boolean isDeviceSecure = keyguardManager.isDeviceSecure();
Open the lock screen settings
To reduce user friction in the case they need to set a device credential, you
can open up the Security screen within the Settings app using the
Settings.ACTION_SECURITY_SETTINGS
intent action.
Kotlin
context.startActivity(Intent(Settings.ACTION_SECURITY_SETTINGS))
Java
context.startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS))
Prompt the user to authenticate
To prompt the user to authenticate, you can use the BiometricPrompt
API as
described in Show a biometric authentication dialog.