diff options
| author | Treehugger Robot <treehugger-gerrit@google.com> | 2022-01-12 19:33:52 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-01-12 19:33:52 +0000 |
| commit | fc6b6be1996430c8ba83704c56f16f8a3584435d (patch) | |
| tree | 5bdd244c5606b4301463714395de8c4a77e81ee9 /framework-t/src | |
| parent | d704f87de6e4bdad2e514f750ce6772851292fcf (diff) | |
| parent | d686e2dd2d7ba86900832bd4afabf3e1b130e034 (diff) | |
Merge "[DU03]Remove INetworkStatsService from BatteryStatsImpl"
Diffstat (limited to 'framework-t/src')
| -rw-r--r-- | framework-t/src/android/app/usage/NetworkStatsManager.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/framework-t/src/android/app/usage/NetworkStatsManager.java b/framework-t/src/android/app/usage/NetworkStatsManager.java index a316b8a617..583f7ba8cd 100644 --- a/framework-t/src/android/app/usage/NetworkStatsManager.java +++ b/framework-t/src/android/app/usage/NetworkStatsManager.java @@ -54,6 +54,7 @@ import com.android.net.module.util.NetworkIdentityUtils; import java.util.List; import java.util.Objects; +import java.util.Set; /** * Provides access to network usage history and statistics. Usage data is collected in @@ -535,6 +536,31 @@ public class NetworkStatsManager { return result; } + /** + * Query realtime network usage statistics details with interfaces constrains. + * Return snapshot of current UID statistics, including any {@link TrafficStats#UID_TETHERING}, + * video calling data usage and count of network operations that set by + * {@link TrafficStats#incrementOperationCount}. The returned data doesn't include any + * statistics that is reported by {@link NetworkStatsProvider}. + * + * @param requiredIfaces A list of interfaces the stats should be restricted to, or + * {@link NetworkStats#INTERFACES_ALL}. + * + * @hide + */ + //@SystemApi + @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) + @NonNull public android.net.NetworkStats getDetailedUidStats( + @NonNull Set<String> requiredIfaces) { + Objects.requireNonNull(requiredIfaces, "requiredIfaces cannot be null"); + try { + return mService.getDetailedUidStats(requiredIfaces.toArray(new String[0])); + } catch (RemoteException e) { + if (DBG) Log.d(TAG, "Remote exception when get detailed uid stats"); + throw e.rethrowFromSystemServer(); + } + } + /** @hide */ public void registerUsageCallback(NetworkTemplate template, int networkType, long thresholdBytes, UsageCallback callback, @Nullable Handler handler) { |
