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

Commit e1b4ab96 authored by Stanislav Zholnin's avatar Stanislav Zholnin Committed by Automerger Merge Worker
Browse files

Merge "Add DeviceConfig flag to be able to change sampling ratio of...

Merge "Add DeviceConfig flag to be able to change sampling ratio of AttributedAppOps atom after R release." into rvc-dev am: 634642bc am: a0cc64a4 am: 22b4997d

Change-Id: I210113ddf700185079f5b288ef39912e13d49ffd
parents e40f0000 22b4997d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ import android.os.connectivity.WifiActivityEnergyInfo;
import android.os.storage.DiskInfo;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.stats.storage.StorageEnums;
import android.telephony.ModemActivityInfo;
@@ -204,6 +205,7 @@ public class StatsPullAtomService extends SystemService {
    private static final int CPU_TIME_PER_THREAD_FREQ_MAX_NUM_FREQUENCIES = 8;
    private static final int OP_FLAGS_PULLED = OP_FLAG_SELF | OP_FLAG_TRUSTED_PROXY;
    private static final String COMMON_PERMISSION_PREFIX = "android.permission.";
    private static final String APP_OPS_TARGET_COLLECTION_SIZE = "app_ops_target_collection_size";

    private final Object mNetworkStatsLock = new Object();
    @GuardedBy("mNetworkStatsLock")
@@ -2913,7 +2915,10 @@ public class StatsPullAtomService extends SystemService {
            HistoricalOps histOps = ops.get(EXTERNAL_STATS_SYNC_TIMEOUT_MILLIS,
                    TimeUnit.MILLISECONDS);
            if (mAppOpsSamplingRate == 0) {
                mAppOpsSamplingRate = constrain((5000 * 100) / estimateAppOpsSize(), 1, 100);
                int appOpsTargetCollectionSize = DeviceConfig.getInt(
                        DeviceConfig.NAMESPACE_PERMISSIONS, APP_OPS_TARGET_COLLECTION_SIZE, 5000);
                mAppOpsSamplingRate = constrain(
                        (appOpsTargetCollectionSize * 100) / estimateAppOpsSize(), 1, 100);
            }
            processHistoricalOps(histOps, atomTag, pulledData);
        } catch (Throwable t) {