Home | History | Annotate | Download | only in display
      1 page.title=Retail Demo Mode
      2 @jd:body
      3 
      4 <!--
      5     Copyright 2016 The Android Open Source Project
      6 
      7     Licensed under the Apache License, Version 2.0 (the "License");
      8     you may not use this file except in compliance with the License.
      9     You may obtain a copy of the License at
     10 
     11         http://www.apache.org/licenses/LICENSE-2.0
     12 
     13     Unless required by applicable law or agreed to in writing, software
     14     distributed under the License is distributed on an "AS IS" BASIS,
     15     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16     See the License for the specific language governing permissions and
     17     limitations under the License.
     18 -->
     19 <div id="qv-wrapper">
     20   <div id="qv">
     21     <h2>In this document</h2>
     22     <ol id="auto-toc">
     23     </ol>
     24   </div>
     25 </div>
     26 
     27 <p>
     28 Android 7.1.1 and later offer system-level support for retail mode so
     29 users may readily examine the devices in action. This feature enables anyone in
     30 a retail environment to get a quick, safe, and consistent demonstration of an
     31 Android device and significantly reduce the cost and complexity of a retail mode
     32 for OEMs so that demonstration units are commonplace.
     33 </p>
     34 
     35 <h2 id="key-use-cases">Key use cases</h2>
     36 
     37 <ul>
     38 <li>Any off-the-shelf Android device can be set to retail mode by adding a
     39 single demo video to the build.
     40 <li>All devices have a video highlighting the unique features of the device.
     41 <li>Devices work in both online and offline environments.
     42 <li>Device are self maintaining, requiring minimal interaction by
     43 employees.</li></ul>
     44 
     45 <h2 id="lifecycle">Lifecycle</h2>
     46 
     47 <img src="images/retail-demo-flow.png" alt="retail demo mode flow" width="XXX" id="retail-demo-flow" />
     48 <p class="img-caption">
     49   <strong>Figure 1.</strong> Retail demonstration mode option in Language selection
     50 </p>
     51 
     52 <h3 id="setup-wizard-suw">Setup Wizard (SUW)</h3>
     53 
     54 <p>
     55 Retail employees can enable retail mode directly from the first screen of any setup
     56 wizard by selecting the language <strong>Retail demo</strong> at the bottom of
     57 the list. This option is available for new devices shipped fresh from the
     58 factory. Once a consumer setup has completed, retail mode may no longer be
     59 available.  Once selected, the device finishes SUW with an abbreviated flow.
     60 </p>
     61 
     62 <img src="images/retail-demo-wizard.png" alt="retail demo wizard use" width="XXX" id="retail-demo-wizard" />
     63 <p class="img-caption">
     64   <strong>Figure 2.</strong> Retail demonstration mode option in Language
     65 selection
     66 </p>
     67 
     68 <h3 id="guest-session">Guest session</h3>
     69 
     70 <p>
     71 When the device enters retail mode, it switches to a new demo user and
     72 automatically starts the custom launcher specified in the overlay resource
     73 (described under Implementation).  By default, this custom launcher plays the
     74 demo video on repeat until the user touches the screen to begin a guest session.
     75 At that time, the custom launcher starts the system launcher and then exits.
     76 OEMs can alter the custom launcher to additionally launch another service or
     77 activity on exit. See the <em>Implementation</em> section for details.
     78 </p>
     79 
     80 <p>
     81 In order to maintain the integrity of retail mode, keyguard is disabled and
     82 certain actions from Quick Settings that could adversely affect retail mode are
     83 also disallowed, including:
     84 </p>
     85 
     86 <ul>
     87   <li>Airplane mode toggle
     88   <li>Removing or modifying Wi-Fi access points (Settings)
     89   <li>Changing carrier (Settings)
     90   <li>Configuring hotspot (Settings)
     91   <li>User switching
     92 </ul>
     93 
     94 <p>
     95 Additionally, access is also blocked to some global settings that can affect
     96 retail mode by disabling:
     97 </p>
     98 
     99 <ul>
    100   <li>Wi-Fi settings
    101   <li>Cellular network configuration options, particularly hotspots
    102   <li>Bluetooth configuration
    103   <li>Backup & Reset, Date & Time, and Mobile Networks (they do not show up at
    104 all)
    105 </ul>
    106 
    107 <p>
    108 If the user is idle for some period of time (90 seconds by default), retail mode
    109 will show a system dialog to prompt the user to either exit the session or
    110 continue. If the user chooses to exit or if there's no response for five
    111 seconds, retail mode kills/wipes the current demo user, switches to a new demo
    112 user, and loops through the original video again. If someone turns off the
    113 screen using the power button, it comes back on automatically after a few
    114 seconds.
    115 </p>
    116 
    117 <p>
    118 After exiting a demo session, devices mute themselves and reset some global
    119 settings, including:
    120 </p>
    121 
    122 <ul>
    123   <li>Brightness
    124   <li>Auto-rotation
    125   <li>Flashlight
    126   <li>Language
    127   <li>Accessibility</li></ul>
    128 
    129 <h3 id="exiting-retail-mode">Exiting retail mode</h3>
    130 
    131 <p>
    132 In order to exit retail mode, retail employees must factory reset the device
    133 from the boot loader.
    134 </p>
    135 
    136 <h2 id="examples-and-source">Examples and source</h2>
    137 
    138 <p>
    139 Find the custom launcher that plays a video in a loop within:<br>
    140 <code>/packages/apps/RetailDemo</code>
    141 </p>
    142 
    143 <h2 id="implementation">Implementation</h2>
    144 
    145 <h3 id="enabling-retaildemomodeservice">Enabling RetailDemoModeService</h3>
    146 
    147 <p>
    148 Setup wizard sets a Global setting <code>Global.DEVICE_DEMO_MODE=true</code> to
    149 indicate that the device has entered retail mode. Upon seeing this setting,
    150 <code>RetailDemoModeService</code> creates and switches to demo user when user 0
    151 is started, enables the custom launcher specified in an overlay resource, and
    152 disables SUW.  System Server and SystemUI also use this flag to manage aspects
    153 of retail mode.
    154 </p>
    155 
    156 <h3 id="setting-custom-launcher-or-video-player">Setting custom launcher or
    157 video player</h3>
    158 
    159 <p>
    160 An OEM specifies a custom launcher by overriding the framework resource
    161 <code>config_demoModeLauncherComponent</code> specified in:
    162 <code>/frameworks/base/core/res/res/config.xml</code>
    163 </p>
    164 
    165 <p>
    166 For example, with:
    167 </p>
    168 
    169 <pre>
    170 &lt;!-- Component that is the default launcher when Retail Mode is enabled. --&gt;
    171 &lt;string name="config_demoModeLauncherComponent"&gt;com.android.retaildemo/.DemoPlayer&lt;/string&gt;
    172 </pre>
    173 <p>
    174 The retail demo DemoPlayer app located at
    175 <code>/packages/apps/RetailDemo</code> is the default custom launcher in the
    176 Android Open Source Project (AOSP).  The app looks for a video in
    177 <code>/data/preloads/demo/retail_demo.mp4</code> and plays it in a loop. When
    178 the user touches the screen, the custom launcher disables its activity
    179 component, which results in the default system launcher starting up.
    180 </p>
    181 
    182 <p>The custom launcher must have its custom component marked as disabled by default so that it
    183 doesn't show up in non-demo scenarios. In the demo scenario, System Server
    184 enables the specified <code>config_demoModeLauncherComponent</code> when
    185 starting a new demo session.
    186 </p>
    187 
    188 <p>
    189 Setup wizard also looks for the above video to provide an affordance to enter
    190 retail mode. SUW can be modified to look for some other OEM-specific sign that
    191 retail mode is supported if the video is not a part of the demo.
    192 </p>
    193 
    194 <p>
    195 If there are system A/B partitions, the system B partition must contain the demo
    196 video at <code>/preloads/demo</code>. This gets copied to
    197 <code>/data/preloads/demo</code> on first boot.
    198 </p>
    199 
    200 <p>
    201 To set retail mode-specific settings, use:
    202 <code>Settings.Global.retail_demo_mode_constants</code>. E.g.:
    203 <code>user_inactivity_timeout_ms=90000,warning_dialog_timeout_ms=10000</code>
    204 </p>
    205 
    206 <p class="note"><strong>Note:</strong> 90000 milliseconds is the current
    207 timeout default but is configurable.
    208 </p>
    209 
    210 <h3 id="finding-sample-images">Finding sample images</h3>
    211 
    212 <p>
    213 This feature places sample photos in a special folder that is visible to any
    214 gallery app. The photos are available only in demo mode and cannot be modified
    215 by the demo user as they are in a protected directory.
    216 </p>
    217 
    218 <h3 id="preventing-google-accounts">Preventing Google accounts</h3>
    219 
    220 <p>
    221 Certain restrictions are set in the guest user, similar to managed
    222 device/profile policies that prevent apps and users from performing certain
    223 operations. One of these restrictions is <code>DISALLOW_MODIFY_ACCOUNTS</code>.
    224 With this restriction, AccountManager and Settings do not allow the addition of
    225 accounts. Some Google apps react to this restriction and show an error message,
    226 and others will not prompt for an account (such as YouTube and Photos).
    227 </p>
    228 
    229 <p>
    230 OEM apps should also check if <code>DISALLOW_MODIFY_ACCOUNTS</code> is set. But this is a
    231 general problem not unique to retail mode. It is likely already solved for
    232 enterprise use cases.
    233 </p>
    234 
    235 <h3 id="customizing-the-system-launcher">Customizing the system launcher</h3>
    236 
    237 <p>
    238 OEMs are free to choose their layout but should include apps that function well
    239 on the home screen and hotseat.
    240 </p>
    241 
    242 <h3 id="Customizing-built-in-apps">Customizing built-in apps for retail demo mode</h3>
    243 
    244 <p>
    245 Built-in apps may have their experience for retail demo mode customized by
    246 calling the API <code>UserManager.isDemoUser()</code> to see if the app is
    247 launched in a demo environment.
    248 </p>
    249 
    250 <h3 id="following-demo-video-guidelines">Following demo video guidelines</h3>
    251 
    252 <p>
    253 Demonstration videos should be in portrait layout (or natural orientation of the
    254 device, if tablet) and can be any length greater than five seconds. Content
    255 should not result in burn-in, since it will be played 24/7 when on display.
    256 </p>
    257 
    258 <h2 id="maintenance">Maintenance</h2>
    259 
    260 <h3 id="bringing-the-device-out-of-retail-mode">Bringing the device out of
    261 retail mode</h3>
    262 
    263 <p>
    264 This can be done only by factory resetting from the boot loader.
    265 </p>
    266 
    267 <h3 id="auto-ota-of-system-software">Auto-OTA of system software</h3>
    268 
    269 <p>
    270 By default, when retail mode is enabled, device policy is set to over-the-air
    271 (OTA) update automatically. Retail devices will download, reboot, and install
    272 the update (respecting battery thresholds) without confirmation even if it is
    273 marked as optional.
    274 </p>
    275 
    276 <p class="caution"><strong>Caution:</strong>
    277 If using System A/B partitions for OTA, once an OTA is received, the device
    278 cannot find original retail mode resources in the System B partition. So any
    279 subsequent factory reset will result in an inability to go back into retail
    280 mode.
    281 </p>
    282 
    283 <h3 id="updating-demo-video-via-the-web">Updating demo video via the web</h3>
    284 
    285 <p>
    286 The RetailDemo app in <code>/packages/apps/RetailDemo</code> has the ability to
    287 update the demo video if there is network connectivity. The URL to download the
    288 video from can be configured by overriding the following string value in the
    289 RetailDemo app:
    290 </p>
    291 
    292 <pre>
    293 &lt;!-- URL where the retail demo video can be downloaded from. --&gt;
    294 &lt;string name="retail_demo_video_download_url"&gt;&lt;/string&gt;
    295 </pre>
    296 
    297 <p>
    298 If different videos need to be used in different regions, then different
    299 download URLs can be configured by using locale-specific string resources
    300 <code>res/values-*/strings.xml. </code>For example, if different videos need to
    301 be used in the U.S. and the U.K., then corresponding download URLs can be placed
    302 in <code>res/values-en-rUS/strings.xml</code> and
    303 <code>res/values-en-rGB/strings.xml</code>, respectively.
    304 </p>
    305 
    306 <p>
    307 In <code>res/values-en-rUS/strings.xml</code>:
    308 </p>
    309 
    310 <pre>
    311 &lt;string name="retail_demo_video_download_url"&gt;download URL for US video goes here&lt;/string&gt;
    312 </pre>
    313 
    314 <p>
    315 And similarly in <code>res/values-en-rGB/strings.xml</code>:
    316 </p>
    317 
    318 <pre>
    319 &lt;string name="retail_demo_video_download_url"&gt;download URL for UK video goes here&lt;/string&gt;
    320 </pre>
    321 
    322 <p>
    323 This video will be downloaded at most once per every device reboot. When the
    324 video on the device is being played, RetailDemo app will check in the background
    325 if the download URL is provided and the video at the URL is newer than the one
    326 being played.
    327 
    328 <p>
    329 If so, RetailDemo app will download this video and start playing
    330 it. Once this video is downloaded, the downloaded video will be used for playing
    331 in the demo sessions going forward. None of the checks happen again until after
    332 next reboot.
    333 </p>
    334