本文整理汇总了C++中NativeInputChannel类的典型用法代码示例。如果您正苦于以下问题:C++ NativeInputChannel类的具体用法?C++ NativeInputChannel怎么用?C++ NativeInputChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NativeInputChannel类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: releaseInfo
bool NativeInputWindowHandle::updateInfo()
{
if (!mObject) {
releaseInfo();
return false;
}
if (!mInfo) {
mInfo = new android::InputWindowInfo();
}
IInputChannel* inputChannelObj = mObject->mInputChannel;
if (inputChannelObj) {
NativeInputChannel* nativeInputChannel;
inputChannelObj->GetNativeInputChannel((Handle32*)&nativeInputChannel);
mInfo->inputChannel = nativeInputChannel != NULL ? nativeInputChannel->getInputChannel() : NULL;
}
else {
mInfo->inputChannel.clear();
}
if (!mObject->mName.IsNull()) {
mInfo->name.setTo((const char*)mObject->mName);
}
else {
mInfo->name.setTo("<null>");
}
mInfo->layoutParamsFlags = mObject->mLayoutParamsFlags;
mInfo->layoutParamsType = mObject->mLayoutParamsType;
mInfo->dispatchingTimeout = mObject->mDispatchingTimeoutNanos;
mInfo->frameLeft = mObject->mFrameLeft;
mInfo->frameTop = mObject->mFrameTop;
mInfo->frameRight = mObject->mFrameRight;
mInfo->frameBottom = mObject->mFrameBottom;
mInfo->scaleFactor = mObject->mScaleFactor;
IRegion* regionObj = mObject->mTouchableRegion;
if (regionObj) {
SkRegion* region;
regionObj->GetNativeRegion((Handle32*)®ion);
mInfo->touchableRegion.set(*region);
}
else {
mInfo->touchableRegion.setEmpty();
}
mInfo->visible = mObject->mVisible;
mInfo->canReceiveKeys = mObject->mCanReceiveKeys;
mInfo->hasFocus = mObject->mHasFocus;
mInfo->hasWallpaper = mObject->mHasWallpaper;
mInfo->paused = mObject->mPaused;
mInfo->layer = mObject->mLayer;
mInfo->ownerPid = mObject->mOwnerPid;
mInfo->ownerUid = mObject->mOwnerUid;
mInfo->inputFeatures = mObject->mInputFeatures;
mInfo->displayId = mObject->mDisplayId;
return true;
}
示例2: android_view_InputChannel_nativeDup
static void android_view_InputChannel_nativeDup(JNIEnv* env, jobject obj, jobject otherObj) {
NativeInputChannel* nativeInputChannel =
android_view_InputChannel_getNativeInputChannel(env, obj);
if (nativeInputChannel) {
android_view_InputChannel_setNativeInputChannel(env, otherObj,
new NativeInputChannel(nativeInputChannel->getInputChannel()->dup()));
}
}
示例3: android_view_InputChannel_setDisposeCallback
void android_view_InputChannel_setDisposeCallback(JNIEnv* env, jobject inputChannelObj,
InputChannelObjDisposeCallback callback, void* data) {
NativeInputChannel* nativeInputChannel =
android_view_InputChannel_getNativeInputChannel(env, inputChannelObj);
if (nativeInputChannel == NULL) {
ALOGW("Cannot set dispose callback because input channel object has not been initialized.");
} else {
nativeInputChannel->setDisposeCallback(callback, data);
}
}
示例4: android_view_InputChannel_nativeGetName
static jstring android_view_InputChannel_nativeGetName(JNIEnv* env, jobject obj) {
NativeInputChannel* nativeInputChannel =
android_view_InputChannel_getNativeInputChannel(env, obj);
if (! nativeInputChannel) {
return NULL;
}
jstring name = env->NewStringUTF(nativeInputChannel->getInputChannel()->getName().string());
return name;
}
示例5: android_view_InputChannel_nativeDispose
static void android_view_InputChannel_nativeDispose(JNIEnv* env, jobject obj, jboolean finalized) {
NativeInputChannel* nativeInputChannel =
android_view_InputChannel_getNativeInputChannel(env, obj);
if (nativeInputChannel) {
if (finalized) {
ALOGW("Input channel object '%s' was finalized without being disposed!",
nativeInputChannel->getInputChannel()->getName().string());
}
nativeInputChannel->invokeAndRemoveDisposeCallback(env, obj);
android_view_InputChannel_setNativeInputChannel(env, obj, NULL);
delete nativeInputChannel;
}
}
示例6: android_view_InputChannel_nativeWriteToParcel
static void android_view_InputChannel_nativeWriteToParcel(JNIEnv* env, jobject obj,
jobject parcelObj) {
Parcel* parcel = parcelForJavaObject(env, parcelObj);
if (parcel) {
NativeInputChannel* nativeInputChannel =
android_view_InputChannel_getNativeInputChannel(env, obj);
if (nativeInputChannel) {
sp<InputChannel> inputChannel = nativeInputChannel->getInputChannel();
parcel->writeInt32(1);
parcel->writeString8(String8(inputChannel->getName().c_str()));
parcel->writeDupFileDescriptor(inputChannel->getFd());
} else {
parcel->writeInt32(0);
}
}
}
示例7: android_view_InputChannel_getInputChannel
sp<InputChannel> android_view_InputChannel_getInputChannel(JNIEnv* env, jobject inputChannelObj) {
NativeInputChannel* nativeInputChannel =
android_view_InputChannel_getNativeInputChannel(env, inputChannelObj);
return nativeInputChannel != NULL ? nativeInputChannel->getInputChannel() : NULL;
}
示例8: releaseInfo
bool NativeInputWindowHandle::updateInfo()
{
AutoPtr<IInputWindowHandle> obj;
mObjWeak->Resolve(EIID_IInputWindowHandle, (IInterface**)&obj);
if (!obj) {
releaseInfo();
return false;
}
if (!mInfo) {
mInfo = new android::InputWindowInfo();
}
else {
mInfo->touchableRegion.clear();
}
Elastos::Droid::Server::Input::InputWindowHandle* handle =
(Elastos::Droid::Server::Input::InputWindowHandle*)obj.Get();
AutoPtr<IInputChannel> inputChannelObj = handle->mInputChannel;
if (inputChannelObj) {
Handle64 ptr;
inputChannelObj->GetNativeInputChannel(&ptr);
NativeInputChannel* nativeInputChannel = reinterpret_cast<NativeInputChannel*>(ptr);
mInfo->inputChannel = nativeInputChannel != NULL ? nativeInputChannel->getInputChannel() : NULL;
}
else {
mInfo->inputChannel.clear();
}
if (!handle->mName.IsNull()) {
mInfo->name.setTo(handle->mName.string());
}
else {
mInfo->name.setTo("<null>");
}
mInfo->layoutParamsFlags = handle->mLayoutParamsFlags;
mInfo->layoutParamsType = handle->mLayoutParamsType;
mInfo->dispatchingTimeout = handle->mDispatchingTimeoutNanos;
mInfo->frameLeft = handle->mFrameLeft;
mInfo->frameTop = handle->mFrameTop;
mInfo->frameRight = handle->mFrameRight;
mInfo->frameBottom = handle->mFrameBottom;
mInfo->scaleFactor = handle->mScaleFactor;
AutoPtr<IRegion> regionObj = handle->mTouchableRegion;
if (regionObj) {
Int64 regionHandle;
regionObj->GetNativeRegion((Handle64*)®ionHandle);
SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
SkASSERT(region != NULL);
for (SkRegion::Iterator it(*region); !it.done(); it.next()) {
const SkIRect& rect = it.rect();
mInfo->addTouchableRegion(android::Rect(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom));
}
}
mInfo->visible = handle->mVisible;
mInfo->canReceiveKeys = handle->mCanReceiveKeys;
mInfo->hasFocus = handle->mHasFocus;
mInfo->hasWallpaper = handle->mHasWallpaper;
mInfo->paused = handle->mPaused;
mInfo->layer = handle->mLayer;
mInfo->ownerPid = handle->mOwnerPid;
mInfo->ownerUid = handle->mOwnerUid;
mInfo->inputFeatures = handle->mInputFeatures;
mInfo->displayId = handle->mDisplayId;
return true;
}