Clay Murphy | a001bbd | 2016-07-11 11:58:53 -0700 | [diff] [blame] | 1 | page.title=Data Saver 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 | Mobile data use is costly and even more so where data plan costs are not |
| 29 | affordable by all. Android users need the ability to reduce data use or block it |
| 30 | from apps altogether. The Data Saver feature in the Android 7.0 release provides |
| 31 | this functionality to the user. |
| 32 | </p> |
| 33 | |
| 34 | <p> |
| 35 | The <a href="https://developer.android.com/preview/features/data-saver.html">Data Saver</a> |
| 36 | feature can be turned on or off by the user. App developers |
| 37 | should use a new API to check if Data Saver mode is on. If it is on, the app |
| 38 | developers can handle the situation gracefully by tuning their applications for |
| 39 | low- or no-data access. |
| 40 | </p> |
| 41 | |
| 42 | <p> |
| 43 | End users benefit as they will be able to control which apps can access data in |
| 44 | the background and which can access data only while in the foreground. This |
| 45 | ensures desired background data exchange when Data Saver is on per user control. |
| 46 | </p> |
| 47 | |
| 48 | <h2 id="implementation">Implementation</h2> |
| 49 | |
| 50 | <p> |
| 51 | Since the Data Saver is a feature in the platform, device manufacturers gain its |
| 52 | functionality by default with the N release. |
| 53 | </p> |
| 54 | |
| 55 | <h3 id="settings-interface">Settings interface</h3> |
| 56 | |
| 57 | <p> |
| 58 | A default Data Saver settings user interface is supplied in the Android Open |
| 59 | Source Project (AOSP). See the screenshots below for examples. |
| 60 | </p> |
| 61 | |
| 62 | <p> |
| 63 | These screenshots show the Data Saver mode in use. |
| 64 | </p> |
| 65 | |
| 66 | <img src="images/data-saver-use.png" width="397" alt="Toggling Data Saver off/on" /> |
| 67 | <p class="img-caption"> |
| 68 | <strong>Figure 1.</strong> Toggling Data Saver off/on |
| 69 | </p> |
| 70 | |
| 71 | <img src="images/data-battery-saver.png" width="641" alt="Battery saver and Data Saver are on" /> |
| 72 | <p class="img-caption"> |
| 73 | <strong>Figure 2.</strong> When both battery saver and Data Saver are on |
| 74 | </p> |
| 75 | |
| 76 | <img src="images/data-saver-app.png" width="376" alt="App-specific data usage screen" /> |
| 77 | <p class="img-caption"> |
| 78 | <strong>Figure 3.</strong> App-specific data usage screen: Settings > Apps > Data usage |
| 79 | </p> |
| 80 | |
| 81 | <img src="images/data-saver-quick-settings.png" width="446" alt="Data saver in the Quick Settings" /> |
| 82 | <p class="img-caption"> |
| 83 | <strong>Figure 4.</strong> Data saver states on the Quick Settings menu |
| 84 | </p> |
| 85 | |
| 86 | <h3 id="apps">Apps</h3> |
| 87 | |
| 88 | <strong>Important</strong>: Partners should not whitelist apps. |
| 89 | Even if they do, users may remove them. Including other |
| 90 | apps forces users to decide on which to apply Data Saver. |
| 91 | </p> |
| 92 | |
| 93 | <p> |
| 94 | All app developers must act to implement Data Saver, including OEMs and carrier |
| 95 | partners with preloaded apps. See <a |
| 96 | href="https://developer.android.com/preview/features/data-saver.html">Data Saver |
| 97 | on developer.android.com</a> for app developer instructions on detecting and |
| 98 | monitoring Data Saver states. See the sections below for additional details |
| 99 | helpful to partners. |
| 100 | </p> |
| 101 | |
| 102 | <p> |
| 103 | To optimize for Data Saver mode, apps should: |
| 104 | </p> |
| 105 | |
| 106 | <ul> |
| 107 | <li>Remove unnecessary images |
| 108 | <li>Use lower resolution for remaining images |
| 109 | <li>Use lower bitrate video |
| 110 | <li>Trigger existing “lite” experiences |
| 111 | <li>Compress data |
| 112 | <li>Respect metered vs. unmetered network status even when Data Saver is |
| 113 | off |
| 114 | </ul> |
| 115 | |
| 116 | <p> |
| 117 | Conversely, to work well with Data Saver, apps should not: |
| 118 | </p> |
| 119 | |
| 120 | <ul> |
| 121 | <li>Autoplay videos |
| 122 | <li>Prefetch content/attachments |
| 123 | <li>Download updates / code |
| 124 | <li>Ask to be whitelisted unless background data is truly part of core |
| 125 | functionality |
| 126 | <li>Treat whitelisting as a license to use more bandwidth |
| 127 | </ul> |
| 128 | |
| 129 | <h2 id="validation">Validation</h2> |
| 130 | |
| 131 | <p> |
| 132 | Implementers can ensure their version of the feature works as intended by |
| 133 | running the following CTS test: |
| 134 | </p> |
| 135 | |
| 136 | <pre> |
| 137 | com.android.cts.net.HostsideRestrictBackgroundNetworkTests |
| 138 | </pre> |
| 139 | |
| 140 | <p> |
| 141 | In addition, <code>adb</code> commands can be used to conduct tests manually by |
| 142 | first running this command to see all available options:<br> |
| 143 | <code>$ adb shell cmd netpolicy</code> |
| 144 | </p> |
| 145 | |
| 146 | <p> |
| 147 | For example, this command returns the UIDs of the whitelisted apps:<br> |
| 148 | <code>$ adb shell cmd netpolicy list restrict-background-whitelist</code> |
| 149 | </p> |