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

Commit 14f2ef4c authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Move the net transition wakelock to ConnService.

When the default network goes down we lose the wake-on-incoming-data capability
until the new net is brought up and apps rebuild their connections.  We fixed this
in Wifi, but it's a general connectivity issue, not a wifi issue so moving the
mechanism to connecitivty so other networks can use it.

bug:2734419
Change-Id: I39b5d825eb6b548bd9bb8f179b89254f4db53147
parent ce718947
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -525,4 +525,19 @@ public class ConnectivityManager
            return TETHER_ERROR_SERVICE_UNAVAIL;
        }
    }

    /**
     * Ensure the device stays awake until we connect with the next network
     * @param forWhome The name of the network going down for logging purposes
     * @return {@code true} on success, {@code false} on failure
     * {@hide}
     */
    public boolean requestNetworkTransitionWakelock(String forWhom) {
        try {
            mService.requestNetworkTransitionWakelock(forWhom);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -72,4 +72,6 @@ interface IConnectivityManager
    String[] getTetherableUsbRegexs();

    String[] getTetherableWifiRegexs();

    void requestNetworkTransitionWakelock(in String forWhom);
}
+1 −6
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public interface NetworkStateTracker {
    public static final int EVENT_ROAMING_CHANGED = 5;
    public static final int EVENT_NETWORK_SUBTYPE_CHANGED = 6;
    public static final int EVENT_RESTORE_DEFAULT_NETWORK = 7;
    public static final int EVENT_CLEAR_NET_TRANSITION_WAKELOCK = 8;

    /**
     * Fetch NetworkInfo for the network
@@ -95,12 +96,6 @@ public interface NetworkStateTracker {
     */
    public boolean isTeardownRequested();

    /**
     * Release the wakelock, if any, that may be held while handling a
     * disconnect operation.
     */
    public void releaseWakeLock();

    public void startMonitoring();

    /**
+7 −0
Original line number Diff line number Diff line
@@ -344,6 +344,13 @@
        android:description="@string/permdesc_accountManagerService"
        android:label="@string/permlab_accountManagerService" />

    <!-- Allows an internal user to use privaledged ConnectivityManager
    APIs.
        @hide -->
    <permission android:name="android.permission.CONNECTIVITY_INTERNAL"
        android:permissionGroup="android.permission-group.NETWORK"
        android:protectionLevel="signatureOrSystem" />

    <!-- ================================== -->
    <!-- Permissions for accessing accounts -->
    <!-- ================================== -->
+3 −0
Original line number Diff line number Diff line
@@ -98,6 +98,9 @@
        <item>"0,1"</item>
    </string-array>

    <!-- The maximum duration (in milliseconds) we expect a network transition to take -->
    <integer name="config_networkTransitionTimeout">60000</integer>

    <!-- List of regexpressions describing the interface (if any) that represent tetherable
         USB interfaces.  If the device doesn't want to support tething over USB this should
         be empty.  An example would be "usb.*" -->
Loading