Tuesday, 2 Jul 2024
Technology

Retail Demo Mode

Android 7.1.1 introduced system-level support for retail demo mode, enabling customers to experience devices in action at retail stores. In this mode, devices are set up using a device owner app, which restricts device usage to specific demo mode apps. End users are unable to add personal accounts on retail demo devices. Android 8.1 further enhances this support, allowing OEMs to customize user management and device policy on the demo device.

Implementation in Android 8.1 and later

Android 8.1 introduces platform enhancements and a retail demo app for retail demo mode.

Platform changes

To enable a device owner-based retail demo mode, devices must set Settings.Global.DEVICE_DEMO_MODE to 1. This flag indicates that the device is being provisioned for retail demo mode. SystemServer uses this flag to manage aspects of retail mode, such as power profile and SystemUI. It’s important to note that once a consumer setup is complete, a device cannot be provisioned for retail demo.

The setup wizard sets the Global.DEVICE_DEMO_MODE global setting to true on devices implementing retail demo mode. This setting indicates that the device has entered retail mode. When the setup wizard detects this setting, the RetailDemoModeService creates a demo user and switches to it when user 0 starts. It also enables the custom launcher specified in an overlay resource and disables the Set Up Wizard (SUW). System Server and SystemUI utilize this flag to manage retail mode aspects.

Device manufacturers can specify a custom launcher or video player by overriding the config_demoModeLauncherComponent resource in the config.xml file. The default custom launcher in the Android Open Source Project (AOSP) is the retail demo DemoPlayer app. This app plays a video in a loop, located at /data/preloads/demo/retail_demo.mp4. When the user touches the screen, the custom launcher disables its activity component, causing the default system launcher to start.

Tham Khảo Thêm:  Contents of Trace Files, Dump Files, and Settings Files

Preloaded apps can customize their experience for retail demo mode by using the UserManager.isDemoUser() API. Certain restrictions are set on the demo user, preventing certain operations. OEM apps should check if the DISALLOW_MODIFY_ACCOUNTS restriction is set and handle the scenario accordingly.

By default, when retail mode is enabled, device policy is set to automatically apply over-the-air (OTA) updates. Retail devices will download, reboot, and install updates without user interaction. If using System A/B partitions for OTA, subsequent factory resets will result in an inability to return to retail mode.

Retail demo app

Implementing device owner-based retail demo mode requires a Device Policy Controller app to be set as the device owner. The AOSP provides a reference implementation of the RetailDemo app. Device owner apps do not need elevated privileges or pre-installation on the system image and can be downloaded during the setup or provisioning process.

The RetailDemo app must extend the DeviceAdminReceiver component, which serves as the authorization token for all DevicePolicyManager APIs. It must hold the android.permission.BIND_DEVICE_ADMIN permission, include the requested special policies as metadata, and filter specific intents. The DevicePolicyManager#MAKE_USER_DEMO flag, which creates special demo-type users, is a hidden API.

APIs in the DevicePolicyManager class enable Device Owners (DO) and Profile Owners (PO) to enforce various device policies. Some of the applicable functions for retail demo mode include creating and managing users, rebooting the device, setting LockTask allowed packages, installing packages through PackageInstaller, blocking package uninstallation, enabling automatic system updates, disabling the keyguard, preventing password or fingerprint setting, setting an allowlisted set of settings, and setting user restrictions.

The RetailDemo app has the ability to update the demo video using a URL from the web. The download URL can be configured in the app, and different URLs can be used for different regions by utilizing locale-specific string resources.

Tham Khảo Thêm:  How to Find Someone on OnlyFans: 8 Different Methods

Demonstration videos for retail demo mode must be in portrait layout or the device’s natural orientation for tablets. They can be any length greater than five seconds. It’s essential to ensure that the content does not result in burn-in since it will be continuously played when on display.

Validation

Retail demo mode is an optional feature and is not covered by the Compatibility Test Suite (CTS). Manual testing or unit tests for the demo app must be conducted to validate its functionality.

Demo session

A retail demo device may boot into retail demo mode if configured from the factory, or retail employees can enable retail mode directly from the setup wizard.

When the device enters retail mode, it switches to a new demo user and automatically starts the custom launcher specified in the overlay resource. By default, the custom launcher plays the demo video on repeat until the user interacts with the screen to start a demo user session. At that point, the custom launcher starts the system launcher and exits. OEMs can customize the custom launcher to launch additional services or activities upon exit.

Keyguard is disabled in retail mode, and certain actions from Quick Settings that could affect retail mode are disallowed. Additionally, access is blocked to global settings that can impact retail mode.

If the user is idle for a certain period of time, retail mode prompts the user to either exit the session or continue. If the user chooses to exit or does not respond within five seconds, retail mode removes the current demo user, switches to a new demo user, and loops through the original video again. If the screen is turned off using the power button, it automatically turns back on after a few seconds.

Tham Khảo Thêm:  Top 10 DVD Burning Software

After exiting a demo session, devices mute themselves and reset certain global settings, including brightness, auto-rotation, flashlight, language, and accessibility.

To exit retail mode, retail employees must ensure that the demo device is not enrolled under device management and factory reset the device from the boot loader.

Q: Is retail demo mode available on all Android devices?
A: Retail demo mode is an optional feature introduced in Android 7.1.1. While it is supported on most Android devices running Android 8.1 and later, it may not be available on every device.

Q: Can users add their personal accounts on retail demo devices?
A: No, retail demo devices are restricted from adding personal accounts. This ensures that the device remains in demo mode for retail store demonstrations.

Q: Can preloaded apps customize their experience for retail demo mode?
A: Yes, preloaded apps can use the UserManager.isDemoUser() API to determine if they are launched in a demo environment. They can then customize their behavior accordingly.

Q: How can I exit retail demo mode?
A: To exit retail mode, ensure that the demo device is not enrolled under device management and perform a factory reset from the boot loader.

Q: Can I update the demo video in retail demo mode?
A: Yes, the RetailDemo app provides the ability to update the demo video using a URL from the web. Different videos can be used in different regions by configuring locale-specific string resources.

Retail demo mode in Android 8.1 and later provides powerful features for retailers to showcase devices in stores. With the ability to customize user management, device policies, and preloaded apps, retail demo mode offers a tailored experience for retail demonstrations. By following the guidelines and leveraging the RetailDemo app, OEMs can create compelling retail demo experiences for customers. To learn more about Eireview, visit Eireview.