Created a ACTION_RESTRICT_BACKGROUND_CHANGED intent.

This intent will be broadcasted when:

- Global restrict background setting is changed (sent to all packages)
- An individual uid is added to or removed from the whitelist (sent just
  to the packages belonging to that uid).

This intent is only sent to registered receivers.

BUG: 26451391
Change-Id: Ic0a5771f88baa52076ad04764f29098a386463cc
This commit is contained in:
Felipe Leme
2016-01-27 14:46:39 -08:00
parent 35759f9151
commit d34c9af3e2

View File

@@ -3215,11 +3215,24 @@ public class ConnectivityManager {
/** /**
* Device is restricting metered network activity while application is running on background. * Device is restricting metered network activity while application is running on background.
* <p>
* In this state, application should not try to use the network while running on background, * In this state, application should not try to use the network while running on background,
* because it would be denied. * because it would be denied.
*/ */
public static final int RESTRICT_BACKGROUND_STATUS_ENABLED = 3; public static final int RESTRICT_BACKGROUND_STATUS_ENABLED = 3;
/**
* A change in the background metered network activity restriction has occurred.
* <p>
* Applications should call {@link #getRestrictBackgroundStatus()} to check if the restriction
* applies to them.
* <p>
* This is only sent to registered receivers, not manifest receivers.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_RESTRICT_BACKGROUND_CHANGED =
"android.net.conn.RESTRICT_BACKGROUND_CHANGED";
/** @hide */ /** @hide */
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef(flag = false, value = { @IntDef(flag = false, value = {