diff options
author | 2020-09-22 18:14:43 +0000 | |
---|---|---|
committer | 2020-09-25 12:33:30 +0000 | |
commit | 91512a00615042c9e80ec3f907339389a53a9810 (patch) | |
tree | 3cd81409485c98040f817623671e2c43ad81178b /libs/gui/SurfaceControl.cpp | |
parent | 421dfd5842d44a77883fac7ad2781c363e77aed3 (diff) |
Add functions to parcel nullable surface controls
Test: None
Change-Id: Ia1bb5771b9d5ea9f70519d92f37ba95d57b4d6fe
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r-- | libs/gui/SurfaceControl.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 0246b7315e..6e153d9acc 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -200,5 +200,27 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, return NO_ERROR; } +status_t SurfaceControl::readNullableFromParcel(const Parcel& parcel, + sp<SurfaceControl>* outSurfaceControl) { + bool isNotNull; + SAFE_PARCEL(parcel.readBool, &isNotNull); + if (isNotNull) { + SAFE_PARCEL(SurfaceControl::readFromParcel, parcel, outSurfaceControl); + } + + return NO_ERROR; +} + +status_t SurfaceControl::writeNullableToParcel(Parcel& parcel, + const sp<SurfaceControl>& surfaceControl) { + auto isNotNull = surfaceControl != nullptr; + SAFE_PARCEL(parcel.writeBool, isNotNull); + if (isNotNull) { + SAFE_PARCEL(surfaceControl->writeToParcel, parcel); + } + + return NO_ERROR; +} + // ---------------------------------------------------------------------------- }; // namespace android |