OSDN Git Service

Fix issue #2154688: when alarm rings ,device does not wake up...
authorDianne Hackborn <hackbod@google.com>
Thu, 1 Oct 2009 04:04:44 +0000 (21:04 -0700)
committerDianne Hackborn <hackbod@google.com>
Thu, 1 Oct 2009 04:04:44 +0000 (21:04 -0700)
...and can't see Dismiss and Snooze button if the device is on dock

Change-Id: Ib76b54f0a65930e142a3da1e1152f70d7f3ad3c7
Explanation: only the fullscreen alarm activity had the flags set to turn on
the screen and dismiss the lock screen.  The app picks whether to show
that one or the non-fullscreen one based on whether device is currently
locked, which is correct, but with the introduction of docks, locked
!= screen off.  In particular, the desk dock keeps the keyguard dismissed
while the device is in it.

The fix is to just set these flags for both alert activities.  That seems
generally right for many reasons.

src/com/android/alarmclock/AlarmAlert.java
src/com/android/alarmclock/AlarmAlertFullScreen.java

index 1543c03..89a866a 100644 (file)
@@ -78,6 +78,10 @@ public class AlarmAlert extends Activity {
         mVolumeBehavior = Integer.parseInt(vol);
 
         requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);
+        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
+                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
+                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
+                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
         updateLayout();
 
         // Register to get the alarm killed intent.
index 714262a..c00ffce 100644 (file)
@@ -28,10 +28,6 @@ public class AlarmAlertFullScreen extends AlarmAlert {
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
-                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
-                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
-                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
     }
     
     @Override