Merge "Removing unused alarm config crash_non_clock_apps"

This commit is contained in:
TreeHugger Robot
2022-07-07 04:47:06 +00:00
committed by Android (Google) Code Review
2 changed files with 1 additions and 26 deletions

View File

@@ -687,8 +687,6 @@ public class AlarmManagerService extends SystemService {
@VisibleForTesting
static final String KEY_ALLOW_WHILE_IDLE_COMPAT_WINDOW = "allow_while_idle_compat_window";
@VisibleForTesting
static final String KEY_CRASH_NON_CLOCK_APPS = "crash_non_clock_apps";
@VisibleForTesting
static final String KEY_PRIORITY_ALARM_DELAY = "priority_alarm_delay";
@VisibleForTesting
@@ -737,8 +735,6 @@ public class AlarmManagerService extends SystemService {
private static final long DEFAULT_ALLOW_WHILE_IDLE_WINDOW = 60 * 60 * 1000; // 1 hour.
private static final long DEFAULT_ALLOW_WHILE_IDLE_COMPAT_WINDOW = 9 * 60 * 1000; // 9 mins.
private static final boolean DEFAULT_CRASH_NON_CLOCK_APPS = true;
private static final long DEFAULT_PRIORITY_ALARM_DELAY = 9 * 60_000;
private static final long DEFAULT_MIN_DEVICE_IDLE_FUZZ = 2 * 60_000;
@@ -796,13 +792,6 @@ public class AlarmManagerService extends SystemService {
*/
public long ALLOW_WHILE_IDLE_WINDOW = DEFAULT_ALLOW_WHILE_IDLE_WINDOW;
/**
* Whether or not to crash callers that use setExactAndAllowWhileIdle or setAlarmClock
* but don't hold the required permission. This is useful to catch broken
* apps and reverting to a softer failure in case of broken apps.
*/
public boolean CRASH_NON_CLOCK_APPS = DEFAULT_CRASH_NON_CLOCK_APPS;
/**
* Minimum delay between two slots that an app can get for their prioritized alarms, while
* the device is in doze.
@@ -997,10 +986,6 @@ public class AlarmManagerService extends SystemService {
KEY_TIME_TICK_ALLOWED_WHILE_IDLE,
DEFAULT_TIME_TICK_ALLOWED_WHILE_IDLE);
break;
case KEY_CRASH_NON_CLOCK_APPS:
CRASH_NON_CLOCK_APPS = properties.getBoolean(KEY_CRASH_NON_CLOCK_APPS,
DEFAULT_CRASH_NON_CLOCK_APPS);
break;
case KEY_PRIORITY_ALARM_DELAY:
PRIORITY_ALARM_DELAY = properties.getLong(KEY_PRIORITY_ALARM_DELAY,
DEFAULT_PRIORITY_ALARM_DELAY);
@@ -1258,9 +1243,6 @@ public class AlarmManagerService extends SystemService {
pw.print(KEY_TIME_TICK_ALLOWED_WHILE_IDLE, TIME_TICK_ALLOWED_WHILE_IDLE);
pw.println();
pw.print(KEY_CRASH_NON_CLOCK_APPS, CRASH_NON_CLOCK_APPS);
pw.println();
pw.print(KEY_PRIORITY_ALARM_DELAY);
pw.print("=");
TimeUtils.formatDuration(PRIORITY_ALARM_DELAY, pw);
@@ -2908,11 +2890,7 @@ public class AlarmManagerService extends SystemService {
+ Manifest.permission.SCHEDULE_EXACT_ALARM + " or "
+ Manifest.permission.USE_EXACT_ALARM + " to set "
+ "exact alarms.";
if (mConstants.CRASH_NON_CLOCK_APPS) {
throw new SecurityException(errorMessage);
} else {
Slog.wtf(TAG, errorMessage);
}
throw new SecurityException(errorMessage);
}
// If the app is on the full system power allow-list (not except-idle),
// or the user-elected allow-list, or we're in a soft failure mode, we still

View File

@@ -73,7 +73,6 @@ import static com.android.server.alarm.AlarmManagerService.Constants.KEY_ALLOW_W
import static com.android.server.alarm.AlarmManagerService.Constants.KEY_ALLOW_WHILE_IDLE_QUOTA;
import static com.android.server.alarm.AlarmManagerService.Constants.KEY_ALLOW_WHILE_IDLE_WHITELIST_DURATION;
import static com.android.server.alarm.AlarmManagerService.Constants.KEY_ALLOW_WHILE_IDLE_WINDOW;
import static com.android.server.alarm.AlarmManagerService.Constants.KEY_CRASH_NON_CLOCK_APPS;
import static com.android.server.alarm.AlarmManagerService.Constants.KEY_EXACT_ALARM_DENY_LIST;
import static com.android.server.alarm.AlarmManagerService.Constants.KEY_LAZY_BATCHING;
import static com.android.server.alarm.AlarmManagerService.Constants.KEY_LISTENER_TIMEOUT;
@@ -2424,7 +2423,6 @@ public class AlarmManagerServiceTest {
@Test
public void alarmClockBinderCallWithoutPermission() throws RemoteException {
setDeviceConfigBoolean(KEY_CRASH_NON_CLOCK_APPS, true);
mockChangeEnabled(AlarmManager.REQUIRE_EXACT_ALARM_PERMISSION, true);
mockScheduleExactAlarmState(true, false, MODE_ERRORED);
@@ -2593,7 +2591,6 @@ public class AlarmManagerServiceTest {
@Test
public void exactBinderCallsWithoutPermissionWithoutAllowlist() throws RemoteException {
setDeviceConfigBoolean(KEY_CRASH_NON_CLOCK_APPS, true);
mockChangeEnabled(AlarmManager.REQUIRE_EXACT_ALARM_PERMISSION, true);
mockScheduleExactAlarmState(true, false, MODE_ERRORED);