Implement INetworkMonitorCallbacks#notifyNetworkTestedWithExtras.

INetworkMonitorCallbacks defines notifyNetworkTestedWithExtras() for
notifying ConnectivityService of networks being tested along with a
PersistableBundle of extras. A new event is introduced for
NetworkStateTrackerHandler to notify the ConnectivityDiagnosticsHandler
before continuing with the normal processing for "network tested"
notifications. The event is also used in the
ConnectivityDiagnosticsHandler.

Bug: 143187964
Bug: 147391402
Test: compiles.
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: Iab29da790c0f5faae68227770bc3a84bbc94f124
(cherry picked from commit c5326407d592490783259a48a8ca653c4ff13122)
This commit is contained in:
Cody Kesting
2020-01-05 14:06:39 -08:00
parent 406c383aa1
commit c8e5bf6eff
6 changed files with 455 additions and 102 deletions

View File

@@ -676,7 +676,8 @@ public class ConnectivityDiagnosticsManager {
}
try {
mService.registerConnectivityDiagnosticsCallback(binder, request);
mService.registerConnectivityDiagnosticsCallback(
binder, request, mContext.getOpPackageName());
} catch (RemoteException exception) {
exception.rethrowFromSystemServer();
}

View File

@@ -222,7 +222,7 @@ interface IConnectivityManager
boolean isCallerCurrentAlwaysOnVpnLockdownApp();
void registerConnectivityDiagnosticsCallback(in IConnectivityDiagnosticsCallback callback,
in NetworkRequest request);
in NetworkRequest request, String callingPackageName);
void unregisterConnectivityDiagnosticsCallback(in IConnectivityDiagnosticsCallback callback);
IBinder startOrGetTestNetworkService();

View File

@@ -858,8 +858,8 @@ public final class NetworkCapabilities implements Parcelable {
*
* <p>In general, user-supplied networks (such as WiFi networks) do not have an administrator.
*
* <p>An app is granted owner privileges over Networks that it supplies. Owner privileges
* implicitly include administrator privileges.
* <p>An app is granted owner privileges over Networks that it supplies. The owner UID MUST
* always be included in administratorUids.
*
* @param administratorUids the UIDs to be set as administrators of this Network.
* @hide