From 8cdd5e3971b9db688d5ab45b9a7af590eff782b1 Mon Sep 17 00:00:00 2001
From: Adarsh Fernando
Date: Mon, 14 Mar 2016 13:49:12 -0700
Subject: [PATCH] Docs: Added adb commands to Data Saver.
- Fixed typo in sample code switch statement
Bug:27644679
Bug:27682112
Change-Id: I06107c786e6565483709e2a4c399c31ca7c32f0e
---
docs/html/preview/features/data-saver.jd | 67 ++++++++++++++++++++++--
1 file changed, 64 insertions(+), 3 deletions(-)
diff --git a/docs/html/preview/features/data-saver.jd b/docs/html/preview/features/data-saver.jd
index 03f0df2ed26ef..ba8f1653d0255 100644
--- a/docs/html/preview/features/data-saver.jd
+++ b/docs/html/preview/features/data-saver.jd
@@ -15,8 +15,11 @@ page.keywords="android N", "data usage", "metered network"
- Monitoring Changes to Data Saver
- Preferences
+ Monitoring Changes to Data Saver Preferences
+
+
+
+ Testing with Android Debug Bridge Commands
@@ -102,7 +105,7 @@ ConnectivityManager connMgr = (ConnectivityManager)
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
// Checks user’s Data Saver settings.
- switch (connMgr.getRestrictBackgroundStatus) {
+ switch (connMgr.getRestrictBackgroundStatus()) {
case RESTRICT_BACKGROUND_STATUS_ENABLED:
// Background data usage is blocked for this app. Wherever possible,
// the app should also use less data in the foreground.
@@ -144,3 +147,61 @@ if (connMgr.isActiveNetworkMetered()) {
that register to receive this broadcast in their manifest will not receive
them.
+
+
+ Testing with Android Debug Bridge Commands
+
+
+The Android Debug Bridge (ADB)
+provides a few commands that you can use to check and configure network
+permissions:
+
+
+ -
+
$ adb shell dumpsys netpolicy
+
+
+ -
+ Generates a report that includes the current global background network
+ restriction setting, package UIDs currently on a whitelist, and the network
+ permissions of other known packages.
+
+
+ -
+
$ adb shell cmd netpolicy
+
+
+ -
+ Displays a full list of Network Policy Manager (netpolicy) commands.
+
+
+ -
+
$ adb shell cmd netpolicy set restrict-background
+ <boolean>
+
+
+ -
+ Enables or disables Data Saver mode when passing
true or
+ false, respectively.
+
+
+ -
+
$ adb shell cmd netpolicy add restrict-background-whitelist
+ <UID>
+
+
+ -
+ Adds the specified package UID to the whitelist to allow background metered
+ data usage.
+
+
+ -
+
$ adb shell cmd netpolicy remove restrict-background-whitelist
+ <UID>
+
+
+ -
+ Removes the specified package UID from the whitelist to block background
+ metered data usage while Data Saver is enabled.
+
+
\ No newline at end of file