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

Commit 419f2177 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 6f64e737: Merge "Fix issue #22612630: Ensure SMS/Call delivery during Doze" into mnc-dev

* commit '6f64e737':
  Fix issue #22612630: Ensure SMS/Call delivery during Doze
parents c6cd1f9a 6f64e737
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,5 +29,6 @@ interface IDeviceIdleController {
    boolean isPowerSaveWhitelistApp(String name);
    void addPowerSaveTempWhitelistApp(String name, long duration, int userId, String reason);
    long addPowerSaveTempWhitelistAppForMms(String name, int userId, String reason);
    long addPowerSaveTempWhitelistAppForSms(String name, int userId, String reason);
    void exitIdle(String reason);
}
+22 −0
Original line number Diff line number Diff line
@@ -253,6 +253,8 @@ public class DeviceIdleController extends SystemService
                "max_temp_app_whitelist_duration";
        private static final String KEY_MMS_TEMP_APP_WHITELIST_DURATION =
                "mms_temp_app_whitelist_duration";
        private static final String KEY_SMS_TEMP_APP_WHITELIST_DURATION =
                "sms_temp_app_whitelist_duration";

        /**
         * This is the time, after becoming inactive, at which we start looking at the
@@ -357,6 +359,13 @@ public class DeviceIdleController extends SystemService
         */
        public long MMS_TEMP_APP_WHITELIST_DURATION;

        /**
         * Amount of time we would like to whitelist an app that is receiving an SMS.
         * @see Settings.Global#DEVICE_IDLE_CONSTANTS
         * @see #KEY_SMS_TEMP_APP_WHITELIST_DURATION
         */
        public long SMS_TEMP_APP_WHITELIST_DURATION;

        private final ContentResolver mResolver;
        private final KeyValueListParser mParser = new KeyValueListParser(',');

@@ -410,6 +419,8 @@ public class DeviceIdleController extends SystemService
                        KEY_MAX_TEMP_APP_WHITELIST_DURATION, 5 * 60 * 1000L);
                MMS_TEMP_APP_WHITELIST_DURATION = mParser.getLong(
                        KEY_MMS_TEMP_APP_WHITELIST_DURATION, 60 * 1000L);
                SMS_TEMP_APP_WHITELIST_DURATION = mParser.getLong(
                        KEY_SMS_TEMP_APP_WHITELIST_DURATION, 20 * 1000L);
            }
        }

@@ -465,6 +476,10 @@ public class DeviceIdleController extends SystemService
            pw.print("    "); pw.print(KEY_MMS_TEMP_APP_WHITELIST_DURATION); pw.print("=");
            TimeUtils.formatDuration(MMS_TEMP_APP_WHITELIST_DURATION, pw);
            pw.println();

            pw.print("    "); pw.print(KEY_SMS_TEMP_APP_WHITELIST_DURATION); pw.print("=");
            TimeUtils.formatDuration(SMS_TEMP_APP_WHITELIST_DURATION, pw);
            pw.println();
        }
    }

@@ -617,6 +632,13 @@ public class DeviceIdleController extends SystemService
            return duration;
        }

        @Override public long addPowerSaveTempWhitelistAppForSms(String packageName,
                int userId, String reason) throws RemoteException {
            long duration = mConstants.SMS_TEMP_APP_WHITELIST_DURATION;
            addPowerSaveTempWhitelistApp(packageName, duration, userId, reason);
            return duration;
        }

        @Override public void exitIdle(String reason) {
            getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
                    null);