Loading core/jni/android_hardware_input_InputApplicationHandle.cpp +8 −11 Original line number Diff line number Diff line Loading @@ -77,32 +77,28 @@ bool NativeInputApplicationHandle::updateInfo() { return mInfo.token.get() != nullptr; } // --- Global functions --- sp<InputApplicationHandle> android_view_InputApplicationHandle_getHandle( std::shared_ptr<InputApplicationHandle> android_view_InputApplicationHandle_getHandle( JNIEnv* env, jobject inputApplicationHandleObj) { if (!inputApplicationHandleObj) { return NULL; } AutoMutex _l(gHandleMutex); jlong ptr = env->GetLongField(inputApplicationHandleObj, gInputApplicationHandleClassInfo.ptr); NativeInputApplicationHandle* handle; std::shared_ptr<NativeInputApplicationHandle>* handle; if (ptr) { handle = reinterpret_cast<NativeInputApplicationHandle*>(ptr); handle = reinterpret_cast<std::shared_ptr<NativeInputApplicationHandle>*>(ptr); } else { jweak objWeak = env->NewWeakGlobalRef(inputApplicationHandleObj); handle = new NativeInputApplicationHandle(objWeak); handle->incStrong((void*)android_view_InputApplicationHandle_getHandle); handle = new std::shared_ptr(std::make_shared<NativeInputApplicationHandle>(objWeak)); env->SetLongField(inputApplicationHandleObj, gInputApplicationHandleClassInfo.ptr, reinterpret_cast<jlong>(handle)); } return handle; return *handle; } // --- JNI --- static void android_view_InputApplicationHandle_nativeDispose(JNIEnv* env, jobject obj) { Loading @@ -112,8 +108,9 @@ static void android_view_InputApplicationHandle_nativeDispose(JNIEnv* env, jobje if (ptr) { env->SetLongField(obj, gInputApplicationHandleClassInfo.ptr, 0); NativeInputApplicationHandle* handle = reinterpret_cast<NativeInputApplicationHandle*>(ptr); handle->decStrong((void*)android_view_InputApplicationHandle_getHandle); std::shared_ptr<NativeInputApplicationHandle>* handle = reinterpret_cast<std::shared_ptr<NativeInputApplicationHandle>*>(ptr); delete handle; } } Loading core/jni/android_hardware_input_InputApplicationHandle.h +1 −2 Original line number Diff line number Diff line Loading @@ -39,8 +39,7 @@ private: jweak mObjWeak; }; extern sp<InputApplicationHandle> android_view_InputApplicationHandle_getHandle( extern std::shared_ptr<InputApplicationHandle> android_view_InputApplicationHandle_getHandle( JNIEnv* env, jobject inputApplicationHandleObj); } // namespace android Loading core/jni/android_hardware_input_InputWindowHandle.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ bool NativeInputWindowHandle::updateInfo() { jobject inputApplicationHandleObj = env->GetObjectField(obj, gInputWindowHandleClassInfo.inputApplicationHandle); if (inputApplicationHandleObj) { sp<InputApplicationHandle> inputApplicationHandle = std::shared_ptr<InputApplicationHandle> inputApplicationHandle = android_view_InputApplicationHandle_getHandle(env, inputApplicationHandleObj); if (inputApplicationHandle != nullptr) { inputApplicationHandle->updateInfo(); Loading services/core/jni/com_android_server_input_InputManagerService.cpp +12 −8 Original line number Diff line number Diff line Loading @@ -239,9 +239,9 @@ public: void notifySwitch(nsecs_t when, uint32_t switchValues, uint32_t switchMask, uint32_t policyFlags) override; void notifyConfigurationChanged(nsecs_t when) override; std::chrono::nanoseconds notifyAnr(const sp<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) override; std::chrono::nanoseconds notifyAnr( const std::shared_ptr<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) override; void notifyInputChannelBroken(const sp<IBinder>& token) override; void notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) override; bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) override; Loading Loading @@ -682,8 +682,8 @@ void NativeInputManager::notifyConfigurationChanged(nsecs_t when) { checkAndClearExceptionFromCallback(env, "notifyConfigurationChanged"); } static jobject getInputApplicationHandleObjLocalRef(JNIEnv* env, const sp<InputApplicationHandle>& inputApplicationHandle) { static jobject getInputApplicationHandleObjLocalRef( JNIEnv* env, const std::shared_ptr<InputApplicationHandle>& inputApplicationHandle) { if (inputApplicationHandle == nullptr) { return nullptr; } Loading @@ -694,8 +694,8 @@ static jobject getInputApplicationHandleObjLocalRef(JNIEnv* env, } std::chrono::nanoseconds NativeInputManager::notifyAnr( const sp<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) { const std::shared_ptr<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyANR"); #endif Loading Loading @@ -780,8 +780,12 @@ void NativeInputManager::displayRemoved(JNIEnv* env, int32_t displayId) { void NativeInputManager::setFocusedApplication(JNIEnv* env, int32_t displayId, jobject applicationHandleObj) { sp<InputApplicationHandle> applicationHandle = if (!applicationHandleObj) { return; } std::shared_ptr<InputApplicationHandle> applicationHandle = android_view_InputApplicationHandle_getHandle(env, applicationHandleObj); applicationHandle->updateInfo(); mInputManager->getDispatcher()->setFocusedApplication(displayId, applicationHandle); } Loading Loading
core/jni/android_hardware_input_InputApplicationHandle.cpp +8 −11 Original line number Diff line number Diff line Loading @@ -77,32 +77,28 @@ bool NativeInputApplicationHandle::updateInfo() { return mInfo.token.get() != nullptr; } // --- Global functions --- sp<InputApplicationHandle> android_view_InputApplicationHandle_getHandle( std::shared_ptr<InputApplicationHandle> android_view_InputApplicationHandle_getHandle( JNIEnv* env, jobject inputApplicationHandleObj) { if (!inputApplicationHandleObj) { return NULL; } AutoMutex _l(gHandleMutex); jlong ptr = env->GetLongField(inputApplicationHandleObj, gInputApplicationHandleClassInfo.ptr); NativeInputApplicationHandle* handle; std::shared_ptr<NativeInputApplicationHandle>* handle; if (ptr) { handle = reinterpret_cast<NativeInputApplicationHandle*>(ptr); handle = reinterpret_cast<std::shared_ptr<NativeInputApplicationHandle>*>(ptr); } else { jweak objWeak = env->NewWeakGlobalRef(inputApplicationHandleObj); handle = new NativeInputApplicationHandle(objWeak); handle->incStrong((void*)android_view_InputApplicationHandle_getHandle); handle = new std::shared_ptr(std::make_shared<NativeInputApplicationHandle>(objWeak)); env->SetLongField(inputApplicationHandleObj, gInputApplicationHandleClassInfo.ptr, reinterpret_cast<jlong>(handle)); } return handle; return *handle; } // --- JNI --- static void android_view_InputApplicationHandle_nativeDispose(JNIEnv* env, jobject obj) { Loading @@ -112,8 +108,9 @@ static void android_view_InputApplicationHandle_nativeDispose(JNIEnv* env, jobje if (ptr) { env->SetLongField(obj, gInputApplicationHandleClassInfo.ptr, 0); NativeInputApplicationHandle* handle = reinterpret_cast<NativeInputApplicationHandle*>(ptr); handle->decStrong((void*)android_view_InputApplicationHandle_getHandle); std::shared_ptr<NativeInputApplicationHandle>* handle = reinterpret_cast<std::shared_ptr<NativeInputApplicationHandle>*>(ptr); delete handle; } } Loading
core/jni/android_hardware_input_InputApplicationHandle.h +1 −2 Original line number Diff line number Diff line Loading @@ -39,8 +39,7 @@ private: jweak mObjWeak; }; extern sp<InputApplicationHandle> android_view_InputApplicationHandle_getHandle( extern std::shared_ptr<InputApplicationHandle> android_view_InputApplicationHandle_getHandle( JNIEnv* env, jobject inputApplicationHandleObj); } // namespace android Loading
core/jni/android_hardware_input_InputWindowHandle.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ bool NativeInputWindowHandle::updateInfo() { jobject inputApplicationHandleObj = env->GetObjectField(obj, gInputWindowHandleClassInfo.inputApplicationHandle); if (inputApplicationHandleObj) { sp<InputApplicationHandle> inputApplicationHandle = std::shared_ptr<InputApplicationHandle> inputApplicationHandle = android_view_InputApplicationHandle_getHandle(env, inputApplicationHandleObj); if (inputApplicationHandle != nullptr) { inputApplicationHandle->updateInfo(); Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +12 −8 Original line number Diff line number Diff line Loading @@ -239,9 +239,9 @@ public: void notifySwitch(nsecs_t when, uint32_t switchValues, uint32_t switchMask, uint32_t policyFlags) override; void notifyConfigurationChanged(nsecs_t when) override; std::chrono::nanoseconds notifyAnr(const sp<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) override; std::chrono::nanoseconds notifyAnr( const std::shared_ptr<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) override; void notifyInputChannelBroken(const sp<IBinder>& token) override; void notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) override; bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) override; Loading Loading @@ -682,8 +682,8 @@ void NativeInputManager::notifyConfigurationChanged(nsecs_t when) { checkAndClearExceptionFromCallback(env, "notifyConfigurationChanged"); } static jobject getInputApplicationHandleObjLocalRef(JNIEnv* env, const sp<InputApplicationHandle>& inputApplicationHandle) { static jobject getInputApplicationHandleObjLocalRef( JNIEnv* env, const std::shared_ptr<InputApplicationHandle>& inputApplicationHandle) { if (inputApplicationHandle == nullptr) { return nullptr; } Loading @@ -694,8 +694,8 @@ static jobject getInputApplicationHandleObjLocalRef(JNIEnv* env, } std::chrono::nanoseconds NativeInputManager::notifyAnr( const sp<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) { const std::shared_ptr<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyANR"); #endif Loading Loading @@ -780,8 +780,12 @@ void NativeInputManager::displayRemoved(JNIEnv* env, int32_t displayId) { void NativeInputManager::setFocusedApplication(JNIEnv* env, int32_t displayId, jobject applicationHandleObj) { sp<InputApplicationHandle> applicationHandle = if (!applicationHandleObj) { return; } std::shared_ptr<InputApplicationHandle> applicationHandle = android_view_InputApplicationHandle_getHandle(env, applicationHandleObj); applicationHandle->updateInfo(); mInputManager->getDispatcher()->setFocusedApplication(displayId, applicationHandle); } Loading