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