Methods Summary |
---|
public void | addIdleTimer(java.lang.String iface, int timeout, int type)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
if (DBG) Slog.d(TAG, "Adding idletimer");
synchronized (mIdleTimerLock) {
IdleTimerParams params = mActiveIdleTimers.get(iface);
if (params != null) {
// the interface already has idletimer, update network count
params.networkCount++;
return;
}
try {
mConnector.execute("idletimer", "add", iface, Integer.toString(timeout),
Integer.toString(type));
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
mActiveIdleTimers.put(iface, new IdleTimerParams(timeout, type));
// Networks start up.
if (ConnectivityManager.isNetworkTypeMobile(type)) {
mNetworkActive = false;
}
mDaemonHandler.post(new Runnable() {
@Override public void run() {
notifyInterfaceClassActivity(type,
DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH,
SystemClock.elapsedRealtimeNanos(), false);
}
});
}
|
public void | addInterfaceToLocalNetwork(java.lang.String iface, java.util.List routes)
modifyInterfaceInNetwork("add", "local", iface);
for (RouteInfo route : routes) {
if (!route.isDefaultRoute()) {
modifyRoute("add", "local", route);
}
}
|
public void | addInterfaceToNetwork(java.lang.String iface, int netId)
modifyInterfaceInNetwork("add", "" + netId, iface);
|
public void | addLegacyRouteForNetId(int netId, android.net.RouteInfo routeInfo, int uid)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final Command cmd = new Command("network", "route", "legacy", uid, "add", netId);
// create triplet: interface dest-ip-addr/prefixlength gateway-ip-addr
final LinkAddress la = routeInfo.getDestinationLinkAddress();
cmd.appendArg(routeInfo.getInterface());
cmd.appendArg(la.getAddress().getHostAddress() + "/" + la.getPrefixLength());
if (routeInfo.hasGateway()) {
cmd.appendArg(routeInfo.getGateway().getHostAddress());
}
try {
mConnector.execute(cmd);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | addRoute(int netId, android.net.RouteInfo route)
modifyRoute("add", "" + netId, route);
|
public void | addVpnUidRanges(int netId, android.net.UidRange[] ranges)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
Object[] argv = new Object[3 + MAX_UID_RANGES_PER_COMMAND];
argv[0] = "users";
argv[1] = "add";
argv[2] = netId;
int argc = 3;
// Avoid overly long commands by limiting number of UID ranges per command.
for (int i = 0; i < ranges.length; i++) {
argv[argc++] = ranges[i].toString();
if (i == (ranges.length - 1) || argc == argv.length) {
try {
mConnector.execute("network", Arrays.copyOf(argv, argc));
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
argc = 3;
}
}
|
public void | allowProtect(int uid)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("network", "protect", "allow", uid);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | attachPppd(java.lang.String tty, java.lang.String localAddr, java.lang.String remoteAddr, java.lang.String dns1Addr, java.lang.String dns2Addr)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("pppd", "attach", tty,
NetworkUtils.numericToInetAddress(localAddr).getHostAddress(),
NetworkUtils.numericToInetAddress(remoteAddr).getHostAddress(),
NetworkUtils.numericToInetAddress(dns1Addr).getHostAddress(),
NetworkUtils.numericToInetAddress(dns2Addr).getHostAddress());
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | clearDefaultNetId()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("network", "default", "clear");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | clearInterfaceAddresses(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("interface", "clearaddrs", iface);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | clearPermission(int[] uids)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
Object[] argv = new Object[3 + MAX_UID_RANGES_PER_COMMAND];
argv[0] = "permission";
argv[1] = "user";
argv[2] = "clear";
int argc = 3;
// Avoid overly long commands by limiting number of UIDs per command.
for (int i = 0; i < uids.length; ++i) {
argv[argc++] = uids[i];
if (i == uids.length - 1 || argc == argv.length) {
try {
mConnector.execute("network", Arrays.copyOf(argv, argc));
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
argc = 3;
}
}
|
static com.android.server.NetworkManagementService | create(android.content.Context context, java.lang.String socket)
final NetworkManagementService service = new NetworkManagementService(context, socket);
final CountDownLatch connectedSignal = service.mConnectedSignal;
if (DBG) Slog.d(TAG, "Creating NetworkManagementService");
service.mThread.start();
if (DBG) Slog.d(TAG, "Awaiting socket connection");
connectedSignal.await();
if (DBG) Slog.d(TAG, "Connected");
return service;
|
public static com.android.server.NetworkManagementService | create(android.content.Context context)
return create(context, NETD_SOCKET_NAME);
|
public void | createPhysicalNetwork(int netId)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("network", "create", netId);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | createVirtualNetwork(int netId, boolean hasDNS, boolean secure)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("network", "create", netId, "vpn", hasDNS ? "1" : "0",
secure ? "1" : "0");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | denyProtect(int uid)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("network", "protect", "deny", uid);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | detachPppd(java.lang.String tty)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("pppd", "detach", tty);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | disableIpv6(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("interface", "ipv6", iface, "disable");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | disableNat(java.lang.String internalInterface, java.lang.String externalInterface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
modifyNat("disable", internalInterface, externalInterface);
} catch (SocketException e) {
throw new IllegalStateException(e);
}
|
protected void | dump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)
mContext.enforceCallingOrSelfPermission(DUMP, TAG);
pw.println("NetworkManagementService NativeDaemonConnector Log:");
mConnector.dump(fd, pw, args);
pw.println();
pw.print("Bandwidth control enabled: "); pw.println(mBandwidthControlEnabled);
pw.print("mMobileActivityFromRadio="); pw.print(mMobileActivityFromRadio);
pw.print(" mLastPowerStateFromRadio="); pw.println(mLastPowerStateFromRadio);
pw.print("mNetworkActive="); pw.println(mNetworkActive);
synchronized (mQuotaLock) {
pw.print("Active quota ifaces: "); pw.println(mActiveQuotas.toString());
pw.print("Active alert ifaces: "); pw.println(mActiveAlerts.toString());
}
synchronized (mUidRejectOnQuota) {
pw.print("UID reject on quota ifaces: [");
final int size = mUidRejectOnQuota.size();
for (int i = 0; i < size; i++) {
pw.print(mUidRejectOnQuota.keyAt(i));
if (i < size - 1) pw.print(",");
}
pw.println("]");
}
synchronized (mIdleTimerLock) {
pw.println("Idle timers:");
for (HashMap.Entry<String, IdleTimerParams> ent : mActiveIdleTimers.entrySet()) {
pw.print(" "); pw.print(ent.getKey()); pw.println(":");
IdleTimerParams params = ent.getValue();
pw.print(" timeout="); pw.print(params.timeout);
pw.print(" type="); pw.print(params.type);
pw.print(" networkCount="); pw.println(params.networkCount);
}
}
pw.print("Firewall enabled: "); pw.println(mFirewallEnabled);
|
public void | enableIpv6(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("interface", "ipv6", iface, "enable");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | enableNat(java.lang.String internalInterface, java.lang.String externalInterface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
modifyNat("enable", internalInterface, externalInterface);
} catch (SocketException e) {
throw new IllegalStateException(e);
}
|
private static void | enforceSystemUid()
final int uid = Binder.getCallingUid();
if (uid != Process.SYSTEM_UID) {
throw new SecurityException("Only available to AID_SYSTEM");
}
|
private java.util.List | excludeLinkLocal(java.util.List addresses)
ArrayList<InterfaceAddress> filtered = new ArrayList<InterfaceAddress>(addresses.size());
for (InterfaceAddress ia : addresses) {
if (!ia.getAddress().isLinkLocalAddress())
filtered.add(ia);
}
return filtered;
|
public void | flushNetworkDnsCache(int netId)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("resolver", "flushnet", netId);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
private com.android.internal.app.IBatteryStats | getBatteryStats()
synchronized (this) {
if (mBatteryStats != null) {
return mBatteryStats;
}
mBatteryStats = IBatteryStats.Stub.asInterface(ServiceManager.getService(
BatteryStats.SERVICE_NAME));
return mBatteryStats;
}
|
public java.lang.String[] | getDnsForwarders()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
return NativeDaemonEvent.filterMessageList(
mConnector.executeForList("tether", "dns", "list"), TetherDnsFwdTgtListResult);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public android.net.InterfaceConfiguration | getInterfaceConfig(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final NativeDaemonEvent event;
try {
event = mConnector.execute("interface", "getcfg", iface);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
event.checkCode(InterfaceGetCfgResult);
// Rsp: 213 xx:xx:xx:xx:xx:xx yyy.yyy.yyy.yyy zzz flag1 flag2 flag3
final StringTokenizer st = new StringTokenizer(event.getMessage());
InterfaceConfiguration cfg;
try {
cfg = new InterfaceConfiguration();
cfg.setHardwareAddress(st.nextToken(" "));
InetAddress addr = null;
int prefixLength = 0;
try {
addr = NetworkUtils.numericToInetAddress(st.nextToken());
} catch (IllegalArgumentException iae) {
Slog.e(TAG, "Failed to parse ipaddr", iae);
}
try {
prefixLength = Integer.parseInt(st.nextToken());
} catch (NumberFormatException nfe) {
Slog.e(TAG, "Failed to parse prefixLength", nfe);
}
cfg.setLinkAddress(new LinkAddress(addr, prefixLength));
while (st.hasMoreTokens()) {
cfg.setFlag(st.nextToken());
}
} catch (NoSuchElementException nsee) {
throw new IllegalStateException("Invalid response from daemon: " + event);
}
return cfg;
|
public boolean | getIpForwardingEnabled()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final NativeDaemonEvent event;
try {
event = mConnector.execute("ipfwd", "status");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
// 211 Forwarding enabled
event.checkCode(IpFwdStatusResult);
return event.getMessage().endsWith("enabled");
|
public android.net.NetworkStats | getNetworkStatsDetail()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
return mStatsFactory.readNetworkStatsDetail(UID_ALL, null, TAG_ALL, null);
} catch (IOException e) {
throw new IllegalStateException(e);
}
|
public android.net.NetworkStats | getNetworkStatsSummaryDev()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
return mStatsFactory.readNetworkStatsSummaryDev();
} catch (IOException e) {
throw new IllegalStateException(e);
}
|
public android.net.NetworkStats | getNetworkStatsSummaryXt()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
return mStatsFactory.readNetworkStatsSummaryXt();
} catch (IOException e) {
throw new IllegalStateException(e);
}
|
public android.net.NetworkStats | getNetworkStatsTethering()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final NetworkStats stats = new NetworkStats(SystemClock.elapsedRealtime(), 1);
try {
final NativeDaemonEvent[] events = mConnector.executeForList(
"bandwidth", "gettetherstats");
for (NativeDaemonEvent event : events) {
if (event.getCode() != TetheringStatsListResult) continue;
// 114 ifaceIn ifaceOut rx_bytes rx_packets tx_bytes tx_packets
final StringTokenizer tok = new StringTokenizer(event.getMessage());
try {
final String ifaceIn = tok.nextToken();
final String ifaceOut = tok.nextToken();
final NetworkStats.Entry entry = new NetworkStats.Entry();
entry.iface = ifaceOut;
entry.uid = UID_TETHERING;
entry.set = SET_DEFAULT;
entry.tag = TAG_NONE;
entry.rxBytes = Long.parseLong(tok.nextToken());
entry.rxPackets = Long.parseLong(tok.nextToken());
entry.txBytes = Long.parseLong(tok.nextToken());
entry.txPackets = Long.parseLong(tok.nextToken());
stats.combineValues(entry);
} catch (NoSuchElementException e) {
throw new IllegalStateException("problem parsing tethering stats: " + event);
} catch (NumberFormatException e) {
throw new IllegalStateException("problem parsing tethering stats: " + event);
}
}
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
return stats;
|
public android.net.NetworkStats | getNetworkStatsUidDetail(int uid)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
return mStatsFactory.readNetworkStatsDetail(uid, null, TAG_ALL, null);
} catch (IOException e) {
throw new IllegalStateException(e);
}
|
public android.net.RouteInfo[] | getRoutes(java.lang.String interfaceName)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
ArrayList<RouteInfo> routes = new ArrayList<RouteInfo>();
// v4 routes listed as:
// iface dest-addr gateway-addr flags refcnt use metric netmask mtu window IRTT
for (String s : readRouteList("/proc/net/route")) {
String[] fields = s.split("\t");
if (fields.length > 7) {
String iface = fields[0];
if (interfaceName.equals(iface)) {
String dest = fields[1];
String gate = fields[2];
String flags = fields[3]; // future use?
String mask = fields[7];
try {
// address stored as a hex string, ex: 0014A8C0
InetAddress destAddr =
NetworkUtils.intToInetAddress((int)Long.parseLong(dest, 16));
int prefixLength =
NetworkUtils.netmaskIntToPrefixLength(
(int)Long.parseLong(mask, 16));
LinkAddress linkAddress = new LinkAddress(destAddr, prefixLength);
// address stored as a hex string, ex 0014A8C0
InetAddress gatewayAddr =
NetworkUtils.intToInetAddress((int)Long.parseLong(gate, 16));
RouteInfo route = new RouteInfo(linkAddress, gatewayAddr);
routes.add(route);
} catch (Exception e) {
Log.e(TAG, "Error parsing route " + s + " : " + e);
continue;
}
}
}
}
// v6 routes listed as:
// dest-addr prefixlength ?? ?? gateway-addr ?? ?? ?? ?? iface
for (String s : readRouteList("/proc/net/ipv6_route")) {
String[]fields = s.split("\\s+");
if (fields.length > 9) {
String iface = fields[9].trim();
if (interfaceName.equals(iface)) {
String dest = fields[0];
String prefix = fields[1];
String gate = fields[4];
try {
// prefix length stored as a hex string, ex 40
int prefixLength = Integer.parseInt(prefix, 16);
// address stored as a 32 char hex string
// ex fe800000000000000000000000000000
InetAddress destAddr = NetworkUtils.hexToInet6Address(dest);
LinkAddress linkAddress = new LinkAddress(destAddr, prefixLength);
InetAddress gateAddr = NetworkUtils.hexToInet6Address(gate);
RouteInfo route = new RouteInfo(linkAddress, gateAddr);
routes.add(route);
} catch (Exception e) {
Log.e(TAG, "Error parsing route " + s + " : " + e);
continue;
}
}
}
}
return routes.toArray(new RouteInfo[routes.size()]);
|
private static java.lang.String | getSecurityType(android.net.wifi.WifiConfiguration wifiConfig)
switch (wifiConfig.getAuthType()) {
case KeyMgmt.WPA_PSK:
return "wpa-psk";
case KeyMgmt.WPA2_PSK:
return "wpa2-psk";
default:
return "open";
}
|
public boolean | isBandwidthControlEnabled()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
return mBandwidthControlEnabled;
|
public boolean | isClatdStarted(java.lang.String interfaceName)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final NativeDaemonEvent event;
try {
event = mConnector.execute("clatd", "status", interfaceName);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
event.checkCode(ClatdStatusResult);
return event.getMessage().endsWith("started");
|
public boolean | isFirewallEnabled()
enforceSystemUid();
return mFirewallEnabled;
|
public boolean | isNetworkActive()
synchronized (mNetworkActivityListeners) {
return mNetworkActive || mActiveIdleTimers.isEmpty();
}
|
public boolean | isTetheringStarted()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final NativeDaemonEvent event;
try {
event = mConnector.execute("tether", "status");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
// 210 Tethering services started
event.checkCode(TetherStatusResult);
return event.getMessage().endsWith("started");
|
public java.lang.String[] | listInterfaces()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
return NativeDaemonEvent.filterMessageList(
mConnector.executeForList("interface", "list"), InterfaceListResult);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public java.lang.String[] | listTetheredInterfaces()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
return NativeDaemonEvent.filterMessageList(
mConnector.executeForList("tether", "interface", "list"),
TetherInterfaceListResult);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public java.lang.String[] | listTtys()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
return NativeDaemonEvent.filterMessageList(
mConnector.executeForList("list_ttys"), TtyListResult);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
private void | modifyInterfaceInNetwork(java.lang.String action, java.lang.String netId, java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("network", "interface", action, netId, iface);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
private void | modifyNat(java.lang.String action, java.lang.String internalInterface, java.lang.String externalInterface)
final Command cmd = new Command("nat", action, internalInterface, externalInterface);
final NetworkInterface internalNetworkInterface = NetworkInterface.getByName(
internalInterface);
if (internalNetworkInterface == null) {
cmd.appendArg("0");
} else {
// Don't touch link-local routes, as link-local addresses aren't routable,
// kernel creates link-local routes on all interfaces automatically
List<InterfaceAddress> interfaceAddresses = excludeLinkLocal(
internalNetworkInterface.getInterfaceAddresses());
cmd.appendArg(interfaceAddresses.size());
for (InterfaceAddress ia : interfaceAddresses) {
InetAddress addr = NetworkUtils.getNetworkPart(
ia.getAddress(), ia.getNetworkPrefixLength());
cmd.appendArg(addr.getHostAddress() + "/" + ia.getNetworkPrefixLength());
}
}
try {
mConnector.execute(cmd);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
private void | modifyRoute(java.lang.String action, java.lang.String netId, android.net.RouteInfo route)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final Command cmd = new Command("network", "route", action, netId);
// create triplet: interface dest-ip-addr/prefixlength gateway-ip-addr
cmd.appendArg(route.getInterface());
cmd.appendArg(route.getDestination().toString());
switch (route.getType()) {
case RouteInfo.RTN_UNICAST:
if (route.hasGateway()) {
cmd.appendArg(route.getGateway().getHostAddress());
}
break;
case RouteInfo.RTN_UNREACHABLE:
cmd.appendArg("unreachable");
break;
case RouteInfo.RTN_THROW:
cmd.appendArg("throw");
break;
}
try {
mConnector.execute(cmd);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | monitor(){@inheritDoc}
if (mConnector != null) {
mConnector.monitor();
}
|
private void | notifyAddressRemoved(java.lang.String iface, android.net.LinkAddress address)Notify our observers of a deleted interface address.
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).addressRemoved(iface, address);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | notifyAddressUpdated(java.lang.String iface, android.net.LinkAddress address)Notify our observers of a new or updated interface address.
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).addressUpdated(iface, address);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | notifyInterfaceAdded(java.lang.String iface)Notify our observers of an interface addition.
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).interfaceAdded(iface);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | notifyInterfaceClassActivity(int type, int powerState, long tsNanos, boolean fromRadio)Notify our observers of a change in the data activity state of the interface
final boolean isMobile = ConnectivityManager.isNetworkTypeMobile(type);
if (isMobile) {
if (!fromRadio) {
if (mMobileActivityFromRadio) {
// If this call is not coming from a report from the radio itself, but we
// have previously received reports from the radio, then we will take the
// power state to just be whatever the radio last reported.
powerState = mLastPowerStateFromRadio;
}
} else {
mMobileActivityFromRadio = true;
}
if (mLastPowerStateFromRadio != powerState) {
mLastPowerStateFromRadio = powerState;
try {
getBatteryStats().noteMobileRadioPowerState(powerState, tsNanos);
} catch (RemoteException e) {
}
}
}
boolean isActive = powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_MEDIUM
|| powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH;
if (!isMobile || fromRadio || !mMobileActivityFromRadio) {
// Report the change in data activity. We don't do this if this is a change
// on the mobile network, that is not coming from the radio itself, and we
// have previously seen change reports from the radio. In that case only
// the radio is the authority for the current state.
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).interfaceClassDataActivityChanged(
Integer.toString(type), isActive, tsNanos);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
}
boolean report = false;
synchronized (mIdleTimerLock) {
if (mActiveIdleTimers.isEmpty()) {
// If there are no idle timers, we are not monitoring activity, so we
// are always considered active.
isActive = true;
}
if (mNetworkActive != isActive) {
mNetworkActive = isActive;
report = isActive;
}
}
if (report) {
reportNetworkActive();
}
|
private void | notifyInterfaceDnsServerInfo(java.lang.String iface, long lifetime, java.lang.String[] addresses)Notify our observers of DNS server information received.
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).interfaceDnsServerInfo(iface, lifetime,
addresses);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | notifyInterfaceLinkStateChanged(java.lang.String iface, boolean up)Notify our observers of an interface link state change
(typically, an Ethernet cable has been plugged-in or unplugged).
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).interfaceLinkStateChanged(iface, up);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | notifyInterfaceRemoved(java.lang.String iface)Notify our observers of an interface removal.
// netd already clears out quota and alerts for removed ifaces; update
// our sanity-checking state.
mActiveAlerts.remove(iface);
mActiveQuotas.remove(iface);
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).interfaceRemoved(iface);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | notifyInterfaceStatusChanged(java.lang.String iface, boolean up)Notify our observers of an interface status change
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).interfaceStatusChanged(iface, up);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | notifyLimitReached(java.lang.String limitName, java.lang.String iface)Notify our observers of a limit reached.
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mObservers.getBroadcastItem(i).limitReached(limitName, iface);
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | notifyRouteChange(java.lang.String action, android.net.RouteInfo route)Notify our observers of a route change.
final int length = mObservers.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
if (action.equals("updated")) {
mObservers.getBroadcastItem(i).routeUpdated(route);
} else {
mObservers.getBroadcastItem(i).routeRemoved(route);
}
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mObservers.finishBroadcast();
}
|
private void | prepareNativeDaemon()Prepare native daemon once connected, enabling modules and pushing any
existing in-memory rules.
mBandwidthControlEnabled = false;
// only enable bandwidth control when support exists
final boolean hasKernelSupport = new File("/proc/net/xt_qtaguid/ctrl").exists();
if (hasKernelSupport) {
Slog.d(TAG, "enabling bandwidth control");
try {
mConnector.execute("bandwidth", "enable");
mBandwidthControlEnabled = true;
} catch (NativeDaemonConnectorException e) {
Log.wtf(TAG, "problem enabling bandwidth controls", e);
}
} else {
Slog.d(TAG, "not enabling bandwidth control");
}
SystemProperties.set(PROP_QTAGUID_ENABLED, mBandwidthControlEnabled ? "1" : "0");
if (mBandwidthControlEnabled) {
try {
getBatteryStats().noteNetworkStatsEnabled();
} catch (RemoteException e) {
}
}
// push any existing quota or UID rules
synchronized (mQuotaLock) {
int size = mActiveQuotas.size();
if (size > 0) {
Slog.d(TAG, "pushing " + size + " active quota rules");
final HashMap<String, Long> activeQuotas = mActiveQuotas;
mActiveQuotas = Maps.newHashMap();
for (Map.Entry<String, Long> entry : activeQuotas.entrySet()) {
setInterfaceQuota(entry.getKey(), entry.getValue());
}
}
size = mActiveAlerts.size();
if (size > 0) {
Slog.d(TAG, "pushing " + size + " active alert rules");
final HashMap<String, Long> activeAlerts = mActiveAlerts;
mActiveAlerts = Maps.newHashMap();
for (Map.Entry<String, Long> entry : activeAlerts.entrySet()) {
setInterfaceAlert(entry.getKey(), entry.getValue());
}
}
size = mUidRejectOnQuota.size();
if (size > 0) {
Slog.d(TAG, "pushing " + size + " active uid rules");
final SparseBooleanArray uidRejectOnQuota = mUidRejectOnQuota;
mUidRejectOnQuota = new SparseBooleanArray();
for (int i = 0; i < uidRejectOnQuota.size(); i++) {
setUidNetworkRules(uidRejectOnQuota.keyAt(i), uidRejectOnQuota.valueAt(i));
}
}
}
// TODO: Push any existing firewall state
setFirewallEnabled(mFirewallEnabled || LockdownVpnTracker.isEnabled());
|
private java.util.ArrayList | readRouteList(java.lang.String filename)
FileInputStream fstream = null;
ArrayList<String> list = new ArrayList<String>();
try {
fstream = new FileInputStream(filename);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String s;
// throw away the title line
while (((s = br.readLine()) != null) && (s.length() != 0)) {
list.add(s);
}
} catch (IOException ex) {
// return current list, possibly empty
} finally {
if (fstream != null) {
try {
fstream.close();
} catch (IOException ex) {}
}
}
return list;
|
public void | registerNetworkActivityListener(android.os.INetworkActivityListener listener)
mNetworkActivityListeners.register(listener);
|
public void | registerObserver(android.net.INetworkManagementEventObserver observer)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
mObservers.register(observer);
|
public void | removeIdleTimer(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
if (DBG) Slog.d(TAG, "Removing idletimer");
synchronized (mIdleTimerLock) {
final IdleTimerParams params = mActiveIdleTimers.get(iface);
if (params == null || --(params.networkCount) > 0) {
return;
}
try {
mConnector.execute("idletimer", "remove", iface,
Integer.toString(params.timeout), Integer.toString(params.type));
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
mActiveIdleTimers.remove(iface);
mDaemonHandler.post(new Runnable() {
@Override public void run() {
notifyInterfaceClassActivity(params.type,
DataConnectionRealTimeInfo.DC_POWER_STATE_LOW,
SystemClock.elapsedRealtimeNanos(), false);
}
});
}
|
public void | removeInterfaceAlert(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
// silently discard when control disabled
// TODO: eventually migrate to be always enabled
if (!mBandwidthControlEnabled) return;
synchronized (mQuotaLock) {
if (!mActiveAlerts.containsKey(iface)) {
// TODO: eventually consider throwing
return;
}
try {
// TODO: support alert shared across interfaces
mConnector.execute("bandwidth", "removeinterfacealert", iface);
mActiveAlerts.remove(iface);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
}
|
public void | removeInterfaceFromLocalNetwork(java.lang.String iface)
modifyInterfaceInNetwork("remove", "local", iface);
|
public void | removeInterfaceFromNetwork(java.lang.String iface, int netId)
modifyInterfaceInNetwork("remove", "" + netId, iface);
|
public void | removeInterfaceQuota(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
// silently discard when control disabled
// TODO: eventually migrate to be always enabled
if (!mBandwidthControlEnabled) return;
synchronized (mQuotaLock) {
if (!mActiveQuotas.containsKey(iface)) {
// TODO: eventually consider throwing
return;
}
mActiveQuotas.remove(iface);
mActiveAlerts.remove(iface);
try {
// TODO: support quota shared across interfaces
mConnector.execute("bandwidth", "removeiquota", iface);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
}
|
public void | removeNetwork(int netId)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("network", "destroy", netId);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | removeRoute(int netId, android.net.RouteInfo route)
modifyRoute("remove", "" + netId, route);
|
public void | removeVpnUidRanges(int netId, android.net.UidRange[] ranges)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
Object[] argv = new Object[3 + MAX_UID_RANGES_PER_COMMAND];
argv[0] = "users";
argv[1] = "remove";
argv[2] = netId;
int argc = 3;
// Avoid overly long commands by limiting number of UID ranges per command.
for (int i = 0; i < ranges.length; i++) {
argv[argc++] = ranges[i].toString();
if (i == (ranges.length - 1) || argc == argv.length) {
try {
mConnector.execute("network", Arrays.copyOf(argv, argc));
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
argc = 3;
}
}
|
private void | reportNetworkActive()
final int length = mNetworkActivityListeners.beginBroadcast();
try {
for (int i = 0; i < length; i++) {
try {
mNetworkActivityListeners.getBroadcastItem(i).onNetworkActive();
} catch (RemoteException e) {
} catch (RuntimeException e) {
}
}
} finally {
mNetworkActivityListeners.finishBroadcast();
}
|
public void | setAccessPoint(android.net.wifi.WifiConfiguration wifiConfig, java.lang.String wlanIface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
if (wifiConfig == null) {
mConnector.execute("softap", "set", wlanIface);
} else {
mConnector.execute("softap", "set", wlanIface, wifiConfig.SSID,
"broadcast", "6", getSecurityType(wifiConfig),
new SensitiveArg(wifiConfig.preSharedKey));
}
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setDefaultNetId(int netId)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("network", "default", "set", netId);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setDnsForwarders(android.net.Network network, java.lang.String[] dns)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
int netId = (network != null) ? network.netId : ConnectivityManager.NETID_UNSET;
final Command cmd = new Command("tether", "dns", "set", netId);
for (String s : dns) {
cmd.appendArg(NetworkUtils.numericToInetAddress(s).getHostAddress());
}
try {
mConnector.execute(cmd);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setDnsServersForNetwork(int netId, java.lang.String[] servers, java.lang.String domains)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
Command cmd;
if (servers.length > 0) {
cmd = new Command("resolver", "setnetdns", netId,
(domains == null ? "" : domains));
for (String s : servers) {
InetAddress a = NetworkUtils.numericToInetAddress(s);
if (a.isAnyLocalAddress() == false) {
cmd.appendArg(a.getHostAddress());
}
}
} else {
cmd = new Command("resolver", "clearnetdns", netId);
}
try {
mConnector.execute(cmd);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setFirewallEgressDestRule(java.lang.String addr, int port, boolean allow)
enforceSystemUid();
Preconditions.checkState(mFirewallEnabled);
final String rule = allow ? "allow" : "deny";
try {
mConnector.execute("firewall", "set_egress_dest_rule", addr, port, rule);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setFirewallEgressSourceRule(java.lang.String addr, boolean allow)
enforceSystemUid();
Preconditions.checkState(mFirewallEnabled);
final String rule = allow ? "allow" : "deny";
try {
mConnector.execute("firewall", "set_egress_source_rule", addr, rule);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setFirewallEnabled(boolean enabled)
enforceSystemUid();
try {
mConnector.execute("firewall", enabled ? "enable" : "disable");
mFirewallEnabled = enabled;
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setFirewallInterfaceRule(java.lang.String iface, boolean allow)
enforceSystemUid();
Preconditions.checkState(mFirewallEnabled);
final String rule = allow ? "allow" : "deny";
try {
mConnector.execute("firewall", "set_interface_rule", iface, rule);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setFirewallUidRule(int uid, boolean allow)
enforceSystemUid();
Preconditions.checkState(mFirewallEnabled);
final String rule = allow ? "allow" : "deny";
try {
mConnector.execute("firewall", "set_uid_rule", uid, rule);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setGlobalAlert(long alertBytes)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
// silently discard when control disabled
// TODO: eventually migrate to be always enabled
if (!mBandwidthControlEnabled) return;
try {
mConnector.execute("bandwidth", "setglobalalert", alertBytes);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setInterfaceAlert(java.lang.String iface, long alertBytes)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
// silently discard when control disabled
// TODO: eventually migrate to be always enabled
if (!mBandwidthControlEnabled) return;
// quick sanity check
if (!mActiveQuotas.containsKey(iface)) {
throw new IllegalStateException("setting alert requires existing quota on iface");
}
synchronized (mQuotaLock) {
if (mActiveAlerts.containsKey(iface)) {
throw new IllegalStateException("iface " + iface + " already has alert");
}
try {
// TODO: support alert shared across interfaces
mConnector.execute("bandwidth", "setinterfacealert", iface, alertBytes);
mActiveAlerts.put(iface, alertBytes);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
}
|
public void | setInterfaceConfig(java.lang.String iface, android.net.InterfaceConfiguration cfg)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
LinkAddress linkAddr = cfg.getLinkAddress();
if (linkAddr == null || linkAddr.getAddress() == null) {
throw new IllegalStateException("Null LinkAddress given");
}
final Command cmd = new Command("interface", "setcfg", iface,
linkAddr.getAddress().getHostAddress(),
linkAddr.getPrefixLength());
for (String flag : cfg.getFlags()) {
cmd.appendArg(flag);
}
try {
mConnector.execute(cmd);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setInterfaceDown(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final InterfaceConfiguration ifcg = getInterfaceConfig(iface);
ifcg.setInterfaceDown();
setInterfaceConfig(iface, ifcg);
|
public void | setInterfaceIpv6NdOffload(java.lang.String iface, boolean enable)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute(
"interface", "ipv6ndoffload", iface, (enable ? "enable" : "disable"));
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setInterfaceIpv6PrivacyExtensions(java.lang.String iface, boolean enable)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute(
"interface", "ipv6privacyextensions", iface, enable ? "enable" : "disable");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setInterfaceQuota(java.lang.String iface, long quotaBytes)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
// silently discard when control disabled
// TODO: eventually migrate to be always enabled
if (!mBandwidthControlEnabled) return;
synchronized (mQuotaLock) {
if (mActiveQuotas.containsKey(iface)) {
throw new IllegalStateException("iface " + iface + " already has quota");
}
try {
// TODO: support quota shared across interfaces
mConnector.execute("bandwidth", "setiquota", iface, quotaBytes);
mActiveQuotas.put(iface, quotaBytes);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
}
|
public void | setInterfaceUp(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final InterfaceConfiguration ifcg = getInterfaceConfig(iface);
ifcg.setInterfaceUp();
setInterfaceConfig(iface, ifcg);
|
public void | setIpForwardingEnabled(boolean enable)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("ipfwd", enable ? "enable" : "disable");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setMtu(java.lang.String iface, int mtu)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
final NativeDaemonEvent event;
try {
event = mConnector.execute("interface", "setmtu", iface, mtu);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | setPermission(java.lang.String permission, int[] uids)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
Object[] argv = new Object[4 + MAX_UID_RANGES_PER_COMMAND];
argv[0] = "permission";
argv[1] = "user";
argv[2] = "set";
argv[3] = permission;
int argc = 4;
// Avoid overly long commands by limiting number of UIDs per command.
for (int i = 0; i < uids.length; ++i) {
argv[argc++] = uids[i];
if (i == uids.length - 1 || argc == argv.length) {
try {
mConnector.execute("network", Arrays.copyOf(argv, argc));
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
argc = 4;
}
}
|
public void | setUidNetworkRules(int uid, boolean rejectOnQuotaInterfaces)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
// silently discard when control disabled
// TODO: eventually migrate to be always enabled
if (!mBandwidthControlEnabled) return;
synchronized (mQuotaLock) {
final boolean oldRejectOnQuota = mUidRejectOnQuota.get(uid, false);
if (oldRejectOnQuota == rejectOnQuotaInterfaces) {
// TODO: eventually consider throwing
return;
}
try {
mConnector.execute("bandwidth",
rejectOnQuotaInterfaces ? "addnaughtyapps" : "removenaughtyapps", uid);
if (rejectOnQuotaInterfaces) {
mUidRejectOnQuota.put(uid, true);
} else {
mUidRejectOnQuota.delete(uid);
}
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
}
|
public void | shutdown()
// TODO: remove from aidl if nobody calls externally
mContext.enforceCallingOrSelfPermission(SHUTDOWN, TAG);
Slog.d(TAG, "Shutting down");
|
public void | startAccessPoint(android.net.wifi.WifiConfiguration wifiConfig, java.lang.String wlanIface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
wifiFirmwareReload(wlanIface, "AP");
if (wifiConfig == null) {
mConnector.execute("softap", "set", wlanIface);
} else {
mConnector.execute("softap", "set", wlanIface, wifiConfig.SSID,
"broadcast", "6", getSecurityType(wifiConfig),
new SensitiveArg(wifiConfig.preSharedKey));
}
mConnector.execute("softap", "startap");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | startClatd(java.lang.String interfaceName)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("clatd", "start", interfaceName);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | startTethering(java.lang.String[] dhcpRange)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
// cmd is "tether start first_start first_stop second_start second_stop ..."
// an odd number of addrs will fail
final Command cmd = new Command("tether", "start");
for (String d : dhcpRange) {
cmd.appendArg(d);
}
try {
mConnector.execute(cmd);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | stopAccessPoint(java.lang.String wlanIface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("softap", "stopap");
wifiFirmwareReload(wlanIface, "STA");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | stopClatd(java.lang.String interfaceName)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("clatd", "stop", interfaceName);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | stopTethering()
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("tether", "stop");
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|
public void | systemReady()
prepareNativeDaemon();
if (DBG) Slog.d(TAG, "Prepared");
|
public void | tetherInterface(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("tether", "interface", "add", iface);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
List<RouteInfo> routes = new ArrayList<RouteInfo>();
// The RouteInfo constructor truncates the LinkAddress to a network prefix, thus making it
// suitable to use as a route destination.
routes.add(new RouteInfo(getInterfaceConfig(iface).getLinkAddress(), null, iface));
addInterfaceToLocalNetwork(iface, routes);
|
public void | unregisterNetworkActivityListener(android.os.INetworkActivityListener listener)
mNetworkActivityListeners.unregister(listener);
|
public void | unregisterObserver(android.net.INetworkManagementEventObserver observer)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
mObservers.unregister(observer);
|
public void | untetherInterface(java.lang.String iface)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("tether", "interface", "remove", iface);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
removeInterfaceFromLocalNetwork(iface);
|
public void | wifiFirmwareReload(java.lang.String wlanIface, java.lang.String mode)
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("softap", "fwreload", wlanIface, mode);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
|