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

Commit db469ca1 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed service bound before clients register for bounding update

Fixed a race condition that the service was bound before data
network controller registers for binding change update.

Bug: 227742436
Test: Manual
Merged-In: I62809f3aab6992fa76c9c87dde313d34f9744924
Change-Id: I62809f3aab6992fa76c9c87dde313d34f9744924
parent c3717844
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2523,9 +2523,12 @@ public class DataNetworkController extends Handler {
     * Called when data service binding changed.
     *
     * @param transport The transport of the changed data service.
     * @param bound {code @true} if data service is bound.
     * @param bound {@code true} if data service is bound.
     */
    private void onDataServiceBindingChanged(@TransportType int transport, boolean bound) {
        log("onDataServiceBindingChanged: " + AccessNetworkConstants
                .transportTypeToString(transport) + " data service is "
                + (bound ? "bound." : "unbound."));
        if (!bound) {
            if (transport == AccessNetworkConstants.TRANSPORT_TYPE_WLAN) {
                if (!mDataConfigManager.shouldPersistIwlanDataNetworksWhenDataServiceRestarted()) {
+7 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -962,9 +963,13 @@ public class DataServiceManager extends Handler {
     */
    public void registerForServiceBindingChanged(Handler h, int what) {
        if (h != null) {
            mServiceBindingChangedRegistrants.addUnique(h, what, mTransportType);
            mServiceBindingChangedRegistrants.remove(h);
            Registrant r = new Registrant(h, what, mTransportType);
            mServiceBindingChangedRegistrants.add(r);
            if (mBound) {
                r.notifyResult(true);
            }
        }

    }

    /**