1 <html devsite> 2 <head> 3 <title>Data Saver mode</title> 4 <meta name="project_path" value="/_project.yaml" /> 5 <meta name="book_path" value="/_book.yaml" /> 6 </head> 7 <body> 8 <!-- 9 Copyright 2017 The Android Open Source Project 10 11 Licensed under the Apache License, Version 2.0 (the "License"); 12 you may not use this file except in compliance with the License. 13 You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 --> 23 24 25 26 <p> 27 Mobile data use is costly and even more so where data plan costs are not 28 affordable by all. Android users need the ability to reduce data use or block it 29 from apps altogether. The Data Saver feature in the Android 7.0 release provides 30 this functionality to the user. 31 </p> 32 33 <p> 34 The <a href="https://developer.android.com/preview/features/data-saver.html">Data Saver</a> 35 feature can be turned on or off by the user. App developers 36 should use a new API to check if Data Saver mode is on. If it is on, the app 37 developers can handle the situation gracefully by tuning their applications for 38 low- or no-data access. 39 </p> 40 41 <p> 42 End users benefit as they will be able to control which apps can access data in 43 the background and which can access data only while in the foreground. This 44 ensures desired background data exchange when Data Saver is on per user control. 45 </p> 46 47 <h2 id="implementation">Implementation</h2> 48 49 <p> 50 Since the Data Saver is a feature in the platform, device manufacturers gain its 51 functionality by default with the N release. 52 </p> 53 54 <h3 id="settings-interface">Settings interface</h3> 55 56 <p> 57 A default Data Saver settings user interface is supplied in the Android Open 58 Source Project (AOSP). See the screenshots below for examples. 59 </p> 60 61 <p> 62 These screenshots show the Data Saver mode in use. 63 </p> 64 65 <img src="/devices/tech/connect/images/data-saver-use.png" width="397" alt="Toggling Data Saver off/on" /> 66 <p class="img-caption"> 67 <strong>Figure 1.</strong> Toggling Data Saver off/on 68 </p> 69 70 <img src="/devices/tech/connect/images/data-battery-saver.png" width="641" alt="Battery saver and Data Saver are on" /> 71 <p class="img-caption"> 72 <strong>Figure 2.</strong> When both battery saver and Data Saver are on 73 </p> 74 75 <img src="/devices/tech/connect/images/data-saver-app.png" width="376" alt="App-specific data usage screen" /> 76 <p class="img-caption"> 77 <strong>Figure 3.</strong> App-specific data usage screen: Settings > Apps > Data usage 78 </p> 79 80 <img src="/devices/tech/connect/images/data-saver-quick-settings.png" width="446" alt="Data saver in the Quick Settings" /> 81 <p class="img-caption"> 82 <strong>Figure 4.</strong> Data saver states on the Quick Settings menu 83 </p> 84 85 <h3 id="apps">Apps</h3> 86 87 <p class="caution"><strong>Important</strong>: Device implementers should not whitelist apps. 88 Even if they do, users may remove them. Including other apps forces users to decide on which to 89 apply Data Saver.</p> 90 91 <p> 92 All app developers must act to implement Data Saver, including OEMs and 93 carriers with preloaded apps. See 94 <a href="https://developer.android.com/preview/features/data-saver.html">Data 95 Saver on developer.android.com</a> for app developer instructions on detecting 96 and monitoring Data Saver states. See the sections below for additional details 97 helpful to partners. </p> 98 99 <p> 100 To optimize for Data Saver mode, apps should: 101 </p> 102 103 <ul> 104 <li>Remove unnecessary images 105 <li>Use lower resolution for remaining images 106 <li>Use lower bitrate video 107 <li>Trigger existing lite experiences 108 <li>Compress data 109 <li>Respect metered vs. unmetered network status even when Data Saver is 110 off 111 </ul> 112 113 <p> 114 Conversely, to work well with Data Saver, apps should not: 115 </p> 116 117 <ul> 118 <li>Autoplay videos 119 <li>Prefetch content/attachments 120 <li>Download updates / code 121 <li>Ask to be whitelisted unless background data is truly part of core 122 functionality 123 <li>Treat whitelisting as a license to use more bandwidth 124 </ul> 125 126 <h2 id="validation">Validation</h2> 127 128 <p> 129 Implementers can ensure their version of the feature works as intended by 130 running the following CTS test: 131 </p> 132 133 <pre class="devsite-click-to-copy"> 134 com.android.cts.net.HostsideRestrictBackgroundNetworkTests 135 </pre> 136 137 <p> 138 In addition, <code>adb</code> commands can be used to conduct tests manually by 139 first running this command to see all available options:</p> 140 <pre class="devsite-terminal devsite-click-to-copy"> 141 adb shell cmd netpolicy 142 </pre> 143 144 <p> 145 For example, this command returns the UIDs of the whitelisted apps:</p> 146 <pre class="devsite-terminal devsite-click-to-copy"> 147 adb shell cmd netpolicy list restrict-background-whitelist 148 </pre> 149 150 </body> 151 </html> 152