Merge "Clatd-related commands porting"

This commit is contained in:
Luke Huang
2018-08-15 03:38:50 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 26 deletions

View File

@@ -371,11 +371,6 @@ interface INetworkManagementService
*/
void stopClatd(String interfaceName);
/**
* Determine whether the clatd (464xlat) service has been started on the given interface.
*/
boolean isClatdStarted(String interfaceName);
/**
* Start listening for mobile activity state changes.
*/

View File

@@ -2303,9 +2303,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("clatd", "start", interfaceName);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
mNetdService.clatdStart(interfaceName);
} catch (RemoteException | ServiceSpecificException e) {
throw new IllegalStateException(e);
}
}
@@ -2314,27 +2314,12 @@ public class NetworkManagementService extends INetworkManagementService.Stub
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
mConnector.execute("clatd", "stop", interfaceName);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
mNetdService.clatdStop(interfaceName);
} catch (RemoteException | ServiceSpecificException e) {
throw new IllegalStateException(e);
}
}
@Override
public boolean isClatdStarted(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");
}
@Override
public void registerNetworkActivityListener(INetworkActivityListener listener) {
mNetworkActivityListeners.register(listener);