Loading core/jni/android_view_InputChannel.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ static jobject android_view_InputChannel_createInputChannel(JNIEnv* env, static jobjectArray android_view_InputChannel_nativeOpenInputChannelPair(JNIEnv* env, jclass clazz, jstring nameObj) { const char* nameChars = env->GetStringUTFChars(nameObj, NULL); String8 name(nameChars); std::string name = nameChars; env->ReleaseStringUTFChars(nameObj, nameChars); sp<InputChannel> serverChannel; Loading Loading @@ -166,7 +166,7 @@ static void android_view_InputChannel_nativeDispose(JNIEnv* env, jobject obj, jb if (nativeInputChannel) { if (finalized) { ALOGW("Input channel object '%s' was finalized without being disposed!", nativeInputChannel->getInputChannel()->getName().string()); nativeInputChannel->getInputChannel()->getName().c_str()); } nativeInputChannel->invokeAndRemoveDisposeCallback(env, obj); Loading Loading @@ -212,7 +212,7 @@ static void android_view_InputChannel_nativeReadFromParcel(JNIEnv* env, jobject return; } InputChannel* inputChannel = new InputChannel(name, dupFd); InputChannel* inputChannel = new InputChannel(name.string(), dupFd); NativeInputChannel* nativeInputChannel = new NativeInputChannel(inputChannel); android_view_InputChannel_setNativeInputChannel(env, obj, nativeInputChannel); Loading @@ -230,7 +230,7 @@ static void android_view_InputChannel_nativeWriteToParcel(JNIEnv* env, jobject o sp<InputChannel> inputChannel = nativeInputChannel->getInputChannel(); parcel->writeInt32(1); parcel->writeString8(inputChannel->getName()); parcel->writeString8(String8(inputChannel->getName().c_str())); parcel->writeDupFileDescriptor(inputChannel->getFd()); } else { parcel->writeInt32(0); Loading @@ -245,7 +245,7 @@ static jstring android_view_InputChannel_nativeGetName(JNIEnv* env, jobject obj) return NULL; } jstring name = env->NewStringUTF(nativeInputChannel->getInputChannel()->getName().string()); jstring name = env->NewStringUTF(nativeInputChannel->getInputChannel()->getName().c_str()); return name; } Loading core/jni/android_view_InputEventReceiver.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ private: void setFdEvents(int events); const char* getInputChannelName() { return mInputConsumer.getChannel()->getName().string(); return mInputConsumer.getChannel()->getName().c_str(); } virtual int handleEvent(int receiveFd, int events, void* data); Loading core/jni/android_view_InputEventSender.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ private: uint32_t mNextPublishedSeq; const char* getInputChannelName() { return mInputPublisher.getChannel()->getName().string(); return mInputPublisher.getChannel()->getName().c_str(); } virtual int handleEvent(int receiveFd, int events, void* data); Loading services/core/jni/com_android_server_input_InputApplicationHandle.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -65,11 +65,11 @@ bool NativeInputApplicationHandle::updateInfo() { gInputApplicationHandleClassInfo.name)); if (nameObj) { const char* nameStr = env->GetStringUTFChars(nameObj, NULL); mInfo->name.setTo(nameStr); mInfo->name = nameStr; env->ReleaseStringUTFChars(nameObj, nameStr); env->DeleteLocalRef(nameObj); } else { mInfo->name.setTo("<null>"); mInfo->name = "<null>"; } mInfo->dispatchingTimeout = env->GetLongField(obj, Loading services/core/jni/com_android_server_input_InputManagerService.cpp +27 −24 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <atomic> #include <cinttypes> #include <limits.h> #include <android-base/stringprintf.h> #include <android_runtime/AndroidRuntime.h> #include <android_runtime/Log.h> Loading Loading @@ -65,6 +66,8 @@ #define INDENT " " using android::base::StringPrintf; namespace android { // The exponent used to calculate the pointer speed scaling factor. Loading Loading @@ -198,7 +201,7 @@ public: inline sp<InputManager> getInputManager() const { return mInputManager; } void dump(String8& dump); void dump(std::string& dump); void setVirtualDisplayViewports(JNIEnv* env, jobjectArray viewportObjArray); void setDisplayViewport(int32_t viewportType, const DisplayViewport& viewport); Loading Loading @@ -240,7 +243,7 @@ public: virtual void notifyConfigurationChanged(nsecs_t when); virtual nsecs_t notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle, const sp<InputWindowHandle>& inputWindowHandle, const String8& reason); const std::string& reason); virtual void notifyInputChannelBroken(const sp<InputWindowHandle>& inputWindowHandle); virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags); virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig); Loading Loading @@ -347,28 +350,28 @@ NativeInputManager::~NativeInputManager() { env->DeleteGlobalRef(mServiceObj); } void NativeInputManager::dump(String8& dump) { dump.append("Input Manager State:\n"); void NativeInputManager::dump(std::string& dump) { dump += "Input Manager State:\n"; { dump.appendFormat(INDENT "Interactive: %s\n", toString(mInteractive.load())); dump += StringPrintf(INDENT "Interactive: %s\n", toString(mInteractive.load())); } { AutoMutex _l(mLock); dump.appendFormat(INDENT "System UI Visibility: 0x%0" PRIx32 "\n", dump += StringPrintf(INDENT "System UI Visibility: 0x%0" PRIx32 "\n", mLocked.systemUiVisibility); dump.appendFormat(INDENT "Pointer Speed: %" PRId32 "\n", mLocked.pointerSpeed); dump.appendFormat(INDENT "Pointer Gestures Enabled: %s\n", dump += StringPrintf(INDENT "Pointer Speed: %" PRId32 "\n", mLocked.pointerSpeed); dump += StringPrintf(INDENT "Pointer Gestures Enabled: %s\n", toString(mLocked.pointerGesturesEnabled)); dump.appendFormat(INDENT "Show Touches: %s\n", toString(mLocked.showTouches)); dump.appendFormat(INDENT "Pointer Capture Enabled: %s\n", toString(mLocked.pointerCapture)); dump += StringPrintf(INDENT "Show Touches: %s\n", toString(mLocked.showTouches)); dump += StringPrintf(INDENT "Pointer Capture Enabled: %s\n", toString(mLocked.pointerCapture)); } dump.append("\n"); dump += "\n"; mInputManager->getReader()->dump(dump); dump.append("\n"); dump += "\n"; mInputManager->getDispatcher()->dump(dump); dump.append("\n"); dump += "\n"; } bool NativeInputManager::checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { Loading Loading @@ -668,7 +671,7 @@ void NativeInputManager::notifyConfigurationChanged(nsecs_t when) { } nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle, const sp<InputWindowHandle>& inputWindowHandle, const String8& reason) { const sp<InputWindowHandle>& inputWindowHandle, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyANR"); #endif Loading @@ -680,7 +683,7 @@ nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApp getInputApplicationHandleObjLocalRef(env, inputApplicationHandle); jobject inputWindowHandleObj = getInputWindowHandleObjLocalRef(env, inputWindowHandle); jstring reasonObj = env->NewStringUTF(reason.string()); jstring reasonObj = env->NewStringUTF(reason.c_str()); jlong newTimeout = env->CallLongMethod(mServiceObj, gServiceClassInfo.notifyANR, inputApplicationHandleObj, inputWindowHandleObj, Loading Loading @@ -1342,7 +1345,7 @@ static void handleInputChannelDisposed(JNIEnv* env, NativeInputManager* im = static_cast<NativeInputManager*>(data); ALOGW("Input channel object '%s' was disposed without first being unregistered with " "the input manager!", inputChannel->getName().string()); "the input manager!", inputChannel->getName().c_str()); im->unregisterInputChannel(env, inputChannel); } Loading @@ -1363,9 +1366,9 @@ static void nativeRegisterInputChannel(JNIEnv* env, jclass /* clazz */, status_t status = im->registerInputChannel( env, inputChannel, inputWindowHandle, monitor); if (status) { String8 message; message.appendFormat("Failed to register input channel. status=%d", status); jniThrowRuntimeException(env, message.string()); std::string message; message += StringPrintf("Failed to register input channel. status=%d", status); jniThrowRuntimeException(env, message.c_str()); return; } Loading @@ -1390,9 +1393,9 @@ static void nativeUnregisterInputChannel(JNIEnv* env, jclass /* clazz */, status_t status = im->unregisterInputChannel(env, inputChannel); if (status && status != BAD_VALUE) { // ignore already unregistered channel String8 message; message.appendFormat("Failed to unregister input channel. status=%d", status); jniThrowRuntimeException(env, message.string()); std::string message; message += StringPrintf("Failed to unregister input channel. status=%d", status); jniThrowRuntimeException(env, message.c_str()); } } Loading Loading @@ -1576,9 +1579,9 @@ static void nativeReloadDeviceAliases(JNIEnv* /* env */, static jstring nativeDump(JNIEnv* env, jclass /* clazz */, jlong ptr) { NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); String8 dump; std::string dump; im->dump(dump); return env->NewStringUTF(dump.string()); return env->NewStringUTF(dump.c_str()); } static void nativeMonitor(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) { Loading Loading
core/jni/android_view_InputChannel.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ static jobject android_view_InputChannel_createInputChannel(JNIEnv* env, static jobjectArray android_view_InputChannel_nativeOpenInputChannelPair(JNIEnv* env, jclass clazz, jstring nameObj) { const char* nameChars = env->GetStringUTFChars(nameObj, NULL); String8 name(nameChars); std::string name = nameChars; env->ReleaseStringUTFChars(nameObj, nameChars); sp<InputChannel> serverChannel; Loading Loading @@ -166,7 +166,7 @@ static void android_view_InputChannel_nativeDispose(JNIEnv* env, jobject obj, jb if (nativeInputChannel) { if (finalized) { ALOGW("Input channel object '%s' was finalized without being disposed!", nativeInputChannel->getInputChannel()->getName().string()); nativeInputChannel->getInputChannel()->getName().c_str()); } nativeInputChannel->invokeAndRemoveDisposeCallback(env, obj); Loading Loading @@ -212,7 +212,7 @@ static void android_view_InputChannel_nativeReadFromParcel(JNIEnv* env, jobject return; } InputChannel* inputChannel = new InputChannel(name, dupFd); InputChannel* inputChannel = new InputChannel(name.string(), dupFd); NativeInputChannel* nativeInputChannel = new NativeInputChannel(inputChannel); android_view_InputChannel_setNativeInputChannel(env, obj, nativeInputChannel); Loading @@ -230,7 +230,7 @@ static void android_view_InputChannel_nativeWriteToParcel(JNIEnv* env, jobject o sp<InputChannel> inputChannel = nativeInputChannel->getInputChannel(); parcel->writeInt32(1); parcel->writeString8(inputChannel->getName()); parcel->writeString8(String8(inputChannel->getName().c_str())); parcel->writeDupFileDescriptor(inputChannel->getFd()); } else { parcel->writeInt32(0); Loading @@ -245,7 +245,7 @@ static jstring android_view_InputChannel_nativeGetName(JNIEnv* env, jobject obj) return NULL; } jstring name = env->NewStringUTF(nativeInputChannel->getInputChannel()->getName().string()); jstring name = env->NewStringUTF(nativeInputChannel->getInputChannel()->getName().c_str()); return name; } Loading
core/jni/android_view_InputEventReceiver.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ private: void setFdEvents(int events); const char* getInputChannelName() { return mInputConsumer.getChannel()->getName().string(); return mInputConsumer.getChannel()->getName().c_str(); } virtual int handleEvent(int receiveFd, int events, void* data); Loading
core/jni/android_view_InputEventSender.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ private: uint32_t mNextPublishedSeq; const char* getInputChannelName() { return mInputPublisher.getChannel()->getName().string(); return mInputPublisher.getChannel()->getName().c_str(); } virtual int handleEvent(int receiveFd, int events, void* data); Loading
services/core/jni/com_android_server_input_InputApplicationHandle.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -65,11 +65,11 @@ bool NativeInputApplicationHandle::updateInfo() { gInputApplicationHandleClassInfo.name)); if (nameObj) { const char* nameStr = env->GetStringUTFChars(nameObj, NULL); mInfo->name.setTo(nameStr); mInfo->name = nameStr; env->ReleaseStringUTFChars(nameObj, nameStr); env->DeleteLocalRef(nameObj); } else { mInfo->name.setTo("<null>"); mInfo->name = "<null>"; } mInfo->dispatchingTimeout = env->GetLongField(obj, Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +27 −24 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <atomic> #include <cinttypes> #include <limits.h> #include <android-base/stringprintf.h> #include <android_runtime/AndroidRuntime.h> #include <android_runtime/Log.h> Loading Loading @@ -65,6 +66,8 @@ #define INDENT " " using android::base::StringPrintf; namespace android { // The exponent used to calculate the pointer speed scaling factor. Loading Loading @@ -198,7 +201,7 @@ public: inline sp<InputManager> getInputManager() const { return mInputManager; } void dump(String8& dump); void dump(std::string& dump); void setVirtualDisplayViewports(JNIEnv* env, jobjectArray viewportObjArray); void setDisplayViewport(int32_t viewportType, const DisplayViewport& viewport); Loading Loading @@ -240,7 +243,7 @@ public: virtual void notifyConfigurationChanged(nsecs_t when); virtual nsecs_t notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle, const sp<InputWindowHandle>& inputWindowHandle, const String8& reason); const std::string& reason); virtual void notifyInputChannelBroken(const sp<InputWindowHandle>& inputWindowHandle); virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags); virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig); Loading Loading @@ -347,28 +350,28 @@ NativeInputManager::~NativeInputManager() { env->DeleteGlobalRef(mServiceObj); } void NativeInputManager::dump(String8& dump) { dump.append("Input Manager State:\n"); void NativeInputManager::dump(std::string& dump) { dump += "Input Manager State:\n"; { dump.appendFormat(INDENT "Interactive: %s\n", toString(mInteractive.load())); dump += StringPrintf(INDENT "Interactive: %s\n", toString(mInteractive.load())); } { AutoMutex _l(mLock); dump.appendFormat(INDENT "System UI Visibility: 0x%0" PRIx32 "\n", dump += StringPrintf(INDENT "System UI Visibility: 0x%0" PRIx32 "\n", mLocked.systemUiVisibility); dump.appendFormat(INDENT "Pointer Speed: %" PRId32 "\n", mLocked.pointerSpeed); dump.appendFormat(INDENT "Pointer Gestures Enabled: %s\n", dump += StringPrintf(INDENT "Pointer Speed: %" PRId32 "\n", mLocked.pointerSpeed); dump += StringPrintf(INDENT "Pointer Gestures Enabled: %s\n", toString(mLocked.pointerGesturesEnabled)); dump.appendFormat(INDENT "Show Touches: %s\n", toString(mLocked.showTouches)); dump.appendFormat(INDENT "Pointer Capture Enabled: %s\n", toString(mLocked.pointerCapture)); dump += StringPrintf(INDENT "Show Touches: %s\n", toString(mLocked.showTouches)); dump += StringPrintf(INDENT "Pointer Capture Enabled: %s\n", toString(mLocked.pointerCapture)); } dump.append("\n"); dump += "\n"; mInputManager->getReader()->dump(dump); dump.append("\n"); dump += "\n"; mInputManager->getDispatcher()->dump(dump); dump.append("\n"); dump += "\n"; } bool NativeInputManager::checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { Loading Loading @@ -668,7 +671,7 @@ void NativeInputManager::notifyConfigurationChanged(nsecs_t when) { } nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle, const sp<InputWindowHandle>& inputWindowHandle, const String8& reason) { const sp<InputWindowHandle>& inputWindowHandle, const std::string& reason) { #if DEBUG_INPUT_DISPATCHER_POLICY ALOGD("notifyANR"); #endif Loading @@ -680,7 +683,7 @@ nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApp getInputApplicationHandleObjLocalRef(env, inputApplicationHandle); jobject inputWindowHandleObj = getInputWindowHandleObjLocalRef(env, inputWindowHandle); jstring reasonObj = env->NewStringUTF(reason.string()); jstring reasonObj = env->NewStringUTF(reason.c_str()); jlong newTimeout = env->CallLongMethod(mServiceObj, gServiceClassInfo.notifyANR, inputApplicationHandleObj, inputWindowHandleObj, Loading Loading @@ -1342,7 +1345,7 @@ static void handleInputChannelDisposed(JNIEnv* env, NativeInputManager* im = static_cast<NativeInputManager*>(data); ALOGW("Input channel object '%s' was disposed without first being unregistered with " "the input manager!", inputChannel->getName().string()); "the input manager!", inputChannel->getName().c_str()); im->unregisterInputChannel(env, inputChannel); } Loading @@ -1363,9 +1366,9 @@ static void nativeRegisterInputChannel(JNIEnv* env, jclass /* clazz */, status_t status = im->registerInputChannel( env, inputChannel, inputWindowHandle, monitor); if (status) { String8 message; message.appendFormat("Failed to register input channel. status=%d", status); jniThrowRuntimeException(env, message.string()); std::string message; message += StringPrintf("Failed to register input channel. status=%d", status); jniThrowRuntimeException(env, message.c_str()); return; } Loading @@ -1390,9 +1393,9 @@ static void nativeUnregisterInputChannel(JNIEnv* env, jclass /* clazz */, status_t status = im->unregisterInputChannel(env, inputChannel); if (status && status != BAD_VALUE) { // ignore already unregistered channel String8 message; message.appendFormat("Failed to unregister input channel. status=%d", status); jniThrowRuntimeException(env, message.string()); std::string message; message += StringPrintf("Failed to unregister input channel. status=%d", status); jniThrowRuntimeException(env, message.c_str()); } } Loading Loading @@ -1576,9 +1579,9 @@ static void nativeReloadDeviceAliases(JNIEnv* /* env */, static jstring nativeDump(JNIEnv* env, jclass /* clazz */, jlong ptr) { NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); String8 dump; std::string dump; im->dump(dump); return env->NewStringUTF(dump.string()); return env->NewStringUTF(dump.c_str()); } static void nativeMonitor(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) { Loading