diff options
| author | 2018-11-07 01:40:04 +0000 | |
|---|---|---|
| committer | 2018-11-07 01:40:04 +0000 | |
| commit | 394f9bce22c8ebb8d1c45a9b6fd52d851a19ca7e (patch) | |
| tree | f1f2351ba0720c5d26c992be4a3cf60679079311 | |
| parent | c556dfeee1de47086a7404df3f0093daa86dcb1a (diff) | |
| parent | 37965d4d225e333b70110c5715998eebed5eedd2 (diff) | |
Merge "ISurfaceComposer: rename isColorManagementUsed()"
| -rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 28 | ||||
| -rw-r--r-- | libs/gui/include/gui/ISurfaceComposer.h | 4 | ||||
| -rw-r--r-- | libs/gui/tests/Surface_test.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 10 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/Transaction_test.cpp | 2 |
6 files changed, 26 insertions, 22 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index e66c0e5dd6..accf72c390 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -588,19 +588,16 @@ public: return error; } - virtual bool isColorManagementUsed() const { + virtual status_t getColorManagement(bool* outGetColorManagement) const { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - remote()->transact(BnSurfaceComposer::IS_COLOR_MANAGEMET_USED, data, &reply); - int32_t result = 0; - status_t err = reply.readInt32(&result); - if (err != NO_ERROR) { - ALOGE("ISurfaceComposer::isColorManagementUsed: error " - "retrieving result: %s (%d)", - strerror(-err), -err); - return false; + remote()->transact(BnSurfaceComposer::GET_COLOR_MANAGEMENT, data, &reply); + bool result; + status_t err = reply.readBool(&result); + if (err == NO_ERROR) { + *outGetColorManagement = result; } - return result != 0; + return err; } }; @@ -945,11 +942,14 @@ status_t BnSurfaceComposer::onTransact( } return NO_ERROR; } - case IS_COLOR_MANAGEMET_USED: { + case GET_COLOR_MANAGEMENT: { CHECK_INTERFACE(ISurfaceComposer, data, reply); - int32_t result = isColorManagementUsed() ? 1 : 0; - reply->writeInt32(result); - return NO_ERROR; + bool result; + status_t error = getColorManagement(&result); + if (error == NO_ERROR) { + reply->writeBool(result); + } + return result; } default: { return BBinder::onTransact(code, data, reply, flags); diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h index 9316ae69bc..761f31a04b 100644 --- a/libs/gui/include/gui/ISurfaceComposer.h +++ b/libs/gui/include/gui/ISurfaceComposer.h @@ -280,7 +280,7 @@ public: */ virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const = 0; - virtual bool isColorManagementUsed() const = 0; + virtual status_t getColorManagement(bool* outGetColorManagement) const = 0; /* Gets the composition preference of the default data space and default pixel format, * as well as the wide color gamut data space and wide color gamut pixel format. @@ -331,7 +331,7 @@ public: GET_LAYER_DEBUG_INFO, CREATE_SCOPED_CONNECTION, GET_COMPOSITION_PREFERENCE, - IS_COLOR_MANAGEMET_USED, + GET_COLOR_MANAGEMENT, }; virtual status_t onTransact(uint32_t code, const Parcel& data, diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index a3e9249ac2..d0600daa0d 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -635,7 +635,7 @@ public: return NO_ERROR; } - virtual bool isColorManagementUsed() const { return false; } + virtual status_t getColorManagement(bool* /*outGetColorManagement*/) const { return NO_ERROR; } protected: IBinder* onAsBinder() override { return nullptr; } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 4c3be4da0b..dec08fd629 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -518,8 +518,12 @@ sp<IBinder> SurfaceFlinger::getBuiltInDisplay(int32_t id) { return mDisplayTokens[id]; } -bool SurfaceFlinger::isColorManagementUsed() const { - return useColorManagement; +status_t SurfaceFlinger::getColorManagement(bool* outGetColorManagement) const { + if (!outGetColorManagement) { + return BAD_VALUE; + } + *outGetColorManagement = useColorManagement; + return NO_ERROR; } void SurfaceFlinger::bootFinished() @@ -4709,7 +4713,7 @@ status_t SurfaceFlinger::CheckTransactCodeCredentials(uint32_t code) { case SET_TRANSACTION_STATE: // Creating a scoped connection is safe, as per discussion in ISurfaceComposer.h case CREATE_SCOPED_CONNECTION: - case IS_COLOR_MANAGEMET_USED: + case GET_COLOR_MANAGEMENT: case GET_COMPOSITION_PREFERENCE: { return OK; } diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 0747c0594d..51168a6724 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -469,7 +469,7 @@ private: virtual status_t enableVSyncInjections(bool enable); virtual status_t injectVSync(nsecs_t when); virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const; - virtual bool isColorManagementUsed() const; + virtual status_t getColorManagement(bool* outGetColorManagement) const; status_t getCompositionPreference(ui::Dataspace* outDataspace, ui::PixelFormat* outPixelFormat, ui::Dataspace* outWideColorGamutDataspace, ui::PixelFormat* outWideColorGamutPixelFormat) const override; diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp index 57a2227593..94b33ac2d5 100644 --- a/services/surfaceflinger/tests/Transaction_test.cpp +++ b/services/surfaceflinger/tests/Transaction_test.cpp @@ -318,7 +318,7 @@ protected: sp<ISurfaceComposer> sf(ComposerService::getComposerService()); sp<IBinder> binder = sf->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain); - mColorManagementUsed = sf->isColorManagementUsed(); + ASSERT_NO_FATAL_FAILURE(sf->getColorManagement(&mColorManagementUsed)); } virtual void TearDown() { |