Ensure ActivityManagerInternal instance is non-null

Pulling up the initialization to avoid having earlier code
run into uses of mActivityManagerInternal.

Bug: 283724099

Test: Manual.
Change-Id: I910993401915bc67af73bc7ad3e68a6a76df8026
This commit is contained in:
gang.huang
2023-05-22 15:44:55 +08:00
parent 61dae34432
commit 683bb56f33

View File

@@ -1882,6 +1882,7 @@ public class AlarmManagerService extends SystemService {
mActivityOptsRestrictBal.setPendingIntentBackgroundActivityLaunchAllowed(false);
mBroadcastOptsRestrictBal.setPendingIntentBackgroundActivityLaunchAllowed(false);
mMetricsHelper = new MetricsHelper(getContext(), mLock);
mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
mListenerDeathRecipient = new IBinder.DeathRecipient() {
@Override
@@ -1983,7 +1984,6 @@ public class AlarmManagerService extends SystemService {
Slog.w(TAG, "Failed to open alarm driver. Falling back to a handler.");
}
}
mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
publishLocalService(AlarmManagerInternal.class, new LocalService());
publishBinderService(Context.ALARM_SERVICE, mService);
}