@Override
protected void onStart() {
- super.onResume();
+ super.onStart();
if (Log.LOGV) Log.v("AlarmAlert.onStart()");
- // Acquire a separate lock for the screen to stay on. This is necessary
- // to avoid flashing the keyguard when the screen is locked.
+ // Acquire a separate lock for the screen to stay on.
AlarmAlertWakeLock.acquireScreenWakeLock(this);
}
@Override
protected void onStop() {
- super.onPause();
+ super.onStop();
if (Log.LOGV) Log.v("AlarmAlert.onStop()");
AlarmAlertWakeLock.releaseScreenLock();
}
return;
}
+ // Maintain a cpu wake lock until the AlarmAlert and AlarmKlaxon can
+ // pick it up. Also acquire the screen lock so the screen is on before
+ // starting the AlarmAlert activity. Do this before launching the
+ // AlarmAlert so that the ActivityManager does not try to pause the
+ // activity due to the screen being off.
+ AlarmAlertWakeLock.acquireCpuWakeLock(context);
+ AlarmAlertWakeLock.acquireScreenWakeLock(context);
+
/* Close dialogs and window shade */
Intent closeDialogs = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
context.sendBroadcast(closeDialogs);
// correct notification.
NotificationManager nm = getNotificationManager(context);
nm.notify(alarm.id, n);
-
- // Maintain a cpu wake lock until the AlarmAlert and AlarmKlaxon can
- // pick it up.
- AlarmAlertWakeLock.acquireCpuWakeLock(context);
}
private NotificationManager getNotificationManager(Context context) {