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

Commit 5d89ef90 authored by Boxiang Pan's avatar Boxiang Pan Committed by Steve Kondik
Browse files

services: change default sampling interval to -1

Change default sampling interval to -1 to avoid sampling to resolve
power consumption issue. Original implement will keep UE wake up every
12 minutes, which will cause issue when doing power standby test.

Change-Id: I018e22a44259e94bce87ceaf04ff523f035183f8
parent 87de5efd
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -203,7 +203,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
    // Set network sampling interval at 12 minutes, this way, even if the timers get
    // Set network sampling interval at 12 minutes, this way, even if the timers get
    // aggregated, it will fire at around 15 minutes, which should allow us to
    // aggregated, it will fire at around 15 minutes, which should allow us to
    // aggregate this timer with other timers (specially the socket keep alive timers)
    // aggregate this timer with other timers (specially the socket keep alive timers)
    protected static final int DEFAULT_SAMPLING_INTERVAL_IN_SECONDS = (VDBG ? 30 : 12 * 60);

    // Set sampling interval to -1 by default to turn of sampling.
    protected static final int DEFAULT_SAMPLING_INTERVAL_IN_SECONDS = (VDBG ? 30 : -1 );


    // start network sampling a minute after booting ...
    // start network sampling a minute after booting ...
    protected static final int DEFAULT_START_SAMPLING_INTERVAL_IN_SECONDS = (VDBG ? 30 : 60);
    protected static final int DEFAULT_START_SAMPLING_INTERVAL_IN_SECONDS = (VDBG ? 30 : 60);
@@ -5130,10 +5132,16 @@ public class ConnectivityService extends IConnectivityManager.Stub {
                Settings.Global.CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS,
                Settings.Global.CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS,
                DEFAULT_SAMPLING_INTERVAL_IN_SECONDS);
                DEFAULT_SAMPLING_INTERVAL_IN_SECONDS);


        if (DBG) log("Setting timer for " + String.valueOf(samplingIntervalInSeconds) + "seconds");
        // Only setAlarm if CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS is set in
        // Settings.db or VDBG is true. Otherwise, DEFAULT_SAMPLING_INTERVAL_IN_SECONDS
        // is set to -1 by default.
        if ( samplingIntervalInSeconds > 0 ){
            if (DBG) log("Setting timer for " +
                         String.valueOf(samplingIntervalInSeconds) + "seconds");


            setAlarm(samplingIntervalInSeconds * 1000, mSampleIntervalElapsedIntent);
            setAlarm(samplingIntervalInSeconds * 1000, mSampleIntervalElapsedIntent);
        }
        }
    }


    protected void setAlarm(int timeoutInMilliseconds, PendingIntent intent) {
    protected void setAlarm(int timeoutInMilliseconds, PendingIntent intent) {
        long wakeupTime = SystemClock.elapsedRealtime() + timeoutInMilliseconds;
        long wakeupTime = SystemClock.elapsedRealtime() + timeoutInMilliseconds;