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

Commit 840f86b7 authored by David Su's avatar David Su Committed by Android (Google) Code Review
Browse files

Merge "Scan Optimization: expose API to update device mobility state"

parents f51deea7 796b2dba
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -3713,6 +3713,7 @@ package android.net.wifi {
    method public boolean isWifiScannerSupported();
    method public boolean isWifiScannerSupported();
    method public void registerNetworkRequestMatchCallback(android.net.wifi.WifiManager.NetworkRequestMatchCallback, android.os.Handler);
    method public void registerNetworkRequestMatchCallback(android.net.wifi.WifiManager.NetworkRequestMatchCallback, android.os.Handler);
    method public void save(android.net.wifi.WifiConfiguration, android.net.wifi.WifiManager.ActionListener);
    method public void save(android.net.wifi.WifiConfiguration, android.net.wifi.WifiManager.ActionListener);
    method public void setDeviceMobilityState(int);
    method public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
    method public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
    method public boolean startScan(android.os.WorkSource);
    method public boolean startScan(android.os.WorkSource);
    method public void unregisterNetworkRequestMatchCallback(android.net.wifi.WifiManager.NetworkRequestMatchCallback);
    method public void unregisterNetworkRequestMatchCallback(android.net.wifi.WifiManager.NetworkRequestMatchCallback);
@@ -3720,6 +3721,10 @@ package android.net.wifi {
    field public static final int CHANGE_REASON_CONFIG_CHANGE = 2; // 0x2
    field public static final int CHANGE_REASON_CONFIG_CHANGE = 2; // 0x2
    field public static final int CHANGE_REASON_REMOVED = 1; // 0x1
    field public static final int CHANGE_REASON_REMOVED = 1; // 0x1
    field public static final java.lang.String CONFIGURED_NETWORKS_CHANGED_ACTION = "android.net.wifi.CONFIGURED_NETWORKS_CHANGE";
    field public static final java.lang.String CONFIGURED_NETWORKS_CHANGED_ACTION = "android.net.wifi.CONFIGURED_NETWORKS_CHANGE";
    field public static final int DEVICE_MOBILITY_STATE_HIGH_MVMT = 1; // 0x1
    field public static final int DEVICE_MOBILITY_STATE_LOW_MVMT = 2; // 0x2
    field public static final int DEVICE_MOBILITY_STATE_STATIONARY = 3; // 0x3
    field public static final int DEVICE_MOBILITY_STATE_UNKNOWN = 0; // 0x0
    field public static final java.lang.String EXTRA_CHANGE_REASON = "changeReason";
    field public static final java.lang.String EXTRA_CHANGE_REASON = "changeReason";
    field public static final java.lang.String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
    field public static final java.lang.String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
    field public static final java.lang.String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
    field public static final java.lang.String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
+6 −0
Original line number Original line Diff line number Diff line
@@ -1642,6 +1642,12 @@
    <permission android:name="android.permission.NETWORK_BYPASS_PRIVATE_DNS"
    <permission android:name="android.permission.NETWORK_BYPASS_PRIVATE_DNS"
        android:protectionLevel="signature" />
        android:protectionLevel="signature" />


    <!-- #SystemApi @hide Allows device mobility state to be set so that Wifi scan interval can be increased
         when the device is stationary in order to save power.
         <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.WIFI_SET_DEVICE_MOBILITY_STATE"
        android:protectionLevel="signature|privileged" />

    <!-- ======================================= -->
    <!-- ======================================= -->
    <!-- Permissions for short range, peripheral networks -->
    <!-- Permissions for short range, peripheral networks -->
    <!-- ======================================= -->
    <!-- ======================================= -->
+2 −0
Original line number Original line Diff line number Diff line
@@ -197,5 +197,7 @@ interface IWifiManager
    int removeNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName);
    int removeNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName);


    String[] getFactoryMacAddresses();
    String[] getFactoryMacAddresses();

    void setDeviceMobilityState(int state);
}
}
+65 −0
Original line number Original line Diff line number Diff line
@@ -4476,4 +4476,69 @@ public class WifiManager {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
    }
    }

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"DEVICE_MOBILITY_STATE_"}, value = {
            DEVICE_MOBILITY_STATE_UNKNOWN,
            DEVICE_MOBILITY_STATE_HIGH_MVMT,
            DEVICE_MOBILITY_STATE_LOW_MVMT,
            DEVICE_MOBILITY_STATE_STATIONARY})
    public @interface DeviceMobilityState {}

    /**
     * Unknown device mobility state
     *
     * @see #setDeviceMobilityState(int)
     *
     * @hide
     */
    @SystemApi
    public static final int DEVICE_MOBILITY_STATE_UNKNOWN = 0;

    /**
     * High movement device mobility state
     *
     * @see #setDeviceMobilityState(int)
     *
     * @hide
     */
    @SystemApi
    public static final int DEVICE_MOBILITY_STATE_HIGH_MVMT = 1;

    /**
     * Low movement device mobility state
     *
     * @see #setDeviceMobilityState(int)
     *
     * @hide
     */
    @SystemApi
    public static final int DEVICE_MOBILITY_STATE_LOW_MVMT = 2;

    /**
     * Stationary device mobility state
     *
     * @see #setDeviceMobilityState(int)
     *
     * @hide
     */
    @SystemApi
    public static final int DEVICE_MOBILITY_STATE_STATIONARY = 3;

    /**
     * Updates the device mobility state. Wifi uses this information to adjust the interval between
     * Wifi scans in order to balance power consumption with scan accuracy.
     * @param state the updated device mobility state
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.WIFI_SET_DEVICE_MOBILITY_STATE)
    public void setDeviceMobilityState(@DeviceMobilityState int state) {
        try {
            mService.setDeviceMobilityState(state);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}
}