Merge "Fix issue #29069028 NYC: device boot failure: NPE in AppIdleController" into nyc-dev
diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java
index 5e212b0..899aada 100644
--- a/services/core/java/com/android/server/job/JobSchedulerService.java
+++ b/services/core/java/com/android/server/job/JobSchedulerService.java
@@ -717,6 +717,11 @@
      */
     public JobSchedulerService(Context context) {
         super(context);
+        mHandler = new JobHandler(context.getMainLooper());
+        mConstants = new Constants(mHandler);
+        mJobSchedulerStub = new JobSchedulerStub();
+        mJobs = JobStore.initAndGet(this);
+
         // Create the controllers.
         mControllers = new ArrayList<StateController>();
         mControllers.add(ConnectivityController.get(this));
@@ -726,11 +731,6 @@
         mControllers.add(AppIdleController.get(this));
         mControllers.add(ContentObserverController.get(this));
         mControllers.add(DeviceIdleJobsController.get(this));
-
-        mHandler = new JobHandler(context.getMainLooper());
-        mConstants = new Constants(mHandler);
-        mJobSchedulerStub = new JobSchedulerStub();
-        mJobs = JobStore.initAndGet(this);
     }
 
     @Override