Loading services/core/java/com/android/server/input/InputManagerService.java +9 −3 Original line number Diff line number Diff line Loading @@ -1810,8 +1810,9 @@ public class InputManagerService extends IInputManager.Stub } // Native callback. private long notifyANR(IBinder token, String reason) { return mWindowManagerCallbacks.notifyANR( private long notifyANR(InputApplicationHandle inputApplicationHandle, IBinder token, String reason) { return mWindowManagerCallbacks.notifyANR(inputApplicationHandle, token, reason); } Loading Loading @@ -2055,7 +2056,12 @@ public class InputManagerService extends IInputManager.Stub public void notifyInputChannelBroken(IBinder token); public long notifyANR(IBinder token, String reason); /** * Notifies the window manager about an application that is not responding. * Returns a new timeout to continue waiting in nanoseconds, or 0 to abort dispatch. */ long notifyANR(InputApplicationHandle inputApplicationHandle, IBinder token, String reason); public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); Loading services/core/java/com/android/server/wm/ActivityRecord.java +2 −1 Original line number Diff line number Diff line Loading @@ -376,6 +376,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * Value to increment the z-layer when boosting a layer during animations. BOOST in l33tsp34k. */ @VisibleForTesting static final int Z_BOOST_BASE = 800570000; static final int INVALID_PID = -1; final ActivityTaskManagerService mAtmService; final ActivityInfo info; // activity info provided by developer in AndroidManifest Loading Loading @@ -5313,7 +5314,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A anrActivity = getWaitingHistoryRecordLocked(); anrApp = app; windowFromSameProcessAsActivity = !hasProcess() || app.getPid() == windowPid || windowPid == -1; !hasProcess() || app.getPid() == windowPid || windowPid == INVALID_PID; } if (windowFromSameProcessAsActivity) { Loading services/core/java/com/android/server/wm/InputManagerCallback.java +9 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static com.android.server.wm.ActivityRecord.INVALID_PID; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_INPUT; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; Loading @@ -14,6 +15,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.util.Slog; import android.view.IWindow; import android.view.InputApplicationHandle; import android.view.KeyEvent; import android.view.WindowManager; Loading Loading @@ -80,7 +82,8 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal * Called by the InputManager. */ @Override public long notifyANR(IBinder token, String reason) { public long notifyANR(InputApplicationHandle inputApplicationHandle, IBinder token, String reason) { ActivityRecord activity = null; WindowState windowState = null; boolean aboveSystem = false; Loading @@ -93,6 +96,10 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal } } if (activity == null && inputApplicationHandle != null) { activity = ActivityRecord.forTokenLocked(inputApplicationHandle.token); } if (windowState != null) { Slog.i(TAG_WM, "Input event dispatching timed out " + "sending to " + windowState.mAttrs.getTitle() Loading Loading @@ -122,7 +129,7 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal // Notify the activity manager about the timeout and let it decide whether // to abort dispatching or keep waiting. final boolean abort = activity.keyDispatchingTimedOut(reason, windowState.mSession.mPid); (windowState != null) ? windowState.mSession.mPid : INVALID_PID); if (!abort) { // The activity manager declined to abort dispatching. // Wait a bit longer and timeout again later. Loading services/core/jni/com_android_server_input_InputManagerService.cpp +18 −3 Original line number Diff line number Diff line Loading @@ -709,6 +709,18 @@ void NativeInputManager::notifyConfigurationChanged(nsecs_t when) { checkAndClearExceptionFromCallback(env, "notifyConfigurationChanged"); } static jobject getInputApplicationHandleObjLocalRef(JNIEnv* env, const sp<InputApplicationHandle>& inputApplicationHandle) { if (inputApplicationHandle == nullptr) { return nullptr; } NativeInputApplicationHandle* handle = static_cast<NativeInputApplicationHandle*>(inputApplicationHandle.get()); return handle->getInputApplicationHandleObjLocalRef(env); } nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY Loading @@ -719,11 +731,14 @@ nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApp JNIEnv* env = jniEnv(); ScopedLocalFrame localFrame(env); jobject inputApplicationHandleObj = getInputApplicationHandleObjLocalRef(env, inputApplicationHandle); jobject tokenObj = javaObjectForIBinder(env, token); jstring reasonObj = env->NewStringUTF(reason.c_str()); jlong newTimeout = env->CallLongMethod(mServiceObj, gServiceClassInfo.notifyANR, tokenObj, gServiceClassInfo.notifyANR, inputApplicationHandleObj, tokenObj, reasonObj); if (checkAndClearExceptionFromCallback(env, "notifyANR")) { newTimeout = 0; // abort dispatch Loading Loading @@ -1865,7 +1880,7 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gServiceClassInfo.notifyANR, clazz, "notifyANR", "(Landroid/os/IBinder;Ljava/lang/String;)J"); "(Landroid/view/InputApplicationHandle;Landroid/os/IBinder;Ljava/lang/String;)J"); GET_METHOD_ID(gServiceClassInfo.filterInputEvent, clazz, "filterInputEvent", "(Landroid/view/InputEvent;I)Z"); Loading Loading
services/core/java/com/android/server/input/InputManagerService.java +9 −3 Original line number Diff line number Diff line Loading @@ -1810,8 +1810,9 @@ public class InputManagerService extends IInputManager.Stub } // Native callback. private long notifyANR(IBinder token, String reason) { return mWindowManagerCallbacks.notifyANR( private long notifyANR(InputApplicationHandle inputApplicationHandle, IBinder token, String reason) { return mWindowManagerCallbacks.notifyANR(inputApplicationHandle, token, reason); } Loading Loading @@ -2055,7 +2056,12 @@ public class InputManagerService extends IInputManager.Stub public void notifyInputChannelBroken(IBinder token); public long notifyANR(IBinder token, String reason); /** * Notifies the window manager about an application that is not responding. * Returns a new timeout to continue waiting in nanoseconds, or 0 to abort dispatch. */ long notifyANR(InputApplicationHandle inputApplicationHandle, IBinder token, String reason); public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); Loading
services/core/java/com/android/server/wm/ActivityRecord.java +2 −1 Original line number Diff line number Diff line Loading @@ -376,6 +376,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * Value to increment the z-layer when boosting a layer during animations. BOOST in l33tsp34k. */ @VisibleForTesting static final int Z_BOOST_BASE = 800570000; static final int INVALID_PID = -1; final ActivityTaskManagerService mAtmService; final ActivityInfo info; // activity info provided by developer in AndroidManifest Loading Loading @@ -5313,7 +5314,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A anrActivity = getWaitingHistoryRecordLocked(); anrApp = app; windowFromSameProcessAsActivity = !hasProcess() || app.getPid() == windowPid || windowPid == -1; !hasProcess() || app.getPid() == windowPid || windowPid == INVALID_PID; } if (windowFromSameProcessAsActivity) { Loading
services/core/java/com/android/server/wm/InputManagerCallback.java +9 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static com.android.server.wm.ActivityRecord.INVALID_PID; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_INPUT; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; Loading @@ -14,6 +15,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.util.Slog; import android.view.IWindow; import android.view.InputApplicationHandle; import android.view.KeyEvent; import android.view.WindowManager; Loading Loading @@ -80,7 +82,8 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal * Called by the InputManager. */ @Override public long notifyANR(IBinder token, String reason) { public long notifyANR(InputApplicationHandle inputApplicationHandle, IBinder token, String reason) { ActivityRecord activity = null; WindowState windowState = null; boolean aboveSystem = false; Loading @@ -93,6 +96,10 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal } } if (activity == null && inputApplicationHandle != null) { activity = ActivityRecord.forTokenLocked(inputApplicationHandle.token); } if (windowState != null) { Slog.i(TAG_WM, "Input event dispatching timed out " + "sending to " + windowState.mAttrs.getTitle() Loading Loading @@ -122,7 +129,7 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal // Notify the activity manager about the timeout and let it decide whether // to abort dispatching or keep waiting. final boolean abort = activity.keyDispatchingTimedOut(reason, windowState.mSession.mPid); (windowState != null) ? windowState.mSession.mPid : INVALID_PID); if (!abort) { // The activity manager declined to abort dispatching. // Wait a bit longer and timeout again later. Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +18 −3 Original line number Diff line number Diff line Loading @@ -709,6 +709,18 @@ void NativeInputManager::notifyConfigurationChanged(nsecs_t when) { checkAndClearExceptionFromCallback(env, "notifyConfigurationChanged"); } static jobject getInputApplicationHandleObjLocalRef(JNIEnv* env, const sp<InputApplicationHandle>& inputApplicationHandle) { if (inputApplicationHandle == nullptr) { return nullptr; } NativeInputApplicationHandle* handle = static_cast<NativeInputApplicationHandle*>(inputApplicationHandle.get()); return handle->getInputApplicationHandleObjLocalRef(env); } nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY Loading @@ -719,11 +731,14 @@ nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApp JNIEnv* env = jniEnv(); ScopedLocalFrame localFrame(env); jobject inputApplicationHandleObj = getInputApplicationHandleObjLocalRef(env, inputApplicationHandle); jobject tokenObj = javaObjectForIBinder(env, token); jstring reasonObj = env->NewStringUTF(reason.c_str()); jlong newTimeout = env->CallLongMethod(mServiceObj, gServiceClassInfo.notifyANR, tokenObj, gServiceClassInfo.notifyANR, inputApplicationHandleObj, tokenObj, reasonObj); if (checkAndClearExceptionFromCallback(env, "notifyANR")) { newTimeout = 0; // abort dispatch Loading Loading @@ -1865,7 +1880,7 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gServiceClassInfo.notifyANR, clazz, "notifyANR", "(Landroid/os/IBinder;Ljava/lang/String;)J"); "(Landroid/view/InputApplicationHandle;Landroid/os/IBinder;Ljava/lang/String;)J"); GET_METHOD_ID(gServiceClassInfo.filterInputEvent, clazz, "filterInputEvent", "(Landroid/view/InputEvent;I)Z"); Loading