Loading libs/gui/SurfaceComposerClient.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -2146,6 +2146,10 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface(const String8& name, uin return s; } static std::string toString(const String16& string) { return std::string(String8(string).c_str()); } status_t SurfaceComposerClient::createSurfaceChecked(const String8& name, uint32_t w, uint32_t h, PixelFormat format, sp<SurfaceControl>* outSurface, int32_t flags, Loading @@ -2165,7 +2169,8 @@ status_t SurfaceComposerClient::createSurfaceChecked(const String8& name, uint32 } ALOGE_IF(err, "SurfaceComposerClient::createSurface error %s", strerror(-err)); if (err == NO_ERROR) { *outSurface = new SurfaceControl(this, result.handle, result.layerId, w, h, format, *outSurface = new SurfaceControl(this, result.handle, result.layerId, toString(result.layerName), w, h, format, result.transformHint, flags); } } Loading @@ -2178,21 +2183,21 @@ sp<SurfaceControl> SurfaceComposerClient::mirrorSurface(SurfaceControl* mirrorFr } sp<IBinder> mirrorFromHandle = mirrorFromSurface->getHandle(); gui::MirrorSurfaceResult result; gui::CreateSurfaceResult result; const binder::Status status = mClient->mirrorSurface(mirrorFromHandle, &result); const status_t err = statusTFromBinderStatus(status); if (err == NO_ERROR) { return new SurfaceControl(this, result.handle, result.layerId); return new SurfaceControl(this, result.handle, result.layerId, toString(result.layerName)); } return nullptr; } sp<SurfaceControl> SurfaceComposerClient::mirrorDisplay(DisplayId displayId) { gui::MirrorSurfaceResult result; gui::CreateSurfaceResult result; const binder::Status status = mClient->mirrorDisplay(displayId.value, &result); const status_t err = statusTFromBinderStatus(status); if (err == NO_ERROR) { return new SurfaceControl(this, result.handle, result.layerId); return new SurfaceControl(this, result.handle, result.layerId, toString(result.layerName)); } return nullptr; } Loading libs/gui/SurfaceControl.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -49,11 +49,12 @@ namespace android { // ============================================================================ SurfaceControl::SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle, int32_t layerId, uint32_t w, uint32_t h, PixelFormat format, uint32_t transform, uint32_t flags) int32_t layerId, const std::string& name, uint32_t w, uint32_t h, PixelFormat format, uint32_t transform, uint32_t flags) : mClient(client), mHandle(handle), mLayerId(layerId), mName(name), mTransformHint(transform), mWidth(w), mHeight(h), Loading @@ -65,6 +66,7 @@ SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) { mHandle = other->mHandle; mTransformHint = other->mTransformHint; mLayerId = other->mLayerId; mName = other->mName; mWidth = other->mWidth; mHeight = other->mHeight; mFormat = other->mFormat; Loading Loading @@ -185,6 +187,10 @@ int32_t SurfaceControl::getLayerId() const { return mLayerId; } const std::string& SurfaceControl::getName() const { return mName; } sp<IGraphicBufferProducer> SurfaceControl::getIGraphicBufferProducer() { getSurface(); Loading Loading @@ -212,6 +218,7 @@ status_t SurfaceControl::writeToParcel(Parcel& parcel) { SAFE_PARCEL(parcel.writeStrongBinder, ISurfaceComposerClient::asBinder(mClient->getClient())); SAFE_PARCEL(parcel.writeStrongBinder, mHandle); SAFE_PARCEL(parcel.writeInt32, mLayerId); SAFE_PARCEL(parcel.writeUtf8AsUtf16, mName); SAFE_PARCEL(parcel.writeUint32, mTransformHint); SAFE_PARCEL(parcel.writeUint32, mWidth); SAFE_PARCEL(parcel.writeUint32, mHeight); Loading @@ -225,6 +232,7 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, sp<IBinder> client; sp<IBinder> handle; int32_t layerId; std::string layerName; uint32_t transformHint; uint32_t width; uint32_t height; Loading @@ -233,16 +241,17 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, SAFE_PARCEL(parcel.readStrongBinder, &client); SAFE_PARCEL(parcel.readStrongBinder, &handle); SAFE_PARCEL(parcel.readInt32, &layerId); SAFE_PARCEL(parcel.readUtf8FromUtf16, &layerName); SAFE_PARCEL(parcel.readUint32, &transformHint); SAFE_PARCEL(parcel.readUint32, &width); SAFE_PARCEL(parcel.readUint32, &height); SAFE_PARCEL(parcel.readUint32, &format); // We aren't the original owner of the surface. *outSurfaceControl = new SurfaceControl(new SurfaceComposerClient( *outSurfaceControl = new SurfaceControl(new SurfaceComposerClient( interface_cast<ISurfaceComposerClient>(client)), handle.get(), layerId, width, height, format, transformHint); handle.get(), layerId, layerName, width, height, format, transformHint); return NO_ERROR; } Loading libs/gui/aidl/android/gui/CreateSurfaceResult.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -20,5 +20,6 @@ package android.gui; parcelable CreateSurfaceResult { IBinder handle; int layerId; String layerName; int transformHint; } libs/gui/aidl/android/gui/ISurfaceComposerClient.aidl +2 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package android.gui; import android.gui.CreateSurfaceResult; import android.gui.FrameStats; import android.gui.LayerMetadata; import android.gui.MirrorSurfaceResult; /** @hide */ interface ISurfaceComposerClient { Loading Loading @@ -58,7 +57,7 @@ interface ISurfaceComposerClient { */ FrameStats getLayerFrameStats(IBinder handle); MirrorSurfaceResult mirrorSurface(IBinder mirrorFromHandle); CreateSurfaceResult mirrorSurface(IBinder mirrorFromHandle); MirrorSurfaceResult mirrorDisplay(long displayId); CreateSurfaceResult mirrorDisplay(long displayId); } libs/gui/aidl/android/gui/MirrorSurfaceResult.aidldeleted 100644 → 0 +0 −23 Original line number Diff line number Diff line /* * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.gui; /** @hide */ parcelable MirrorSurfaceResult { IBinder handle; int layerId; } Loading
libs/gui/SurfaceComposerClient.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -2146,6 +2146,10 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface(const String8& name, uin return s; } static std::string toString(const String16& string) { return std::string(String8(string).c_str()); } status_t SurfaceComposerClient::createSurfaceChecked(const String8& name, uint32_t w, uint32_t h, PixelFormat format, sp<SurfaceControl>* outSurface, int32_t flags, Loading @@ -2165,7 +2169,8 @@ status_t SurfaceComposerClient::createSurfaceChecked(const String8& name, uint32 } ALOGE_IF(err, "SurfaceComposerClient::createSurface error %s", strerror(-err)); if (err == NO_ERROR) { *outSurface = new SurfaceControl(this, result.handle, result.layerId, w, h, format, *outSurface = new SurfaceControl(this, result.handle, result.layerId, toString(result.layerName), w, h, format, result.transformHint, flags); } } Loading @@ -2178,21 +2183,21 @@ sp<SurfaceControl> SurfaceComposerClient::mirrorSurface(SurfaceControl* mirrorFr } sp<IBinder> mirrorFromHandle = mirrorFromSurface->getHandle(); gui::MirrorSurfaceResult result; gui::CreateSurfaceResult result; const binder::Status status = mClient->mirrorSurface(mirrorFromHandle, &result); const status_t err = statusTFromBinderStatus(status); if (err == NO_ERROR) { return new SurfaceControl(this, result.handle, result.layerId); return new SurfaceControl(this, result.handle, result.layerId, toString(result.layerName)); } return nullptr; } sp<SurfaceControl> SurfaceComposerClient::mirrorDisplay(DisplayId displayId) { gui::MirrorSurfaceResult result; gui::CreateSurfaceResult result; const binder::Status status = mClient->mirrorDisplay(displayId.value, &result); const status_t err = statusTFromBinderStatus(status); if (err == NO_ERROR) { return new SurfaceControl(this, result.handle, result.layerId); return new SurfaceControl(this, result.handle, result.layerId, toString(result.layerName)); } return nullptr; } Loading
libs/gui/SurfaceControl.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -49,11 +49,12 @@ namespace android { // ============================================================================ SurfaceControl::SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle, int32_t layerId, uint32_t w, uint32_t h, PixelFormat format, uint32_t transform, uint32_t flags) int32_t layerId, const std::string& name, uint32_t w, uint32_t h, PixelFormat format, uint32_t transform, uint32_t flags) : mClient(client), mHandle(handle), mLayerId(layerId), mName(name), mTransformHint(transform), mWidth(w), mHeight(h), Loading @@ -65,6 +66,7 @@ SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) { mHandle = other->mHandle; mTransformHint = other->mTransformHint; mLayerId = other->mLayerId; mName = other->mName; mWidth = other->mWidth; mHeight = other->mHeight; mFormat = other->mFormat; Loading Loading @@ -185,6 +187,10 @@ int32_t SurfaceControl::getLayerId() const { return mLayerId; } const std::string& SurfaceControl::getName() const { return mName; } sp<IGraphicBufferProducer> SurfaceControl::getIGraphicBufferProducer() { getSurface(); Loading Loading @@ -212,6 +218,7 @@ status_t SurfaceControl::writeToParcel(Parcel& parcel) { SAFE_PARCEL(parcel.writeStrongBinder, ISurfaceComposerClient::asBinder(mClient->getClient())); SAFE_PARCEL(parcel.writeStrongBinder, mHandle); SAFE_PARCEL(parcel.writeInt32, mLayerId); SAFE_PARCEL(parcel.writeUtf8AsUtf16, mName); SAFE_PARCEL(parcel.writeUint32, mTransformHint); SAFE_PARCEL(parcel.writeUint32, mWidth); SAFE_PARCEL(parcel.writeUint32, mHeight); Loading @@ -225,6 +232,7 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, sp<IBinder> client; sp<IBinder> handle; int32_t layerId; std::string layerName; uint32_t transformHint; uint32_t width; uint32_t height; Loading @@ -233,16 +241,17 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, SAFE_PARCEL(parcel.readStrongBinder, &client); SAFE_PARCEL(parcel.readStrongBinder, &handle); SAFE_PARCEL(parcel.readInt32, &layerId); SAFE_PARCEL(parcel.readUtf8FromUtf16, &layerName); SAFE_PARCEL(parcel.readUint32, &transformHint); SAFE_PARCEL(parcel.readUint32, &width); SAFE_PARCEL(parcel.readUint32, &height); SAFE_PARCEL(parcel.readUint32, &format); // We aren't the original owner of the surface. *outSurfaceControl = new SurfaceControl(new SurfaceComposerClient( *outSurfaceControl = new SurfaceControl(new SurfaceComposerClient( interface_cast<ISurfaceComposerClient>(client)), handle.get(), layerId, width, height, format, transformHint); handle.get(), layerId, layerName, width, height, format, transformHint); return NO_ERROR; } Loading
libs/gui/aidl/android/gui/CreateSurfaceResult.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -20,5 +20,6 @@ package android.gui; parcelable CreateSurfaceResult { IBinder handle; int layerId; String layerName; int transformHint; }
libs/gui/aidl/android/gui/ISurfaceComposerClient.aidl +2 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package android.gui; import android.gui.CreateSurfaceResult; import android.gui.FrameStats; import android.gui.LayerMetadata; import android.gui.MirrorSurfaceResult; /** @hide */ interface ISurfaceComposerClient { Loading Loading @@ -58,7 +57,7 @@ interface ISurfaceComposerClient { */ FrameStats getLayerFrameStats(IBinder handle); MirrorSurfaceResult mirrorSurface(IBinder mirrorFromHandle); CreateSurfaceResult mirrorSurface(IBinder mirrorFromHandle); MirrorSurfaceResult mirrorDisplay(long displayId); CreateSurfaceResult mirrorDisplay(long displayId); }
libs/gui/aidl/android/gui/MirrorSurfaceResult.aidldeleted 100644 → 0 +0 −23 Original line number Diff line number Diff line /* * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.gui; /** @hide */ parcelable MirrorSurfaceResult { IBinder handle; int layerId; }