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

Commit db3c8678 authored by Haoyu Bai's avatar Haoyu Bai
Browse files

Network data activity change intent for network interfaces.

The activity notification is received from netd, an intent
DATA_ACTIVITY_CHANGE is then raised for other part of the system to
consume.

Change-Id: Idfcc4763c51c5b314c57f546c12557082f06bebf
parent 6b7358d9
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -136,6 +136,28 @@ public class ConnectivityManager {
     */
    public static final String EXTRA_INET_CONDITION = "inetCondition";

    /**
     * Broadcast action to indicate the change of data activity status
     * (idle or active) on a network in a recent period.
     * The network becomes active when data transimission is started, or
     * idle if there is no data transimition for a period of time.
     * {@hide}
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_DATA_ACTIVITY_CHANGE = "android.net.conn.DATA_ACTIVITY_CHANGE";
    /**
     * The lookup key for an enum that indicates the network device type on which this data activity
     * change happens.
     * {@hide}
     */
    public static final String EXTRA_DEVICE_TYPE = "deviceType";
    /**
     * The lookup key for a boolean that indicates the device is active or not. {@code true} means
     * it is actively sending or receiving data and {@code false} means it is idle.
     * {@hide}
     */
    public static final String EXTRA_IS_ACTIVE = "isActive";

    /**
     * Broadcast Action: The setting for background data usage has changed
     * values. Use {@link #getBackgroundDataSetting()} to get the current value.
+4 −0
Original line number Diff line number Diff line
@@ -99,6 +99,10 @@ public class EthernetDataTracker implements NetworkStateTracker {
        public void limitReached(String limitName, String iface) {
            // Ignored.
        }

        public void interfaceClassDataActivityChanged(String label, boolean active) {
            // Ignored.
        }
    }

    private EthernetDataTracker() {
+7 −0
Original line number Diff line number Diff line
@@ -62,4 +62,11 @@ interface INetworkManagementEventObserver {
     */
    void limitReached(String limitName, String iface);

    /**
     * Interface data activity status is changed.
     *
     * @param iface The interface.
     * @param active  True if the interface is actively transmitting data, false if it is idle.
     */
    void interfaceClassDataActivityChanged(String label, boolean active);
}
+6 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@

    <protected-broadcast android:name="android.net.conn.CONNECTIVITY_CHANGE" />
    <protected-broadcast android:name="android.net.conn.CONNECTIVITY_CHANGE_IMMEDIATE" />
    <protected-broadcast android:name="android.net.conn.DATA_ACTIVITY_CHANGE" />

    <protected-broadcast android:name="android.nfc.action.LLCP_LINK_STATE_CHANGED" />
    <protected-broadcast android:name="com.android.nfc_extras.action.RF_FIELD_ON_DETECTED" />
@@ -508,6 +509,11 @@
        android:permissionGroup="android.permission-group.NETWORK"
        android:protectionLevel="signature|system" />

    <!-- @hide -->
    <permission android:name="android.permission.RECEIVE_DATA_ACTIVITY_CHANGE"
        android:permissionGroup="android.permission-group.NETWORK"
        android:protectionLevel="signature|system" />

    <!-- ================================== -->
    <!-- Permissions for accessing accounts -->
    <!-- ================================== -->
+2 −0
Original line number Diff line number Diff line
@@ -120,6 +120,8 @@ class CommonTimeManagementService extends Binder {
            reevaluateServiceState();
        }
        public void limitReached(String limitName, String iface) { }

        public void interfaceClassDataActivityChanged(String label, boolean active) {}
    };

    private BroadcastReceiver mConnectivityMangerObserver = new BroadcastReceiver() {
Loading