[FUI18] Expose notifyNetworkStatus as system API

Test: m -j doc-comment-check-docs
Bug: 174123988
Change-Id: I11d4c9ab24de87fb2ad120e3787b78b73133e874
This commit is contained in:
junyulai
2021-01-23 11:00:10 +08:00
parent 44b5fb7c5f
commit 537b8cfe68
2 changed files with 54 additions and 5 deletions

View File

@@ -379,6 +379,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
case MSG_UPDATE_IFACES: {
// If no cached states, ignore.
if (mLastNetworkStateSnapshots == null) break;
// TODO (b/181642673): Protect mDefaultNetworks from concurrent accessing.
updateIfaces(mDefaultNetworks, mLastNetworkStateSnapshots, mActiveIface);
break;
}
@@ -1266,7 +1267,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
* they are combined under a single {@link NetworkIdentitySet}.
*/
@GuardedBy("mStatsLock")
private void updateIfacesLocked(@Nullable Network[] defaultNetworks,
private void updateIfacesLocked(@NonNull Network[] defaultNetworks,
@NonNull NetworkStateSnapshot[] snapshots) {
if (!mSystemReady) return;
if (LOGV) Slog.v(TAG, "updateIfacesLocked()");
@@ -1282,10 +1283,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
// Rebuild active interfaces based on connected networks
mActiveIfaces.clear();
mActiveUidIfaces.clear();
if (defaultNetworks != null) {
// Caller is ConnectivityService. Update the list of default networks.
mDefaultNetworks = defaultNetworks;
}
// Update the list of default networks.
mDefaultNetworks = defaultNetworks;
mLastNetworkStateSnapshots = snapshots;