Support set test network to tethering upstream
Test: atest EthernetTetheringTest Change-Id: Ief2a92bc6c573a6bb75c72b7a0630e5c0accfa73
This commit is contained in:
@@ -49,4 +49,6 @@ oneway interface ITetheringConnector {
|
||||
|
||||
void stopAllTethering(String callerPkg, String callingAttributionTag,
|
||||
IIntResultListener receiver);
|
||||
|
||||
void setPreferTestNetworks(boolean prefer, IIntResultListener listener);
|
||||
}
|
||||
|
||||
@@ -1538,4 +1538,25 @@ public class TetheringManager {
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to treat networks that have TRANSPORT_TEST as Tethering upstreams. The effects of
|
||||
* this method apply to any test networks that are already present on the system.
|
||||
*
|
||||
* @throws SecurityException If the caller doesn't have the NETWORK_SETTINGS permission.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
|
||||
public void setPreferTestNetworks(final boolean prefer) {
|
||||
Log.i(TAG, "setPreferTestNetworks caller: " + mContext.getOpPackageName());
|
||||
|
||||
final RequestDispatcher dispatcher = new RequestDispatcher();
|
||||
final int ret = dispatcher.waitForResult((connector, listener) -> {
|
||||
try {
|
||||
connector.setPreferTestNetworks(prefer, listener);
|
||||
} catch (RemoteException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user