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

Commit 015438cc authored by Kate Montgomery's avatar Kate Montgomery Committed by Automerger Merge Worker
Browse files

Merge "Do not specify a workSource when setting a delayed alarm so that the...

Merge "Do not specify a workSource when setting a delayed alarm so that the alarm can still wake the device up when the device is idle as the AlarmManager.FLAG_ALLOW_WHILE_IDLE_UNRESTRICTED flag indicates." into sc-dev am: 831f52e0 am: 12e040c1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15284032

Change-Id: Ibbf1737d40f9a5ccb76fd333667da35930b1161e
parents 7a7a02b3 12e040c1
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ public abstract class AlarmHelper {
            WorkSource workSource) {
        // helps ensure that we're not wasting system resources by setting alarms in the past/now
        Preconditions.checkArgument(delayMs > 0);
        Preconditions.checkArgument(workSource != null);
        setDelayedAlarmInternal(delayMs, listener, workSource);
    }

+15 −3
Original line number Diff line number Diff line
@@ -735,8 +735,12 @@ public class LocationProviderManager extends
            if (mExpirationRealtimeMs <= registerTimeMs) {
                onAlarm();
            } else if (mExpirationRealtimeMs < Long.MAX_VALUE) {
                // Set WorkSource to null in order to ensure the alarm wakes up the device even when
                // it is idle. Do this when the cost of waking up the device is less than the power
                // cost of not performing the actions set off by the alarm, such as unregistering a
                // location request.
                mAlarmHelper.setDelayedAlarm(mExpirationRealtimeMs - registerTimeMs, this,
                        getRequest().getWorkSource());
                        null);
            }

            // start listening for provider enabled/disabled events
@@ -1122,8 +1126,12 @@ public class LocationProviderManager extends
            if (mExpirationRealtimeMs <= registerTimeMs) {
                onAlarm();
            } else if (mExpirationRealtimeMs < Long.MAX_VALUE) {
                // Set WorkSource to null in order to ensure the alarm wakes up the device even when
                // it is idle. Do this when the cost of waking up the device is less than the power
                // cost of not performing the actions set off by the alarm, such as unregistering a
                // location request.
                mAlarmHelper.setDelayedAlarm(mExpirationRealtimeMs - registerTimeMs, this,
                        getRequest().getWorkSource());
                        null);
            }
        }

@@ -1995,7 +2003,11 @@ public class LocationProviderManager extends
                    }
                }
            };
            mAlarmHelper.setDelayedAlarm(delayMs, mDelayedRegister, newRequest.getWorkSource());
            // Set WorkSource to null in order to ensure the alarm wakes up the device even when it
            // is idle. Do this when the cost of waking up the device is less than the power cost of
            // not performing the actions set off by the alarm, such as unregistering a location
            // request.
            mAlarmHelper.setDelayedAlarm(delayMs, mDelayedRegister, null);
        }

        return true;