Bug 846203 - the user activity timer will be reset when the Wakelock is released(for Android). r=snorp
authorFarmer Tseng <fatseng@mozilla.com>
Mon, 05 Sep 2016 16:52:18 +0800
changeset 313038 ac84db1c2d367b9bbccbb06c2c204b293b7c39e7
parent 313037 89d3a48ed4720c32f24634ccc07713bc8600f2b0
child 313039 787d895935668086fb3cb693052abb48f7040759
push id20479
push userkwierso@gmail.com
push dateThu, 08 Sep 2016 01:08:46 +0000
treeherderfx-team@fb7c6b034329 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs846203
milestone51.0a1
Bug 846203 - the user activity timer will be reset when the Wakelock is released(for Android). r=snorp MozReview-Commit-ID: 8GN81YzNjGM
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -2568,17 +2568,19 @@ public abstract class GeckoApp
     public void notifyWakeLockChanged(String topic, String state) {
         PowerManager.WakeLock wl = mWakeLocks.get(topic);
         if (state.equals("locked-foreground") && wl == null) {
             PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
 
             if (CPU.equals(topic)) {
               wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, topic);
             } else if (SCREEN.equals(topic)) {
-              wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, topic);
+              // ON_AFTER_RELEASE is set, the user activity timer will be reset when the
+              // WakeLock is released, causing the illumination to remain on a bit longer.
+              wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, topic);
             }
 
             if (wl != null) {
               wl.acquire();
               mWakeLocks.put(topic, wl);
             }
         } else if (!state.equals("locked-foreground") && wl != null) {
             wl.release();