Fix issue #29069028 NYC: device boot failure: NPE in AppIdleController

Make sure the core parts of JobSchedulerService are initialized
before we start creating the controllers.

Change-Id: I497df12f7e6fbd93581291ec691c4b45104d67d0
This commit is contained in:
Dianne Hackborn
2016-06-01 10:55:13 -07:00
parent 438693dd6c
commit 970e3f412d

View File

@@ -717,6 +717,11 @@ public final class JobSchedulerService extends com.android.server.SystemService
*/
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 @@ public final class JobSchedulerService extends com.android.server.SystemService
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