Loading core/jni/android_view_SurfaceControl.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -483,11 +483,8 @@ static void nativeSetMetadata(JNIEnv* env, jclass clazz, jlong transactionObj, auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); std::vector<uint8_t> byteData(parcel->dataSize()); memcpy(byteData.data(), parcel->data(), parcel->dataSize()); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setMetadata(ctrl, id, std::move(byteData)); transaction->setMetadata(ctrl, id, *parcel); } static void nativeSetColor(JNIEnv* env, jclass clazz, jlong transactionObj, Loading libs/input/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ cc_library_shared { ], shared_libs: [ "libbinder", "libcutils", "liblog", "libutils", Loading libs/input/SpriteController.cpp +23 −2 Original line number Diff line number Diff line Loading @@ -245,7 +245,8 @@ void SpriteController::doUpdateSprites() { if (update.state.surfaceControl != NULL && (becomingVisible || becomingHidden || (wantSurfaceVisibleAndDrawn && (update.state.dirty & (DIRTY_ALPHA | DIRTY_POSITION | DIRTY_TRANSFORMATION_MATRIX | DIRTY_LAYER | DIRTY_VISIBILITY | DIRTY_HOTSPOT | DIRTY_DISPLAY_ID))))) { | DIRTY_VISIBILITY | DIRTY_HOTSPOT | DIRTY_DISPLAY_ID | DIRTY_ICON_STYLE))))) { needApplyTransaction = true; if (wantSurfaceVisibleAndDrawn Loading Loading @@ -274,6 +275,21 @@ void SpriteController::doUpdateSprites() { update.state.transformationMatrix.dtdy); } if (wantSurfaceVisibleAndDrawn && (becomingVisible || (update.state.dirty & (DIRTY_HOTSPOT | DIRTY_ICON_STYLE)))) { Parcel p; p.writeInt32(update.state.icon.style); p.writeFloat(update.state.icon.hotSpotX); p.writeFloat(update.state.icon.hotSpotY); // Pass cursor metadata in the sprite surface so that when Android is running as a // client OS (e.g. ARC++) the host OS can get the requested cursor metadata and // update mouse cursor in the host OS. t.setMetadata( update.state.surfaceControl, METADATA_MOUSE_CURSOR, p); } int32_t surfaceLayer = mOverlayLayer + update.state.layer; if (wantSurfaceVisibleAndDrawn && (becomingVisible || (update.state.dirty & DIRTY_LAYER))) { Loading Loading @@ -397,9 +413,14 @@ void SpriteController::SpriteImpl::setIcon(const SpriteIcon& icon) { } else { dirty = DIRTY_BITMAP; } if (mLocked.state.icon.style != icon.style) { mLocked.state.icon.style = icon.style; dirty |= DIRTY_ICON_STYLE; } } else if (mLocked.state.icon.isValid()) { mLocked.state.icon.bitmap.reset(); dirty = DIRTY_BITMAP | DIRTY_HOTSPOT; dirty = DIRTY_BITMAP | DIRTY_HOTSPOT | DIRTY_ICON_STYLE; } else { return; // setting to invalid icon and already invalid so nothing to do } Loading libs/input/SpriteController.h +10 −7 Original line number Diff line number Diff line Loading @@ -55,11 +55,12 @@ struct SpriteTransformationMatrix { * Icon that a sprite displays, including its hotspot. */ struct SpriteIcon { inline SpriteIcon() : hotSpotX(0), hotSpotY(0) { } inline SpriteIcon(const SkBitmap& bitmap, float hotSpotX, float hotSpotY) : bitmap(bitmap), hotSpotX(hotSpotX), hotSpotY(hotSpotY) { } inline SpriteIcon() : style(0), hotSpotX(0), hotSpotY(0) { } inline SpriteIcon(const SkBitmap& bitmap, int32_t style, float hotSpotX, float hotSpotY) : bitmap(bitmap), style(style), hotSpotX(hotSpotX), hotSpotY(hotSpotY) { } SkBitmap bitmap; int32_t style; float hotSpotX; float hotSpotY; Loading @@ -69,11 +70,12 @@ struct SpriteIcon { bitmap.readPixels(bitmapCopy.info(), bitmapCopy.getPixels(), bitmapCopy.rowBytes(), 0, 0); } return SpriteIcon(bitmapCopy, hotSpotX, hotSpotY); return SpriteIcon(bitmapCopy, style, hotSpotX, hotSpotY); } inline void reset() { bitmap.reset(); style = 0; hotSpotX = 0; hotSpotY = 0; } Loading Loading @@ -149,15 +151,15 @@ public: SpriteController(const sp<Looper>& looper, int32_t overlayLayer); /* Creates a new sprite, initially invisible. */ sp<Sprite> createSprite(); virtual sp<Sprite> createSprite(); /* Opens or closes a transaction to perform a batch of sprite updates as part of * a single operation such as setPosition and setAlpha. It is not necessary to * open a transaction when updating a single property. * Calls to openTransaction() nest and must be matched by an equal number * of calls to closeTransaction(). */ void openTransaction(); void closeTransaction(); virtual void openTransaction(); virtual void closeTransaction(); private: enum { Loading @@ -174,6 +176,7 @@ private: DIRTY_VISIBILITY = 1 << 5, DIRTY_HOTSPOT = 1 << 6, DIRTY_DISPLAY_ID = 1 << 7, DIRTY_ICON_STYLE = 1 << 8, }; /* Describes the state of a sprite. Loading libs/input/TEST_MAPPING 0 → 100644 +7 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "libinputservice_test" } ] } Loading
core/jni/android_view_SurfaceControl.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -483,11 +483,8 @@ static void nativeSetMetadata(JNIEnv* env, jclass clazz, jlong transactionObj, auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); std::vector<uint8_t> byteData(parcel->dataSize()); memcpy(byteData.data(), parcel->data(), parcel->dataSize()); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setMetadata(ctrl, id, std::move(byteData)); transaction->setMetadata(ctrl, id, *parcel); } static void nativeSetColor(JNIEnv* env, jclass clazz, jlong transactionObj, Loading
libs/input/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ cc_library_shared { ], shared_libs: [ "libbinder", "libcutils", "liblog", "libutils", Loading
libs/input/SpriteController.cpp +23 −2 Original line number Diff line number Diff line Loading @@ -245,7 +245,8 @@ void SpriteController::doUpdateSprites() { if (update.state.surfaceControl != NULL && (becomingVisible || becomingHidden || (wantSurfaceVisibleAndDrawn && (update.state.dirty & (DIRTY_ALPHA | DIRTY_POSITION | DIRTY_TRANSFORMATION_MATRIX | DIRTY_LAYER | DIRTY_VISIBILITY | DIRTY_HOTSPOT | DIRTY_DISPLAY_ID))))) { | DIRTY_VISIBILITY | DIRTY_HOTSPOT | DIRTY_DISPLAY_ID | DIRTY_ICON_STYLE))))) { needApplyTransaction = true; if (wantSurfaceVisibleAndDrawn Loading Loading @@ -274,6 +275,21 @@ void SpriteController::doUpdateSprites() { update.state.transformationMatrix.dtdy); } if (wantSurfaceVisibleAndDrawn && (becomingVisible || (update.state.dirty & (DIRTY_HOTSPOT | DIRTY_ICON_STYLE)))) { Parcel p; p.writeInt32(update.state.icon.style); p.writeFloat(update.state.icon.hotSpotX); p.writeFloat(update.state.icon.hotSpotY); // Pass cursor metadata in the sprite surface so that when Android is running as a // client OS (e.g. ARC++) the host OS can get the requested cursor metadata and // update mouse cursor in the host OS. t.setMetadata( update.state.surfaceControl, METADATA_MOUSE_CURSOR, p); } int32_t surfaceLayer = mOverlayLayer + update.state.layer; if (wantSurfaceVisibleAndDrawn && (becomingVisible || (update.state.dirty & DIRTY_LAYER))) { Loading Loading @@ -397,9 +413,14 @@ void SpriteController::SpriteImpl::setIcon(const SpriteIcon& icon) { } else { dirty = DIRTY_BITMAP; } if (mLocked.state.icon.style != icon.style) { mLocked.state.icon.style = icon.style; dirty |= DIRTY_ICON_STYLE; } } else if (mLocked.state.icon.isValid()) { mLocked.state.icon.bitmap.reset(); dirty = DIRTY_BITMAP | DIRTY_HOTSPOT; dirty = DIRTY_BITMAP | DIRTY_HOTSPOT | DIRTY_ICON_STYLE; } else { return; // setting to invalid icon and already invalid so nothing to do } Loading
libs/input/SpriteController.h +10 −7 Original line number Diff line number Diff line Loading @@ -55,11 +55,12 @@ struct SpriteTransformationMatrix { * Icon that a sprite displays, including its hotspot. */ struct SpriteIcon { inline SpriteIcon() : hotSpotX(0), hotSpotY(0) { } inline SpriteIcon(const SkBitmap& bitmap, float hotSpotX, float hotSpotY) : bitmap(bitmap), hotSpotX(hotSpotX), hotSpotY(hotSpotY) { } inline SpriteIcon() : style(0), hotSpotX(0), hotSpotY(0) { } inline SpriteIcon(const SkBitmap& bitmap, int32_t style, float hotSpotX, float hotSpotY) : bitmap(bitmap), style(style), hotSpotX(hotSpotX), hotSpotY(hotSpotY) { } SkBitmap bitmap; int32_t style; float hotSpotX; float hotSpotY; Loading @@ -69,11 +70,12 @@ struct SpriteIcon { bitmap.readPixels(bitmapCopy.info(), bitmapCopy.getPixels(), bitmapCopy.rowBytes(), 0, 0); } return SpriteIcon(bitmapCopy, hotSpotX, hotSpotY); return SpriteIcon(bitmapCopy, style, hotSpotX, hotSpotY); } inline void reset() { bitmap.reset(); style = 0; hotSpotX = 0; hotSpotY = 0; } Loading Loading @@ -149,15 +151,15 @@ public: SpriteController(const sp<Looper>& looper, int32_t overlayLayer); /* Creates a new sprite, initially invisible. */ sp<Sprite> createSprite(); virtual sp<Sprite> createSprite(); /* Opens or closes a transaction to perform a batch of sprite updates as part of * a single operation such as setPosition and setAlpha. It is not necessary to * open a transaction when updating a single property. * Calls to openTransaction() nest and must be matched by an equal number * of calls to closeTransaction(). */ void openTransaction(); void closeTransaction(); virtual void openTransaction(); virtual void closeTransaction(); private: enum { Loading @@ -174,6 +176,7 @@ private: DIRTY_VISIBILITY = 1 << 5, DIRTY_HOTSPOT = 1 << 6, DIRTY_DISPLAY_ID = 1 << 7, DIRTY_ICON_STYLE = 1 << 8, }; /* Describes the state of a sprite. Loading
libs/input/TEST_MAPPING 0 → 100644 +7 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "libinputservice_test" } ] }