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