diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 8ab0b931be11f..bf267a2a40a56 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -391,11 +391,14 @@ public class InputManagerService extends IInputManager.Stub @VisibleForTesting InputManagerService(Injector injector) { + // The static association map is accessed by both java and native code, so it must be + // initialized before initializing the native service. + mStaticAssociations = loadStaticInputPortAssociations(); + mContext = injector.getContext(); mHandler = new InputManagerHandler(injector.getLooper()); mNative = injector.getNativeService(this); - mStaticAssociations = loadStaticInputPortAssociations(); mUseDevInputEventForAudioJack = mContext.getResources().getBoolean(R.bool.config_useDevInputEventForAudioJack); Slog.i(TAG, "Initializing input manager, mUseDevInputEventForAudioJack="