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

Commit d2b5f7da authored by Aaron Whyte's avatar Aaron Whyte Committed by Android Git Automerger
Browse files

am f5e67474: Allow overlays to configure ConnectivityService\'s network...

am f5e67474: Allow overlays to configure ConnectivityService\'s network sampling to not wake the device. This can increase clockwork device battery life. Bug:15455204

* commit 'f5e67474':
  Allow overlays to configure ConnectivityService's network sampling to not wake the device. This can increase clockwork device battery life. Bug:15455204
parents 245c4f61 f5e67474
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1505,4 +1505,6 @@
        <item>users</item>
    </string-array>

    <bool name="config_networkSamplingWakesDevice">true</bool>

</resources>
+1 −0
Original line number Diff line number Diff line
@@ -258,6 +258,7 @@
  <java-symbol type="bool" name="config_enable_emergency_call_while_sim_locked" />
  <java-symbol type="bool" name="config_enable_puk_unlock_screen" />
  <java-symbol type="bool" name="config_mms_content_disposition_support" />
  <java-symbol type="bool" name="config_networkSamplingWakesDevice" />
  <java-symbol type="bool" name="config_showMenuShortcutsWhenKeyboardPresent" />
  <java-symbol type="bool" name="config_sip_wifi_only" />
  <java-symbol type="bool" name="config_sms_capable" />
+11 −1
Original line number Diff line number Diff line
@@ -5038,8 +5038,18 @@ public class ConnectivityService extends IConnectivityManager.Stub {
        setAlarm(samplingIntervalInSeconds * 1000, mSampleIntervalElapsedIntent);
    }

    /**
     * Sets a network sampling alarm.
     */
    void setAlarm(int timeoutInMilliseconds, PendingIntent intent) {
        long wakeupTime = SystemClock.elapsedRealtime() + timeoutInMilliseconds;
        mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, wakeupTime, intent);
        int alarmType;
        if (Resources.getSystem().getBoolean(
                R.bool.config_networkSamplingWakesDevice)) {
            alarmType = AlarmManager.ELAPSED_REALTIME_WAKEUP;
        } else {
            alarmType = AlarmManager.ELAPSED_REALTIME;
        }
        mAlarmManager.set(alarmType, wakeupTime, intent);
    }
}