auto import from //branches/cupcake/...@132276
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index d624573..fc25e38 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -181,6 +181,7 @@
 
         StatusBarService statusBar = null;
         InputMethodManagerService imm = null;
+        GadgetService gadget = null;
 
         if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
             try {
@@ -309,7 +310,8 @@
 
             try {
                 Log.i(TAG, "Starting Gadget Service");
-                ServiceManager.addService(Context.GADGET_SERVICE, new GadgetService(context));
+                gadget = new GadgetService(context);
+                ServiceManager.addService(Context.GADGET_SERVICE, gadget);
             } catch (Throwable e) {
                 Log.e(TAG, "Failure starting Gadget Service", e);
             }
@@ -337,6 +339,9 @@
             pm.systemReady();
         } catch (RemoteException e) {
         }
+        if (gadget != null) {
+            gadget.systemReady(safeMode);
+        }
 
         // After making the following code, third party code may be running...
         try {