Methods Summary |
---|
public void | addListener(android.net.IEthernetServiceListener listener)Addes a listener.
if (listener == null) {
throw new IllegalArgumentException("listener must not be null");
}
enforceAccessPermission();
mListeners.register(listener);
|
protected void | dump(java.io.FileDescriptor fd, java.io.PrintWriter writer, java.lang.String[] args)
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
!= PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump EthernetService from pid="
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid());
return;
}
pw.println("Current Ethernet state: ");
pw.increaseIndent();
mTracker.dump(fd, pw, args);
pw.decreaseIndent();
pw.println();
pw.println("Stored Ethernet configuration: ");
pw.increaseIndent();
pw.println(mIpConfiguration);
pw.decreaseIndent();
pw.println("Handler:");
pw.increaseIndent();
mHandler.dump(new PrintWriterPrinter(pw), "EthernetServiceImpl");
pw.decreaseIndent();
|
private void | enforceAccessPermission()
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.ACCESS_NETWORK_STATE,
"EthernetService");
|
private void | enforceChangePermission()
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CHANGE_NETWORK_STATE,
"EthernetService");
|
private void | enforceConnectivityInternalPermission()
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CONNECTIVITY_INTERNAL,
"ConnectivityService");
|
public android.net.IpConfiguration | getConfiguration()Get Ethernet configuration
enforceAccessPermission();
synchronized (mIpConfiguration) {
return new IpConfiguration(mIpConfiguration);
}
|
public boolean | isAvailable()Indicates whether the system currently has one or more
Ethernet interfaces.
enforceAccessPermission();
return mTracker.isTrackingInterface();
|
public void | removeListener(android.net.IEthernetServiceListener listener)Removes a listener.
if (listener == null) {
throw new IllegalArgumentException("listener must not be null");
}
enforceAccessPermission();
mListeners.unregister(listener);
|
public void | setConfiguration(android.net.IpConfiguration config)Set Ethernet configuration
if (!mStarted.get()) {
Log.w(TAG, "System isn't ready enough to change ethernet configuration");
}
enforceChangePermission();
enforceConnectivityInternalPermission();
synchronized (mIpConfiguration) {
mEthernetConfigStore.writeIpAndProxyConfigurations(config);
// TODO: this does not check proxy settings, gateways, etc.
// Fix this by making IpConfiguration a complete representation of static configuration.
if (!config.equals(mIpConfiguration)) {
mIpConfiguration = new IpConfiguration(config);
mTracker.stop();
mTracker.start(mContext, mHandler);
}
}
|
public void | start()
Log.i(TAG, "Starting Ethernet service");
HandlerThread handlerThread = new HandlerThread("EthernetServiceThread");
handlerThread.start();
mHandler = new Handler(handlerThread.getLooper());
mTracker.start(mContext, mHandler);
mStarted.set(true);
|