Fix issue #3215261: NPE in WiFi Settings

And also fix #3343369: EGL_BAD_DISPLAY and/or broadcast intent
TIME_SET before boot completion

And a few more tweaks to animations to keep the wallpaper displayed
when needed.

And make more use of the drag and drop "rotation disabled" thing to
also use it while animating the screen rotation, since if we try to
start a new rotation while doing the animation we end up with a mess.

Change-Id: I373af305a6e23a92835abed96229a83e173f67ce
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java
index 4931cc7..5a36417 100644
--- a/services/java/com/android/server/AlarmManagerService.java
+++ b/services/java/com/android/server/AlarmManagerService.java
@@ -661,7 +661,8 @@
                     remove(mTimeTickSender);
                     mClockReceiver.scheduleTimeTickEvent();
                     Intent intent = new Intent(Intent.ACTION_TIME_CHANGED);
-                    intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+                    intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
+                            | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
                     mContext.sendBroadcast(intent);
                 }