Remove unnecessary check canScheduleExactAlarms() as Settings always

has the permission.

Test: make RunSettingsRoboTests
Bug: 256123455
Change-Id: I5089494164581465da9533671fc414c7bee1196f
This commit is contained in:
Kuan Wang
2022-11-07 13:49:48 +08:00
parent fe26b89394
commit d81a6ceefd
4 changed files with 0 additions and 25 deletions

View File

@@ -73,10 +73,6 @@ public final class PeriodicJobManager {
// Cancels the previous alert job and schedules the next one.
final PendingIntent pendingIntent = getPendingIntent();
cancelJob(pendingIntent);
if (!canScheduleExactAlarms()) {
Log.w(TAG, "cannot schedule exact alarm job");
return;
}
// Uses UTC time to avoid scheduler is impacted by different timezone.
final long triggerAtMillis = getTriggerAtMillis(Clock.systemUTC());
mAlarmManager.setExactAndAllowWhileIdle(
@@ -111,13 +107,4 @@ public final class PeriodicJobManager {
broadcastIntent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
}
private boolean canScheduleExactAlarms() {
return canScheduleExactAlarms(mAlarmManager);
}
/** Whether we can schedule exact alarm or not? */
public static boolean canScheduleExactAlarms(AlarmManager alarmManager) {
return alarmManager.canScheduleExactAlarms();
}
}