Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d7af4b7 authored by Zach Johnson's avatar Zach Johnson Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE Allow a custom component to handle network policy notifications" into cw-e-dev

parents f306cef4 143ebdb9
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -48,6 +48,9 @@ interface INetworkPolicyManager {
    /** Snooze limit on policy matching given template. */
    /** Snooze limit on policy matching given template. */
    void snoozeLimit(in NetworkTemplate template);
    void snoozeLimit(in NetworkTemplate template);


    /** Snooze warning on policy matching given template. */
    void snoozeWarning(in NetworkTemplate template);

    /** Control if background data is restricted system-wide. */
    /** Control if background data is restricted system-wide. */
    void setRestrictBackground(boolean restrictBackground);
    void setRestrictBackground(boolean restrictBackground);
    boolean getRestrictBackground();
    boolean getRestrictBackground();
+49 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.content.pm.PackageManager.GET_SIGNATURES;
import static android.net.NetworkPolicy.CYCLE_NONE;
import static android.net.NetworkPolicy.CYCLE_NONE;
import static android.text.format.Time.MONTH_DAY;
import static android.text.format.Time.MONTH_DAY;


import android.annotation.SystemApi;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
@@ -80,6 +81,54 @@ public class NetworkPolicyManager {
     */
     */
    public static final String EXTRA_NETWORK_TEMPLATE = "android.net.NETWORK_TEMPLATE";
    public static final String EXTRA_NETWORK_TEMPLATE = "android.net.NETWORK_TEMPLATE";


    /**
     * Broadcast intent action for informing a custom component about a network policy
     * notification.
     * @hide
     */
    @SystemApi
    public static final String ACTION_SHOW_NETWORK_POLICY_NOTIFICATION =
            "android.net.action.SHOW_NETWORK_POLICY_NOTIFICATION";

    /**
     * The sequence number associated with the notification - a higher number
     * indicates previous notifications may be disregarded.
     * @hide
     */
    @SystemApi
    public static final String EXTRA_NOTIFICATION_SEQUENCE_NUMBER =
            "android.net.extra.NOTIFICATION_SEQUENCE_NUMBER";

    /**
     * The type of notification that should be presented to the user.
     * @hide
     */
    @SystemApi
    public static final String EXTRA_NOTIFICATION_TYPE = "android.net.extra.NOTIFICATION_TYPE";

    @SystemApi
    public static final int NOTIFICATION_TYPE_NONE = 0;
    @SystemApi
    public static final int NOTIFICATION_TYPE_USAGE_WARNING = 1;
    @SystemApi
    public static final int NOTIFICATION_TYPE_USAGE_REACHED_LIMIT = 2;
    @SystemApi
    public static final int NOTIFICATION_TYPE_USAGE_EXCEEDED_LIMIT = 3;

    /**
     * The number of bytes used on the network in the notification.
     * @hide
     */
    @SystemApi
    public static final String EXTRA_BYTES_USED = "android.net.extra.BYTES_USED";

    /**
     * The network policy for the network in the notification.
     * @hide
     */
    @SystemApi
    public static final String EXTRA_NETWORK_POLICY = "android.net.extra.NETWORK_POLICY";

    private final Context mContext;
    private final Context mContext;
    private INetworkPolicyManager mService;
    private INetworkPolicyManager mService;


+2 −0
Original line number Original line Diff line number Diff line
@@ -320,6 +320,8 @@
    <protected-broadcast android:name="android.internal.policy.action.BURN_IN_PROTECTION" />
    <protected-broadcast android:name="android.internal.policy.action.BURN_IN_PROTECTION" />
    <protected-broadcast android:name="android.app.action.SYSTEM_UPDATE_POLICY_CHANGED" />
    <protected-broadcast android:name="android.app.action.SYSTEM_UPDATE_POLICY_CHANGED" />
    <protected-broadcast android:name="android.app.action.DEVICE_OWNER_CHANGED" />
    <protected-broadcast android:name="android.app.action.DEVICE_OWNER_CHANGED" />

    <protected-broadcast android:name="android.net.action.SHOW_NETWORK_POLICY_NOTIFICATION" />
    <!-- ====================================================================== -->
    <!-- ====================================================================== -->
    <!--                          RUNTIME PERMISSIONS                           -->
    <!--                          RUNTIME PERMISSIONS                           -->
    <!-- ====================================================================== -->
    <!-- ====================================================================== -->
+4 −0
Original line number Original line Diff line number Diff line
@@ -2275,4 +2275,8 @@
    <!-- The OEM specified sensor string type for the gesture to launch camera app, this value
    <!-- The OEM specified sensor string type for the gesture to launch camera app, this value
         must match the value of config_cameraLaunchGestureSensorType in OEM's HAL -->
         must match the value of config_cameraLaunchGestureSensorType in OEM's HAL -->
    <string translatable="false" name="config_cameraLaunchGestureSensorStringType"></string>
    <string translatable="false" name="config_cameraLaunchGestureSensorStringType"></string>

    <!-- Name of the component to handle network policy notifications. If present,
         disables NetworkPolicyManagerService's presentation of data-usage notifications. -->
    <string translatable="false" name="config_networkPolicyNotificationComponent"></string>
</resources>
</resources>
+2 −0
Original line number Original line Diff line number Diff line
@@ -2321,4 +2321,6 @@
  <!-- Gesture -->
  <!-- Gesture -->
  <java-symbol type="integer" name="config_cameraLaunchGestureSensorType" />
  <java-symbol type="integer" name="config_cameraLaunchGestureSensorType" />
  <java-symbol type="string" name="config_cameraLaunchGestureSensorStringType" />
  <java-symbol type="string" name="config_cameraLaunchGestureSensorStringType" />

  <java-symbol type="string" name="config_networkPolicyNotificationComponent" />
</resources>
</resources>
Loading