Merge "Add configuration for activity thumbnails" into klp-modular-dev
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 6ab9d38..199e5b1 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1508,4 +1508,6 @@
         <item>users</item>
     </string-array>
 
+    <bool name="config_networkSamplingWakesDevice">true</bool>
+
 </resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index b40dc88..79dcde9 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -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" />
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 8e08583..aa14da1 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -5038,8 +5038,18 @@
         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);
     }
 }