Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit acf193f4 authored by Ivo Kay's avatar Ivo Kay Committed by Android (Google) Code Review
Browse files

Merge changes Ib4b61c59,Ic1f305eb into main

* changes:
  Cleanup flag and code accumulate_network_stats_since_boot
  Cleanup flag and code apply_network_stats_poll_rate_limit
parents 55e204f1 4afaa17d
Loading
Loading
Loading
Loading
+22 −41
Original line number Diff line number Diff line
@@ -71,10 +71,8 @@ import static com.android.internal.util.FrameworkStatsLog.TIME_ZONE_DETECTOR_STA
import static com.android.internal.util.FrameworkStatsLog.TIME_ZONE_DETECTOR_STATE__DETECTION_MODE__TELEPHONY;
import static com.android.internal.util.FrameworkStatsLog.TIME_ZONE_DETECTOR_STATE__DETECTION_MODE__UNKNOWN;
import static com.android.server.am.MemoryStatUtil.readMemoryStatFromFilesystem;
import static com.android.server.stats.Flags.accumulateNetworkStatsSinceBoot;
import static com.android.server.stats.Flags.addMobileBytesTransferByProcStatePuller;
import static com.android.server.stats.Flags.addPressureStallInformationPuller;
import static com.android.server.stats.Flags.applyNetworkStatsPollRateLimit;
import static com.android.server.stats.pull.IonMemoryUtil.readProcessSystemIonHeapSizesFromDebugfs;
import static com.android.server.stats.pull.IonMemoryUtil.readSystemIonHeapSizeFromDebugfs;
import static com.android.server.stats.pull.netstats.NetworkStatsUtils.fromPublicNetworkStats;
@@ -1622,7 +1620,6 @@ public class StatsPullAtomService extends SystemService {
        final long bucketDurationMillis = Settings.Global.getLong(mContext.getContentResolver(),
                NETSTATS_UID_BUCKET_DURATION, NETSTATS_UID_DEFAULT_BUCKET_DURATION_MS);

        if (accumulateNetworkStatsSinceBoot()) {
        NetworkStatsAccumulator accumulator = CollectionUtils.find(
                mNetworkStatsAccumulators, it -> it.hasEqualParameters(template, includeTags));
        if (accumulator == null) {
@@ -1641,14 +1638,6 @@ public class StatsPullAtomService extends SystemService {
                                aIncludeTags, aStartTime, aEndTime);
                    }
                });

        } else {
            // Set end time in the future to include all stats in the active bucket.
            return getUidNetworkStatsSnapshotForTemplateLocked(
                    template, includeTags,
                    bootTimeMillis - bucketDurationMillis,
                    currentTimeMillis + bucketDurationMillis);
        }
    }

    @GuardedBy("mDataBytesTransferLock")
@@ -1656,19 +1645,11 @@ public class StatsPullAtomService extends SystemService {
    private NetworkStats getUidNetworkStatsSnapshotForTemplateLocked(
            @NonNull NetworkTemplate template, boolean includeTags, long startTime, long endTime) {
        final long elapsedMillisSinceBoot = SystemClock.elapsedRealtime();
        if (applyNetworkStatsPollRateLimit()) {
            // The new way: rate-limit force-polling for all NetworkStats queries
        // Rate-limit force-polling for all NetworkStats queries
        if (elapsedMillisSinceBoot - mLastNetworkStatsPollTime >= NETSTATS_POLL_RATE_LIMIT_MS) {
            mLastNetworkStatsPollTime = elapsedMillisSinceBoot;
            getNetworkStatsManager().forceUpdate();
        }
        } else {
            // The old way: force-poll only on WiFi queries. Data for other queries can be stale
            // if there was no recent poll beforehand (e.g. for WiFi or scheduled poll)
            if (template.getMatchRule() == MATCH_WIFI && template.getSubscriberIds().isEmpty()) {
                getNetworkStatsManager().forceUpdate();
            }
        }

        final android.app.usage.NetworkStats queryNonTaggedStats =
                getNetworkStatsManager().querySummary(template, startTime, endTime);
+0 −16
Original line number Diff line number Diff line
@@ -23,22 +23,6 @@ flag {
    is_fixed_read_only: true
}

flag {
    name: "apply_network_stats_poll_rate_limit"
    namespace: "statsd"
    description: "Apply a rate limit for polling network stats when pulling relevant atoms"
    bug: "352495181"
    is_fixed_read_only: true
}

flag {
    name: "accumulate_network_stats_since_boot"
    namespace: "statsd"
    description: "Accumulate results of NetworkStats queries to avoid hitting NetworkStats persistence limit"
    bug: "352537247"
    is_fixed_read_only: true
}

flag {
    name: "add_pressure_stall_information_puller"
    namespace: "statsd"