BatteryService: Fix problems shutting down when the battery is dead:

Wait until system is booted before attempting to display the shutdown dialog.
Use ShutdownActivity rather than attempting to run ShutdownThread in the battery service.
Fix logic error (check !isPowered() instead of isPowered())

Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index c30386e..8919ccc 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -84,6 +84,7 @@
 
         HardwareService hardware = null;
         PowerManagerService power = null;
+        BatteryService battery = null;
         IPackageManager pm = null;
         Context context = null;
         WindowManagerService wm = null;
@@ -132,7 +133,7 @@
             ActivityManagerService.installSystemProviders();
 
             Log.i(TAG, "Starting Battery Service.");
-            BatteryService battery = new BatteryService(context);
+            battery = new BatteryService(context);
             ServiceManager.addService("battery", battery);
 
             Log.i(TAG, "Starting Hardware Service.");
@@ -380,6 +381,7 @@
         } catch (RemoteException e) {
         }
 
+        battery.systemReady();
         Watchdog.getInstance().start();
 
         Looper.loop();