libgui: use read/writeStrongBinder
Still storing binder locally as a weak binder, but the plan is to remove
read/writeWeakBinder APIs. This is because weak binders can't be
promoted unless there is already a strong binder in a given process.
Bug: 137785053
Test: atest libgui_test (fails at same place as ToT: b/137791481)
Test: atest SurfaceFlinger_test (fails at same places as ToT: b/137875576)
Change-Id: I2d01aab95c4bd2e6db5e50055910cfa3064d9e52
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 6066421..42eb921 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -87,7 +87,7 @@
colorTransform.asArray(), 16 * sizeof(float));
output.writeFloat(cornerRadius);
output.writeBool(hasListenerCallbacks);
- output.writeWeakBinder(cachedBuffer.token);
+ output.writeStrongBinder(cachedBuffer.token.promote());
output.writeUint64(cachedBuffer.id);
output.writeParcelable(metadata);
@@ -157,7 +157,7 @@
colorTransform = mat4(static_cast<const float*>(input.readInplace(16 * sizeof(float))));
cornerRadius = input.readFloat();
hasListenerCallbacks = input.readBool();
- cachedBuffer.token = input.readWeakBinder();
+ cachedBuffer.token = input.readStrongBinder();
cachedBuffer.id = input.readUint64();
input.readParcelable(&metadata);