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

Commit e4b4e17f authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Gerrit Code Review
Browse files

Merge "Remove deps from framework on netd interfaces"

parents d5e53b04 235c455c
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.net.shared.ProvisioningConfiguration;
import android.net.util.InterfaceParams;
import android.net.util.SharedLog;
import android.os.ConditionVariable;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemClock;
@@ -380,6 +381,13 @@ public class IpClient extends StateMachine {
        public InterfaceParams getInterfaceParams(String ifname) {
            return InterfaceParams.getByName(ifname);
        }

        /**
         * Get a INetd connector.
         */
        public INetd getNetd(Context context) {
            return INetd.Stub.asInterface((IBinder) context.getSystemService(Context.NETD_SERVICE));
        }
    }

    public IpClient(Context context, String ifName, IIpClientCallbacks callback,
@@ -413,7 +421,7 @@ public class IpClient extends StateMachine {

        // TODO: Consider creating, constructing, and passing in some kind of
        // InterfaceController.Dependencies class.
        mNetd = mContext.getSystemService(INetd.class);
        mNetd = deps.getNetd(mContext);
        mInterfaceCtrl = new InterfaceController(mInterfaceName, mNetd, mLog);

        mLinkObserver = new IpClientLinkObserver(
+2 −1
Original line number Diff line number Diff line
@@ -114,7 +114,8 @@ public class NetworkStackService extends Service {

        NetworkStackConnector(Context context) {
            mContext = context;
            mNetd = (INetd) context.getSystemService(Context.NETD_SERVICE);
            mNetd = INetd.Stub.asInterface(
                    (IBinder) context.getSystemService(Context.NETD_SERVICE));
            mObserverRegistry = new NetworkObserverRegistry();
            mCm = context.getSystemService(ConnectivityManager.class);

+1 −1
Original line number Diff line number Diff line
@@ -104,8 +104,8 @@ public class IpClientTest {

        when(mContext.getSystemService(eq(Context.ALARM_SERVICE))).thenReturn(mAlarm);
        when(mContext.getSystemService(eq(ConnectivityManager.class))).thenReturn(mCm);
        when(mContext.getSystemService(INetd.class)).thenReturn(mNetd);
        when(mContext.getResources()).thenReturn(mResources);
        when(mDependencies.getNetd(any())).thenReturn(mNetd);
        when(mResources.getInteger(R.integer.config_networkAvoidBadWifi))
                .thenReturn(DEFAULT_AVOIDBADWIFI_CONFIG_VALUE);