Loading core/java/android/hardware/input/InputManager.java +9 −12 Original line number Original line Diff line number Diff line Loading @@ -48,8 +48,6 @@ import android.os.Looper; import android.os.Message; import android.os.Message; import android.os.Process; import android.os.Process; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; import android.os.SystemClock; import android.os.SystemClock; import android.os.VibrationEffect; import android.os.VibrationEffect; import android.os.Vibrator; import android.os.Vibrator; Loading Loading @@ -305,8 +303,11 @@ public final class InputManager { private static String sVelocityTrackerStrategy; private static String sVelocityTrackerStrategy; private InputManager(IInputManager im) { private InputManagerGlobal mGlobal; mIm = im; private InputManager() { mGlobal = InputManagerGlobal.getInstance(); mIm = mGlobal.getInputManagerService(); try { try { sVelocityTrackerStrategy = mIm.getVelocityTrackerStrategy(); sVelocityTrackerStrategy = mIm.getVelocityTrackerStrategy(); } catch (RemoteException ex) { } catch (RemoteException ex) { Loading @@ -324,7 +325,8 @@ public final class InputManager { @VisibleForTesting @VisibleForTesting public static InputManager resetInstance(IInputManager inputManagerService) { public static InputManager resetInstance(IInputManager inputManagerService) { synchronized (InputManager.class) { synchronized (InputManager.class) { sInstance = new InputManager(inputManagerService); InputManagerGlobal.resetInstance(inputManagerService); sInstance = new InputManager(); return sInstance; return sInstance; } } } } Loading @@ -337,6 +339,7 @@ public final class InputManager { @VisibleForTesting @VisibleForTesting public static void clearInstance() { public static void clearInstance() { synchronized (InputManager.class) { synchronized (InputManager.class) { InputManagerGlobal.clearInstance(); sInstance = null; sInstance = null; } } } } Loading Loading @@ -364,13 +367,7 @@ public final class InputManager { public static InputManager getInstance(Context context) { public static InputManager getInstance(Context context) { synchronized (InputManager.class) { synchronized (InputManager.class) { if (sInstance == null) { if (sInstance == null) { try { sInstance = new InputManager(); sInstance = new InputManager(IInputManager.Stub .asInterface(ServiceManager.getServiceOrThrow(Context.INPUT_SERVICE))); } catch (ServiceNotFoundException e) { throw new IllegalStateException(e); } } } if (sInstance.mWeakContext == null || sInstance.mWeakContext.get() == null) { if (sInstance.mWeakContext == null || sInstance.mWeakContext.get() == null) { sInstance.mWeakContext = new WeakReference(context); sInstance.mWeakContext = new WeakReference(context); Loading core/java/android/hardware/input/InputManagerGlobal.java 0 → 100644 +82 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware.input; import android.content.Context; import android.os.IBinder; import android.os.ServiceManager; /** * Manages communication with the input manager service on behalf of * an application process. You're probably looking for {@link InputManager}. * * @hide */ public final class InputManagerGlobal { private static final String TAG = "InputManagerGlobal"; private static InputManagerGlobal sInstance; private final IInputManager mIm; public InputManagerGlobal(IInputManager im) { mIm = im; } /** * Gets an instance of the input manager global singleton. * * @return The display manager instance, may be null early in system startup * before the display manager has been fully initialized. */ public static InputManagerGlobal getInstance() { synchronized (InputManagerGlobal.class) { if (sInstance == null) { IBinder b = ServiceManager.getService(Context.INPUT_SERVICE); if (b != null) { sInstance = new InputManagerGlobal(IInputManager.Stub.asInterface(b)); } } return sInstance; } } public IInputManager getInputManagerService() { return mIm; } /** * Gets an instance of the input manager. * * @return The input manager instance. */ public static InputManagerGlobal resetInstance(IInputManager inputManagerService) { synchronized (InputManager.class) { sInstance = new InputManagerGlobal(inputManagerService); return sInstance; } } /** * Clear the instance of the input manager. */ public static void clearInstance() { synchronized (InputManagerGlobal.class) { sInstance = null; } } } Loading
core/java/android/hardware/input/InputManager.java +9 −12 Original line number Original line Diff line number Diff line Loading @@ -48,8 +48,6 @@ import android.os.Looper; import android.os.Message; import android.os.Message; import android.os.Process; import android.os.Process; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; import android.os.SystemClock; import android.os.SystemClock; import android.os.VibrationEffect; import android.os.VibrationEffect; import android.os.Vibrator; import android.os.Vibrator; Loading Loading @@ -305,8 +303,11 @@ public final class InputManager { private static String sVelocityTrackerStrategy; private static String sVelocityTrackerStrategy; private InputManager(IInputManager im) { private InputManagerGlobal mGlobal; mIm = im; private InputManager() { mGlobal = InputManagerGlobal.getInstance(); mIm = mGlobal.getInputManagerService(); try { try { sVelocityTrackerStrategy = mIm.getVelocityTrackerStrategy(); sVelocityTrackerStrategy = mIm.getVelocityTrackerStrategy(); } catch (RemoteException ex) { } catch (RemoteException ex) { Loading @@ -324,7 +325,8 @@ public final class InputManager { @VisibleForTesting @VisibleForTesting public static InputManager resetInstance(IInputManager inputManagerService) { public static InputManager resetInstance(IInputManager inputManagerService) { synchronized (InputManager.class) { synchronized (InputManager.class) { sInstance = new InputManager(inputManagerService); InputManagerGlobal.resetInstance(inputManagerService); sInstance = new InputManager(); return sInstance; return sInstance; } } } } Loading @@ -337,6 +339,7 @@ public final class InputManager { @VisibleForTesting @VisibleForTesting public static void clearInstance() { public static void clearInstance() { synchronized (InputManager.class) { synchronized (InputManager.class) { InputManagerGlobal.clearInstance(); sInstance = null; sInstance = null; } } } } Loading Loading @@ -364,13 +367,7 @@ public final class InputManager { public static InputManager getInstance(Context context) { public static InputManager getInstance(Context context) { synchronized (InputManager.class) { synchronized (InputManager.class) { if (sInstance == null) { if (sInstance == null) { try { sInstance = new InputManager(); sInstance = new InputManager(IInputManager.Stub .asInterface(ServiceManager.getServiceOrThrow(Context.INPUT_SERVICE))); } catch (ServiceNotFoundException e) { throw new IllegalStateException(e); } } } if (sInstance.mWeakContext == null || sInstance.mWeakContext.get() == null) { if (sInstance.mWeakContext == null || sInstance.mWeakContext.get() == null) { sInstance.mWeakContext = new WeakReference(context); sInstance.mWeakContext = new WeakReference(context); Loading
core/java/android/hardware/input/InputManagerGlobal.java 0 → 100644 +82 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware.input; import android.content.Context; import android.os.IBinder; import android.os.ServiceManager; /** * Manages communication with the input manager service on behalf of * an application process. You're probably looking for {@link InputManager}. * * @hide */ public final class InputManagerGlobal { private static final String TAG = "InputManagerGlobal"; private static InputManagerGlobal sInstance; private final IInputManager mIm; public InputManagerGlobal(IInputManager im) { mIm = im; } /** * Gets an instance of the input manager global singleton. * * @return The display manager instance, may be null early in system startup * before the display manager has been fully initialized. */ public static InputManagerGlobal getInstance() { synchronized (InputManagerGlobal.class) { if (sInstance == null) { IBinder b = ServiceManager.getService(Context.INPUT_SERVICE); if (b != null) { sInstance = new InputManagerGlobal(IInputManager.Stub.asInterface(b)); } } return sInstance; } } public IInputManager getInputManagerService() { return mIm; } /** * Gets an instance of the input manager. * * @return The input manager instance. */ public static InputManagerGlobal resetInstance(IInputManager inputManagerService) { synchronized (InputManager.class) { sInstance = new InputManagerGlobal(inputManagerService); return sInstance; } } /** * Clear the instance of the input manager. */ public static void clearInstance() { synchronized (InputManagerGlobal.class) { sInstance = null; } } }