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

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

Merge "Add INetd to SystemServiceRegistry"

parents 9188b492 31935985
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -839,6 +839,7 @@ package android.content {
    field public static final String CONTEXTHUB_SERVICE = "contexthub";
    field public static final String EUICC_CARD_SERVICE = "euicc_card";
    field public static final String HDMI_CONTROL_SERVICE = "hdmi_control";
    field public static final String NETD_SERVICE = "netd";
    field public static final String NETWORK_SCORE_SERVICE = "network_score";
    field public static final String OEM_LOCK_SERVICE = "oem_lock";
    field public static final String PERSISTENT_DATA_BLOCK_SERVICE = "persistent_data_block";
+9 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ import android.net.IConnectivityManager;
import android.net.IEthernetManager;
import android.net.IIpMemoryStore;
import android.net.IIpSecService;
import android.net.INetd;
import android.net.INetworkPolicyManager;
import android.net.IpMemoryStore;
import android.net.IpSecManager;
@@ -288,6 +289,14 @@ final class SystemServiceRegistry {
                return new ConnectivityManager(context, service);
            }});

        registerService(Context.NETD_SERVICE, INetd.class, new StaticServiceFetcher<INetd>() {
            @Override
            public INetd createService() throws ServiceNotFoundException {
                return INetd.Stub.asInterface(
                        ServiceManager.getServiceOrThrow(Context.NETD_SERVICE));
            }
        });

        registerService(Context.NETWORK_STACK_SERVICE, NetworkStack.class,
                new StaticServiceFetcher<NetworkStack>() {
                    @Override
+10 −0
Original line number Diff line number Diff line
@@ -3504,6 +3504,16 @@ public abstract class Context {
     */
    public static final String CONNECTIVITY_SERVICE = "connectivity";

    /**
     * Use with {@link #getSystemService(String)} to retrieve a
     * {@link android.net.INetd} for communicating with the network stack
     * @hide
     * @see #getSystemService(String)
     * @hide
     */
    @SystemApi
    public static final String NETD_SERVICE = "netd";

    /**
     * Use with {@link #getSystemService(String)} to retrieve a
     * {@link NetworkStack} for communicating with the network stack
+2 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.net.shared;

import android.content.Context;
import android.net.INetd;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -28,7 +29,6 @@ import android.util.Log;
 */
public class NetdService {
    private static final String TAG = NetdService.class.getSimpleName();
    private static final String NETD_SERVICE_NAME = "netd";
    private static final long BASE_TIMEOUT_MS = 100;
    private static final long MAX_TIMEOUT_MS = 1000;

@@ -48,7 +48,7 @@ public class NetdService {
        // NOTE: ServiceManager does no caching for the netd service,
        // because netd is not one of the defined common services.
        final INetd netdInstance = INetd.Stub.asInterface(
                ServiceManager.getService(NETD_SERVICE_NAME));
                ServiceManager.getService(Context.NETD_SERVICE));
        if (netdInstance == null) {
            Log.w(TAG, "WARNING: returning null INetd instance.");
        }