summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sudheer Shanka <sudheersai@google.com> 2019-01-29 23:19:45 -0800
committer Sudheer Shanka <sudheersai@google.com> 2019-01-30 10:34:11 -0800
commitff585078ced8ee47c3a78057d8b31ecffd8b2a98 (patch)
tree84843c197aad2d2b806b51659a3dbe10711b75f1
parentbd8c27ee3614cc3df761e70d516daf9d11d65248 (diff)
Fix NPE in StorageManagerService.
Initialize mIPackageManager and mAppOpsService, which are needed for getting mountmode of a process, early in the boot cycle. Bug: 123317136 Test: device boots with no crashes Change-Id: Iced974fe0ecb8f738a8f8fe024dc71bb5828289c
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index cecd55a325d3..f2329d3ebf8e 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -1541,10 +1541,6 @@ class StorageManagerService extends IStorageManager.Stub
mCallbacks = new Callbacks(FgThread.get().getLooper());
mLockPatternUtils = new LockPatternUtils(mContext);
- mPmInternal = LocalServices.getService(PackageManagerInternal.class);
- mUmInternal = LocalServices.getService(UserManagerInternal.class);
- mAmInternal = LocalServices.getService(ActivityManagerInternal.class);
-
HandlerThread hthread = new HandlerThread(TAG);
hthread.start();
mHandler = new StorageManagerServiceHandler(hthread.getLooper());
@@ -1662,6 +1658,19 @@ class StorageManagerService extends IStorageManager.Stub
}
private void servicesReady() {
+ mPmInternal = LocalServices.getService(PackageManagerInternal.class);
+ mUmInternal = LocalServices.getService(UserManagerInternal.class);
+ mAmInternal = LocalServices.getService(ActivityManagerInternal.class);
+
+ mIPackageManager = IPackageManager.Stub.asInterface(
+ ServiceManager.getService("package"));
+ mIAppOpsService = IAppOpsService.Stub.asInterface(
+ ServiceManager.getService(Context.APP_OPS_SERVICE));
+ try {
+ mIAppOpsService.startWatchingMode(OP_REQUEST_INSTALL_PACKAGES, null, mAppOpsCallback);
+ } catch (RemoteException e) {
+ }
+
synchronized (mLock) {
final boolean thisIsolatedStorage = StorageManager.hasIsolatedStorage();
if (mLastIsolatedStorage == thisIsolatedStorage) {
@@ -1734,14 +1743,6 @@ class StorageManagerService extends IStorageManager.Stub
.registerScreenObserver(this);
mSystemReady = true;
- mIPackageManager = IPackageManager.Stub.asInterface(
- ServiceManager.getService("package"));
- mIAppOpsService = IAppOpsService.Stub.asInterface(
- ServiceManager.getService(Context.APP_OPS_SERVICE));
- try {
- mIAppOpsService.startWatchingMode(OP_REQUEST_INSTALL_PACKAGES, null, mAppOpsCallback);
- } catch (RemoteException e) {
- }
mHandler.obtainMessage(H_SYSTEM_READY).sendToTarget();
}