Merge "Fix issue #22612630: Ensure SMS/Call delivery during Doze" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6f64e737f0
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user