[automerger skipped] DO NOT MERGE - Merge build QP1A.190711.001 into stage-aosp-master history
am: d483db1fba -s ours
am skip reason: subject contains skip directive
Change-Id: I5f0b6a8b3178adef8eb0f8848dd8f5f1f338c320
diff --git a/Android.bp b/Android.bp
index de9ea86..bf4cf5d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,3 +20,25 @@
vendor: true,
export_include_dirs: ["include_sensor"],
}
+
+filegroup {
+ name: "framework_native_aidl_binder",
+ srcs: ["aidl/binder/**/*.aidl"],
+ path: "aidl/binder",
+ visibility: ["//frameworks/native"],
+}
+
+filegroup {
+ name: "framework_native_aidl_gui",
+ srcs: ["aidl/gui/**/*.aidl"],
+ path: "aidl/gui",
+ visibility: ["//frameworks/native"],
+}
+
+filegroup {
+ name: "framework_native_aidl",
+ srcs: [
+ ":framework_native_aidl_binder",
+ ":framework_native_aidl_gui",
+ ],
+}
diff --git a/cmds/installd/migrate_legacy_obb_data.sh b/cmds/installd/migrate_legacy_obb_data.sh
index 4f8a1ec..1075688 100644
--- a/cmds/installd/migrate_legacy_obb_data.sh
+++ b/cmds/installd/migrate_legacy_obb_data.sh
@@ -15,6 +15,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+rm -rf /sdcard/Android/obb/test_probe
+mkdir -p /sdcard/Android/obb/
+touch /sdcard/Android/obb/test_probe
+if ! test -f /data/media/0/Android/obb/test_probe ; then
+ log -p i -t migrate_legacy_obb_data "No support for 'unshared_obb'. Not migrating"
+ rm -rf /sdcard/Android/obb/test_probe
+ exit 0
+fi
+
+# Delete the test file, and remove the obb folder if it is empty
+rm -rf /sdcard/Android/obb/test_probe
+rmdir /data/media/obb
+
if ! test -d /data/media/obb ; then
log -p i -t migrate_legacy_obb_data "No legacy obb data to migrate."
exit 0
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index c6ce576..cea5bad 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -37,6 +37,7 @@
enabled: true,
},
double_loadable: true,
+ no_apex: true,
srcs: [
"ActivityManager.cpp",
diff --git a/libs/binder/ndk/ibinder.cpp b/libs/binder/ndk/ibinder.cpp
index bd6886d..b06ca86 100644
--- a/libs/binder/ndk/ibinder.cpp
+++ b/libs/binder/ndk/ibinder.cpp
@@ -589,3 +589,40 @@
recipient->decStrong(nullptr);
}
+
+binder_status_t AIBinder_getExtension(AIBinder* binder, AIBinder** outExt) {
+ if (binder == nullptr || outExt == nullptr) {
+ if (outExt != nullptr) {
+ *outExt = nullptr;
+ }
+ return STATUS_UNEXPECTED_NULL;
+ }
+
+ sp<IBinder> ext;
+ status_t res = binder->getBinder()->getExtension(&ext);
+
+ if (res != android::OK) {
+ *outExt = nullptr;
+ return PruneStatusT(res);
+ }
+
+ sp<AIBinder> ret = ABpBinder::lookupOrCreateFromBinder(ext);
+ if (ret != nullptr) ret->incStrong(binder);
+
+ *outExt = ret.get();
+ return STATUS_OK;
+}
+
+binder_status_t AIBinder_setExtension(AIBinder* binder, AIBinder* ext) {
+ if (binder == nullptr || ext == nullptr) {
+ return STATUS_UNEXPECTED_NULL;
+ }
+
+ ABBinder* rawBinder = binder->asABBinder();
+ if (rawBinder == nullptr) {
+ return STATUS_INVALID_OPERATION;
+ }
+
+ rawBinder->setExtension(ext->getBinder());
+ return STATUS_OK;
+}
diff --git a/libs/binder/ndk/include_ndk/android/binder_ibinder.h b/libs/binder/ndk/include_ndk/android/binder_ibinder.h
index 80d1254..160739b 100644
--- a/libs/binder/ndk/include_ndk/android/binder_ibinder.h
+++ b/libs/binder/ndk/include_ndk/android/binder_ibinder.h
@@ -510,6 +510,76 @@
void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient* recipient) __INTRODUCED_IN(29);
#endif //__ANDROID_API__ >= __ANDROID_API_Q__
+
+#if __ANDROID_API__ >= __ANDROID_API_R__
+
+/**
+ * Gets the extension registered with AIBinder_setExtension.
+ *
+ * See AIBinder_setExtension.
+ *
+ * \param binder the object to get the extension of.
+ * \param outExt the returned extension object. Will be null if there is no extension set or
+ * non-null with one strong ref count.
+ *
+ * \return error of getting the interface (may be a transaction error if this is
+ * remote binder). STATUS_UNEXPECTED_NULL if binder is null.
+ */
+binder_status_t AIBinder_getExtension(AIBinder* binder, AIBinder** outExt) __INTRODUCED_IN(30);
+
+/**
+ * Gets the extension of a binder interface. This allows a downstream developer to add
+ * an extension to an interface without modifying its interface file. This should be
+ * called immediately when the object is created before it is passed to another thread.
+ * No thread safety is required.
+ *
+ * For instance, imagine if we have this interface:
+ * interface IFoo { void doFoo(); }
+ *
+ * A). Historical option that has proven to be BAD! Only the original
+ * author of an interface should change an interface. If someone
+ * downstream wants additional functionality, they should not ever
+ * change the interface or use this method.
+ *
+ * BAD TO DO: interface IFoo { BAD TO DO
+ * BAD TO DO: void doFoo(); BAD TO DO
+ * BAD TO DO: + void doBar(); // adding a method BAD TO DO
+ * BAD TO DO: } BAD TO DO
+ *
+ * B). Option that this method enables.
+ * Leave the original interface unchanged (do not change IFoo!).
+ * Instead, create a new interface in a downstream package:
+ *
+ * package com.<name>; // new functionality in a new package
+ * interface IBar { void doBar(); }
+ *
+ * When registering the interface, add:
+ * std::shared_ptr<MyFoo> foo = new MyFoo; // class in AOSP codebase
+ * std::shared_ptr<MyBar> bar = new MyBar; // custom extension class
+ * ... = AIBinder_setExtension(foo->asBinder().get(), bar->asBinder().get());
+ * // handle error
+ *
+ * Then, clients of IFoo can get this extension:
+ * SpAIBinder binder = ...;
+ * std::shared_ptr<IFoo> foo = IFoo::fromBinder(binder); // handle if null
+ * SpAIBinder barBinder;
+ * ... = AIBinder_getExtension(barBinder.get());
+ * // handle error
+ * std::shared_ptr<IBar> bar = IBar::fromBinder(barBinder);
+ * // type is checked with AIBinder_associateClass
+ * // if bar is null, then there is no extension or a different
+ * // type of extension
+ *
+ * \param binder the object to get the extension on. Must be local.
+ * \param ext the extension to set (binder will hold a strong reference to this)
+ *
+ * \return OK on success, STATUS_INVALID_OPERATION if binder is not local, STATUS_UNEXPECTED_NULL
+ * if either binder is null.
+ */
+binder_status_t AIBinder_setExtension(AIBinder* binder, AIBinder* ext) __INTRODUCED_IN(30);
+
+#endif //__ANDROID_API__ >= __ANDROID_API_R__
+
__END_DECLS
/** @} */
diff --git a/libs/binder/ndk/libbinder_ndk.map.txt b/libs/binder/ndk/libbinder_ndk.map.txt
index feedde6..d4d5387 100644
--- a/libs/binder/ndk/libbinder_ndk.map.txt
+++ b/libs/binder/ndk/libbinder_ndk.map.txt
@@ -101,6 +101,9 @@
LIBBINDER_NDK30 { # introduced=30
global:
+ AIBinder_getExtension;
+ AIBinder_setExtension;
+
AIBinder_markSystemStability; # apex
AIBinder_markVendorStability; # vndk
AIBinder_markVintfStability; # apex vndk
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index d6f88fc..def9fe9 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -365,6 +365,9 @@
mContainsBuffer = other.mContainsBuffer;
other.mContainsBuffer = false;
+ mEarlyWakeup = mEarlyWakeup || other.mEarlyWakeup;
+ other.mEarlyWakeup = false;
+
return *this;
}
diff --git a/libs/renderengine/gl/ProgramCache.cpp b/libs/renderengine/gl/ProgramCache.cpp
index 086a324..d242677 100644
--- a/libs/renderengine/gl/ProgramCache.cpp
+++ b/libs/renderengine/gl/ProgramCache.cpp
@@ -575,10 +575,11 @@
float applyCornerRadius(vec2 cropCoords)
{
vec2 position = cropCoords - cropCenter;
- // Increase precision here so that a large corner radius doesn't
- // cause floating point error
- highp vec2 dist = abs(position) + vec2(cornerRadius) - cropCenter;
- float plane = length(max(dist, vec2(0.0)));
+ // Scale down the dist vector here, as otherwise large corner
+ // radii can cause floating point issues when computing the norm
+ vec2 dist = (abs(position) - cropCenter + vec2(cornerRadius)) / 16.0;
+ // Once we've found the norm, then scale back up.
+ float plane = length(max(dist, vec2(0.0))) * 16.0;
return 1.0 - clamp(plane - cornerRadius, 0.0, 1.0);
}
)__SHADER__";
diff --git a/services/surfaceflinger/CompositionEngine/Android.bp b/services/surfaceflinger/CompositionEngine/Android.bp
index 6f076ad..1c31ab9 100644
--- a/services/surfaceflinger/CompositionEngine/Android.bp
+++ b/services/surfaceflinger/CompositionEngine/Android.bp
@@ -118,6 +118,13 @@
//
// You can either "make dist tests" before flashing, or set this
// option to false temporarily.
- address: true,
+
+
+ // FIXME: ASAN build is broken for a while, but was not discovered
+ // since new PM silently suppressed ASAN. Temporarily turn off ASAN
+ // to unblock the compiler upgrade process.
+ // address: true,
+ // http://b/139747256
+ address: false,
},
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 9c8251f..ad0ac6b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -353,6 +353,11 @@
mPropagateBackpressure = !atoi(value);
ALOGI_IF(!mPropagateBackpressure, "Disabling backpressure propagation");
+ property_get("debug.sf.enable_gl_backpressure", value, "0");
+ mPropagateBackpressureClientComposition = atoi(value);
+ ALOGI_IF(mPropagateBackpressureClientComposition,
+ "Enabling backpressure propagation for Client Composition");
+
property_get("debug.sf.enable_hwc_vds", value, "0");
mUseHwcVirtualDisplays = atoi(value);
ALOGI_IF(mUseHwcVirtualDisplays, "Enabling HWC virtual displays");
@@ -1670,9 +1675,9 @@
break;
}
- // For now, only propagate backpressure when missing a hwc frame.
- if (hwcFrameMissed && !gpuFrameMissed) {
- if (mPropagateBackpressure) {
+ if (frameMissed && mPropagateBackpressure) {
+ if ((hwcFrameMissed && !gpuFrameMissed) ||
+ mPropagateBackpressureClientComposition) {
signalLayerUpdate();
break;
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index c5c4103..63e74f5 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -1003,6 +1003,7 @@
volatile nsecs_t mDebugInTransaction = 0;
bool mForceFullDamage = false;
bool mPropagateBackpressure = true;
+ bool mPropagateBackpressureClientComposition = false;
std::unique_ptr<SurfaceInterceptor> mInterceptor;
SurfaceTracing mTracing{*this};
bool mTracingEnabled = false;
diff --git a/services/surfaceflinger/TransactionCompletedThread.cpp b/services/surfaceflinger/TransactionCompletedThread.cpp
index 5cf8eb1..fd466de 100644
--- a/services/surfaceflinger/TransactionCompletedThread.cpp
+++ b/services/surfaceflinger/TransactionCompletedThread.cpp
@@ -197,8 +197,14 @@
}
transactionStats->latchTime = handle->latchTime;
- transactionStats->surfaceStats.emplace_back(handle->surfaceControl, handle->acquireTime,
- handle->previousReleaseFence);
+ // If the layer has already been destroyed, don't add the SurfaceControl to the callback.
+ // The client side keeps a sp<> to the SurfaceControl so if the SurfaceControl has been
+ // destroyed the client side is dead and there won't be anyone to send the callback to.
+ sp<IBinder> surfaceControl = handle->surfaceControl.promote();
+ if (surfaceControl) {
+ transactionStats->surfaceStats.emplace_back(surfaceControl, handle->acquireTime,
+ handle->previousReleaseFence);
+ }
return NO_ERROR;
}
diff --git a/services/surfaceflinger/TransactionCompletedThread.h b/services/surfaceflinger/TransactionCompletedThread.h
index 21e2678..e849f71 100644
--- a/services/surfaceflinger/TransactionCompletedThread.h
+++ b/services/surfaceflinger/TransactionCompletedThread.h
@@ -49,7 +49,7 @@
sp<ITransactionCompletedListener> listener;
std::vector<CallbackId> callbackIds;
- sp<IBinder> surfaceControl;
+ wp<IBinder> surfaceControl;
bool releasePreviousBuffer = false;
sp<Fence> previousReleaseFence;
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index a8949d3..5f4c6b1 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -1381,7 +1381,7 @@
bool active = swapchain->surface.swapchain_handle == swapchain_handle;
ANativeWindow* window = active ? swapchain->surface.window.get() : nullptr;
- if (swapchain->frame_timestamps_enabled) {
+ if (window && swapchain->frame_timestamps_enabled) {
native_window_enable_frame_timestamps(window, false);
}
for (uint32_t i = 0; i < swapchain->num_images; i++)