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

Commit 93eaecdd authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6221028 from 88669cc9 to rvc-d1-release

Change-Id: Ib3b9868659a60aebd4871c0877a17bc074e0f570
parents 597c217b 88669cc9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -62,4 +62,10 @@ public class NetworkInformationShimImpl implements NetworkInformationShim {
        // Not supported on this API level
        return null;
    }

    @NonNull
    @Override
    public LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull final LinkProperties lp) {
        return new LinkProperties(lp);
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -59,4 +59,10 @@ public class NetworkInformationShimImpl extends
        if (nc == null) return null;
        return nc.getSSID();
    }

    @NonNull
    @Override
    public LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull final LinkProperties lp) {
        return lp.makeSensitiveFieldsParcelingCopy();
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -44,4 +44,10 @@ public interface NetworkInformationShim {
     */
    @Nullable
    String getSSID(@Nullable NetworkCapabilities nc);

    /**
     * @see LinkProperties#makeSensitiveFieldsParcelingCopy()
     */
    @NonNull
    LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull LinkProperties lp);
}
+3 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import java.net.SocketException;
public class InterfaceParams {
    public final String name;
    public final int index;
    public final boolean hasMacAddress;
    public final MacAddress macAddr;
    public final int defaultMtu;

@@ -69,7 +70,8 @@ public class InterfaceParams {
        checkArgument((index > 0), "invalid interface index");
        this.name = name;
        this.index = index;
        this.macAddr = (macAddr != null) ? macAddr : MacAddress.fromBytes(new byte[] {
        this.hasMacAddress = (macAddr != null);
        this.macAddr = hasMacAddress ? macAddr : MacAddress.fromBytes(new byte[] {
                0x02, 0x00, 0x00, 0x00, 0x00, 0x00 });
        this.defaultMtu = (defaultMtu > IPV6_MIN_MTU) ? defaultMtu : IPV6_MIN_MTU;
    }
+15 −9
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ import com.android.internal.util.Preconditions;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
import com.android.internal.util.WakeupMessage;
import com.android.networkstack.apishim.NetworkInformationShim;
import com.android.networkstack.apishim.NetworkInformationShimImpl;
import com.android.networkstack.apishim.ShimUtils;
import com.android.server.NetworkObserverRegistry;
import com.android.server.NetworkStackService.NetworkStackServiceManager;
@@ -112,6 +114,7 @@ public class IpClient extends StateMachine {
    private static final ConcurrentHashMap<String, SharedLog> sSmLogs = new ConcurrentHashMap<>();
    private static final ConcurrentHashMap<String, LocalLog> sPktLogs = new ConcurrentHashMap<>();
    private final NetworkStackIpMemoryStore mIpMemoryStore;
    private final NetworkInformationShim mShim = NetworkInformationShimImpl.newInstance();

    /**
     * Dump all state machine and connectivity packet logs to the specified writer.
@@ -165,11 +168,15 @@ public class IpClient extends StateMachine {
        private static final String PREFIX = "INVOKE ";
        private final IIpClientCallbacks mCallback;
        private final SharedLog mLog;
        @NonNull
        private final NetworkInformationShim mShim;

        @VisibleForTesting
        protected IpClientCallbacksWrapper(IIpClientCallbacks callback, SharedLog log) {
        protected IpClientCallbacksWrapper(IIpClientCallbacks callback, SharedLog log,
                @NonNull NetworkInformationShim shim) {
            mCallback = callback;
            mLog = log;
            mShim = shim;
        }

        private void log(String msg) {
@@ -224,7 +231,7 @@ public class IpClient extends StateMachine {
        public void onProvisioningSuccess(LinkProperties newLp) {
            log("onProvisioningSuccess({" + newLp + "})");
            try {
                mCallback.onProvisioningSuccess(newLp);
                mCallback.onProvisioningSuccess(mShim.makeSensitiveFieldsParcelingCopy(newLp));
            } catch (RemoteException e) {
                log("Failed to call onProvisioningSuccess", e);
            }
@@ -236,7 +243,7 @@ public class IpClient extends StateMachine {
        public void onProvisioningFailure(LinkProperties newLp) {
            log("onProvisioningFailure({" + newLp + "})");
            try {
                mCallback.onProvisioningFailure(newLp);
                mCallback.onProvisioningFailure(mShim.makeSensitiveFieldsParcelingCopy(newLp));
            } catch (RemoteException e) {
                log("Failed to call onProvisioningFailure", e);
            }
@@ -248,7 +255,7 @@ public class IpClient extends StateMachine {
        public void onLinkPropertiesChange(LinkProperties newLp) {
            log("onLinkPropertiesChange({" + newLp + "})");
            try {
                mCallback.onLinkPropertiesChange(newLp);
                mCallback.onLinkPropertiesChange(mShim.makeSensitiveFieldsParcelingCopy(newLp));
            } catch (RemoteException e) {
                log("Failed to call onLinkPropertiesChange", e);
            }
@@ -530,7 +537,7 @@ public class IpClient extends StateMachine {
        sPktLogs.putIfAbsent(mInterfaceName, new LocalLog(MAX_PACKET_RECORDS));
        mConnectivityPacketLog = sPktLogs.get(mInterfaceName);
        mMsgStateLogger = new MessageHandlingLogger();
        mCallback = new IpClientCallbacksWrapper(callback, mLog);
        mCallback = new IpClientCallbacksWrapper(callback, mLog, mShim);

        // TODO: Consider creating, constructing, and passing in some kind of
        // InterfaceController.Dependencies class.
@@ -1302,7 +1309,7 @@ public class IpClient extends StateMachine {
    private void doImmediateProvisioningFailure(int failureType) {
        logError("onProvisioningFailure(): %s", failureType);
        recordMetric(failureType);
        mCallback.onProvisioningFailure(new LinkProperties(mLinkProperties));
        mCallback.onProvisioningFailure(mLinkProperties);
    }

    private boolean startIPv4() {
@@ -1423,7 +1430,7 @@ public class IpClient extends StateMachine {
            if (mStartTimeMillis > 0) {
                // Completed a life-cycle; send a final empty LinkProperties
                // (cleared in resetLinkProperties() above) and record an event.
                mCallback.onLinkPropertiesChange(new LinkProperties(mLinkProperties));
                mCallback.onLinkPropertiesChange(mLinkProperties);
                recordMetric(IpManagerEvent.COMPLETE_LIFECYCLE);
                mStartTimeMillis = 0;
            }
@@ -1898,8 +1905,7 @@ public class IpClient extends StateMachine {
                        mDhcpClient.sendMessage(DhcpClient.EVENT_LINKADDRESS_CONFIGURED);
                    } else {
                        logError("Failed to set IPv4 address.");
                        dispatchCallback(PROV_CHANGE_LOST_PROVISIONING,
                                new LinkProperties(mLinkProperties));
                        dispatchCallback(PROV_CHANGE_LOST_PROVISIONING, mLinkProperties);
                        transitionTo(mStoppingState);
                    }
                    break;
Loading