Merge "Add INetd to SystemServiceRegistry"
am: e3f18bd77c
Change-Id: I510c964ead030f3522c26c123e709117c7c14f6a
This commit is contained in:
@@ -839,6 +839,7 @@ package android.content {
|
|||||||
field public static final String CONTEXTHUB_SERVICE = "contexthub";
|
field public static final String CONTEXTHUB_SERVICE = "contexthub";
|
||||||
field public static final String EUICC_CARD_SERVICE = "euicc_card";
|
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 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 NETWORK_SCORE_SERVICE = "network_score";
|
||||||
field public static final String OEM_LOCK_SERVICE = "oem_lock";
|
field public static final String OEM_LOCK_SERVICE = "oem_lock";
|
||||||
field public static final String PERSISTENT_DATA_BLOCK_SERVICE = "persistent_data_block";
|
field public static final String PERSISTENT_DATA_BLOCK_SERVICE = "persistent_data_block";
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ import android.net.IConnectivityManager;
|
|||||||
import android.net.IEthernetManager;
|
import android.net.IEthernetManager;
|
||||||
import android.net.IIpMemoryStore;
|
import android.net.IIpMemoryStore;
|
||||||
import android.net.IIpSecService;
|
import android.net.IIpSecService;
|
||||||
|
import android.net.INetd;
|
||||||
import android.net.INetworkPolicyManager;
|
import android.net.INetworkPolicyManager;
|
||||||
import android.net.IpMemoryStore;
|
import android.net.IpMemoryStore;
|
||||||
import android.net.IpSecManager;
|
import android.net.IpSecManager;
|
||||||
@@ -288,6 +289,14 @@ final class SystemServiceRegistry {
|
|||||||
return new ConnectivityManager(context, service);
|
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,
|
registerService(Context.NETWORK_STACK_SERVICE, NetworkStack.class,
|
||||||
new StaticServiceFetcher<NetworkStack>() {
|
new StaticServiceFetcher<NetworkStack>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3504,6 +3504,16 @@ public abstract class Context {
|
|||||||
*/
|
*/
|
||||||
public static final String CONNECTIVITY_SERVICE = "connectivity";
|
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
|
* Use with {@link #getSystemService(String)} to retrieve a
|
||||||
* {@link NetworkStack} for communicating with the network stack
|
* {@link NetworkStack} for communicating with the network stack
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.net.shared;
|
package android.net.shared;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.net.INetd;
|
import android.net.INetd;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
@@ -28,7 +29,6 @@ import android.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class NetdService {
|
public class NetdService {
|
||||||
private static final String TAG = NetdService.class.getSimpleName();
|
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 BASE_TIMEOUT_MS = 100;
|
||||||
private static final long MAX_TIMEOUT_MS = 1000;
|
private static final long MAX_TIMEOUT_MS = 1000;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public class NetdService {
|
|||||||
// NOTE: ServiceManager does no caching for the netd service,
|
// NOTE: ServiceManager does no caching for the netd service,
|
||||||
// because netd is not one of the defined common services.
|
// because netd is not one of the defined common services.
|
||||||
final INetd netdInstance = INetd.Stub.asInterface(
|
final INetd netdInstance = INetd.Stub.asInterface(
|
||||||
ServiceManager.getService(NETD_SERVICE_NAME));
|
ServiceManager.getService(Context.NETD_SERVICE));
|
||||||
if (netdInstance == null) {
|
if (netdInstance == null) {
|
||||||
Log.w(TAG, "WARNING: returning null INetd instance.");
|
Log.w(TAG, "WARNING: returning null INetd instance.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user