OSDN Git Service

Asynchronously handle TIME_TICK to not block the broadcast.
[android-x86/packages-apps-DeskClock.git] / src / com / android / deskclock / DigitalClock.java
index 38ed91b..69a7156 100644 (file)
@@ -58,7 +58,12 @@ public class DigitalClock extends LinearLayout {
                             Intent.ACTION_TIMEZONE_CHANGED)) {
                     mCalendar = Calendar.getInstance();
                 }
-                updateTime();
+                // Post a runnable to avoid blocking the broadcast.
+                mHandler.post(new Runnable() {
+                        public void run() {
+                            updateTime();
+                        }
+                });
             }
         };
 
@@ -131,7 +136,7 @@ public class DigitalClock extends LinearLayout {
             filter.addAction(Intent.ACTION_TIME_TICK);
             filter.addAction(Intent.ACTION_TIME_CHANGED);
             filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
-            mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
+            mContext.registerReceiver(mIntentReceiver, filter);
         }
 
         /* monitor 12/24-hour display preference */