Loading core/jni/android_view_Surface.cpp +9 −10 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #define LOG_TAG "Surface" #include <stdio.h> #include "android_util_Binder.h" Loading Loading @@ -226,8 +228,9 @@ static void Surface_initParcel(JNIEnv* env, jobject clazz, jobject argParcel) doThrow(env, "java/lang/NullPointerException", NULL); return; } sp<Surface> rhs = new Surface(*parcel); setSurface(env, clazz, rhs); sp<Surface> sur(Surface::readFromParcel(*parcel, 0)); setSurface(env, clazz, sur); } static jint Surface_getIdentity(JNIEnv* env, jobject clazz) Loading Loading @@ -605,13 +608,9 @@ static void Surface_readFromParcel( return; } const sp<Surface>& control(getSurface(env, clazz)); sp<Surface> rhs = new Surface(*parcel); if (!Surface::isSameSurface(control, rhs)) { // we reassign the surface only if it's a different one // otherwise we would loose our client-side state. setSurface(env, clazz, rhs); } const sp<Surface>& curr(getSurface(env, clazz)); sp<Surface> sur(Surface::readFromParcel(*parcel, curr)); setSurface(env, clazz, sur); } static void Surface_writeToParcel( Loading include/surfaceflinger/Surface.h +3 −4 Original line number Diff line number Diff line Loading @@ -145,15 +145,13 @@ public: uint32_t reserved[2]; }; Surface(const Parcel& data); static sp<Surface> readFromParcel( const Parcel& data, const sp<Surface>& other); static bool isValid(const sp<Surface>& surface) { return (surface != 0) && surface->isValid(); } static bool isSameSurface( const sp<Surface>& lhs, const sp<Surface>& rhs); bool isValid(); SurfaceID ID() const { return mToken; } uint32_t getFlags() const { return mFlags; } Loading Loading @@ -191,6 +189,7 @@ private: Surface(const Surface& rhs); Surface(const sp<SurfaceControl>& control); Surface(const Parcel& data, const sp<IBinder>& ref); ~Surface(); Loading libs/surfaceflinger_client/Surface.cpp +13 −8 Original line number Diff line number Diff line Loading @@ -334,13 +334,13 @@ Surface::Surface(const sp<SurfaceControl>& surface) init(); } Surface::Surface(const Parcel& parcel) Surface::Surface(const Parcel& parcel, const sp<IBinder>& ref) : mBufferMapper(GraphicBufferMapper::get()), mClient(SurfaceClient::getInstance()), mSharedBufferClient(NULL), mInitCheck(NO_INIT) { mSurface = interface_cast<ISurface>(parcel.readStrongBinder()); mSurface = interface_cast<ISurface>(ref); mIdentity = parcel.readInt32(); mWidth = parcel.readInt32(); mHeight = parcel.readInt32(); Loading @@ -349,6 +349,17 @@ Surface::Surface(const Parcel& parcel) init(); } sp<Surface> Surface::readFromParcel( const Parcel& data, const sp<Surface>& other) { sp<Surface> result(other); sp<IBinder> binder(data.readStrongBinder()); if (other==0 || binder != other->mSurface->asBinder()) { result = new Surface(data, binder); } return result; } void Surface::init() { android_native_window_t::setSwapInterval = setSwapInterval; Loading Loading @@ -443,12 +454,6 @@ status_t Surface::validate() const return NO_ERROR; } bool Surface::isSameSurface(const sp<Surface>& lhs, const sp<Surface>& rhs) { if (lhs == 0 || rhs == 0) return false; return lhs->mSurface->asBinder() == rhs->mSurface->asBinder(); } sp<ISurface> Surface::getISurface() const { return mSurface; } Loading Loading
core/jni/android_view_Surface.cpp +9 −10 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #define LOG_TAG "Surface" #include <stdio.h> #include "android_util_Binder.h" Loading Loading @@ -226,8 +228,9 @@ static void Surface_initParcel(JNIEnv* env, jobject clazz, jobject argParcel) doThrow(env, "java/lang/NullPointerException", NULL); return; } sp<Surface> rhs = new Surface(*parcel); setSurface(env, clazz, rhs); sp<Surface> sur(Surface::readFromParcel(*parcel, 0)); setSurface(env, clazz, sur); } static jint Surface_getIdentity(JNIEnv* env, jobject clazz) Loading Loading @@ -605,13 +608,9 @@ static void Surface_readFromParcel( return; } const sp<Surface>& control(getSurface(env, clazz)); sp<Surface> rhs = new Surface(*parcel); if (!Surface::isSameSurface(control, rhs)) { // we reassign the surface only if it's a different one // otherwise we would loose our client-side state. setSurface(env, clazz, rhs); } const sp<Surface>& curr(getSurface(env, clazz)); sp<Surface> sur(Surface::readFromParcel(*parcel, curr)); setSurface(env, clazz, sur); } static void Surface_writeToParcel( Loading
include/surfaceflinger/Surface.h +3 −4 Original line number Diff line number Diff line Loading @@ -145,15 +145,13 @@ public: uint32_t reserved[2]; }; Surface(const Parcel& data); static sp<Surface> readFromParcel( const Parcel& data, const sp<Surface>& other); static bool isValid(const sp<Surface>& surface) { return (surface != 0) && surface->isValid(); } static bool isSameSurface( const sp<Surface>& lhs, const sp<Surface>& rhs); bool isValid(); SurfaceID ID() const { return mToken; } uint32_t getFlags() const { return mFlags; } Loading Loading @@ -191,6 +189,7 @@ private: Surface(const Surface& rhs); Surface(const sp<SurfaceControl>& control); Surface(const Parcel& data, const sp<IBinder>& ref); ~Surface(); Loading
libs/surfaceflinger_client/Surface.cpp +13 −8 Original line number Diff line number Diff line Loading @@ -334,13 +334,13 @@ Surface::Surface(const sp<SurfaceControl>& surface) init(); } Surface::Surface(const Parcel& parcel) Surface::Surface(const Parcel& parcel, const sp<IBinder>& ref) : mBufferMapper(GraphicBufferMapper::get()), mClient(SurfaceClient::getInstance()), mSharedBufferClient(NULL), mInitCheck(NO_INIT) { mSurface = interface_cast<ISurface>(parcel.readStrongBinder()); mSurface = interface_cast<ISurface>(ref); mIdentity = parcel.readInt32(); mWidth = parcel.readInt32(); mHeight = parcel.readInt32(); Loading @@ -349,6 +349,17 @@ Surface::Surface(const Parcel& parcel) init(); } sp<Surface> Surface::readFromParcel( const Parcel& data, const sp<Surface>& other) { sp<Surface> result(other); sp<IBinder> binder(data.readStrongBinder()); if (other==0 || binder != other->mSurface->asBinder()) { result = new Surface(data, binder); } return result; } void Surface::init() { android_native_window_t::setSwapInterval = setSwapInterval; Loading Loading @@ -443,12 +454,6 @@ status_t Surface::validate() const return NO_ERROR; } bool Surface::isSameSurface(const sp<Surface>& lhs, const sp<Surface>& rhs) { if (lhs == 0 || rhs == 0) return false; return lhs->mSurface->asBinder() == rhs->mSurface->asBinder(); } sp<ISurface> Surface::getISurface() const { return mSurface; } Loading