Merge "Fix setting the dequeueBuffer timeout to -1"
diff --git a/cmds/installd/otapreopt_chroot.cpp b/cmds/installd/otapreopt_chroot.cpp
index c04b558..3a87776 100644
--- a/cmds/installd/otapreopt_chroot.cpp
+++ b/cmds/installd/otapreopt_chroot.cpp
@@ -27,6 +27,7 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/macros.h>
+#include <android-base/scopeguard.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <libdm/dm.h>
@@ -72,6 +73,15 @@
}
}
+static void DeactivateApexPackages() {
+ std::vector<std::string> apexd_cmd{"/system/bin/apexd", "--unmount-all"};
+ std::string apexd_error_msg;
+ bool exec_result = Exec(apexd_cmd, &apexd_error_msg);
+ if (!exec_result) {
+ PLOG(ERROR) << "Running /system/bin/apexd --unmount-all failed: " << apexd_error_msg;
+ }
+}
+
static void TryExtraMount(const char* name, const char* slot, const char* target) {
std::string partition_name = StringPrintf("%s%s", name, slot);
@@ -231,10 +241,30 @@
exit(205);
}
+ // Call apexd --unmount-all to free up loop and dm block devices, so that we can re-use
+ // them during the next invocation. Since otapreopt_chroot calls exit in case something goes
+ // wrong we need to register our own atexit handler.
+ // We want to register this handler before actually activating apex packages. This is mostly
+ // due to the fact that if fail to unmount apexes, then on the next run of otapreopt_chroot
+ // we will ask for new loop devices instead of re-using existing ones, and we really don't want
+ // to do that. :)
+ if (atexit(DeactivateApexPackages) != 0) {
+ LOG(ERROR) << "Failed to register atexit hander";
+ exit(206);
+ }
+
// Try to mount APEX packages in "/apex" in the chroot dir. We need at least
// the ART APEX, as it is required by otapreopt to run dex2oat.
ActivateApexPackages();
+ auto cleanup = android::base::make_scope_guard([](){
+ std::vector<std::string> apexd_cmd{"/system/bin/apexd", "--unmount-all"};
+ std::string apexd_error_msg;
+ bool exec_result = Exec(apexd_cmd, &apexd_error_msg);
+ if (!exec_result) {
+ PLOG(ERROR) << "Running /system/bin/apexd --unmount-all failed: " << apexd_error_msg;
+ }
+ });
// Check that an ART APEX has been activated; clean up and exit
// early otherwise.
static constexpr const std::string_view kRequiredApexs[] = {
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index c47df52..c4ecd07 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -1062,6 +1062,8 @@
static const char* kProcFilesystems = "/proc/filesystems";
bool supports_sdcardfs() {
+ if (!property_get_bool("external_storage.sdcardfs.enabled", true))
+ return false;
std::string supported;
if (!android::base::ReadFileToString(kProcFilesystems, &supported)) {
PLOG(ERROR) << "Failed to read supported filesystems";
diff --git a/cmds/lshal/test.cpp b/cmds/lshal/test.cpp
index b6ff28d..7c1ca91 100644
--- a/cmds/lshal/test.cpp
+++ b/cmds/lshal/test.cpp
@@ -508,10 +508,10 @@
EXPECT_THAT(output, HasSubstr("a.h.foo6@6.0::IFoo/6"));
EXPECT_EQ("", err.str());
+ std::string error;
vintf::HalManifest m;
- EXPECT_EQ(true, vintf::gHalManifestConverter(&m, out.str()))
- << "--init-vintf does not emit valid HAL manifest: "
- << vintf::gHalManifestConverter.lastError();
+ EXPECT_EQ(true, vintf::gHalManifestConverter(&m, out.str(), &error))
+ << "--init-vintf does not emit valid HAL manifest: " << error;
}
// test default columns
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index 2715d6a..f85c4dc 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -60,16 +60,13 @@
// Currently, these are only on system android (not vendor, not host)
// TODO(b/183654927) - move these into separate libraries
libbinder_device_interface_sources = [
- "ActivityManager.cpp",
"AppOpsManager.cpp",
- "IActivityManager.cpp",
"IAppOpsCallback.cpp",
"IAppOpsService.cpp",
+
"IPermissionController.cpp",
- "IUidObserver.cpp",
"PermissionCache.cpp",
"PermissionController.cpp",
- ":activity_manager_procstate_aidl",
]
cc_library {
@@ -296,3 +293,22 @@
"liblog",
],
}
+
+cc_library {
+ name: "libactivitymanager_aidl",
+ srcs: [
+ "ActivityManager.cpp",
+ "IActivityManager.cpp",
+ "IUidObserver.cpp",
+ ":activity_manager_procstate_aidl",
+ ],
+ export_include_dirs: ["include_activitymanager"],
+ shared_libs: [
+ "libbinder",
+ "libutils",
+ "liblog",
+ ],
+ aidl: {
+ export_aidl_headers: true,
+ },
+}
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 3f0b0df..b1dddd1 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -418,6 +418,11 @@
status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len)
{
+ if (parcel->isForRpc() != isForRpc()) {
+ ALOGE("Cannot append Parcel of one format to another.");
+ return BAD_TYPE;
+ }
+
status_t err;
const uint8_t *data = parcel->mData;
const binder_size_t *objects = parcel->mObjects;
diff --git a/libs/binder/include/binder/ProcessState.h b/libs/binder/include/binder/ProcessState.h
index 2405ab6..ca29440 100644
--- a/libs/binder/include/binder/ProcessState.h
+++ b/libs/binder/include/binder/ProcessState.h
@@ -124,7 +124,6 @@
Vector<handle_entry>mHandleToObject;
- String8 mRootDir;
bool mThreadPoolStarted;
volatile int32_t mThreadPoolSeq;
diff --git a/libs/binder/include/binder/ActivityManager.h b/libs/binder/include_activitymanager/binder/ActivityManager.h
similarity index 100%
rename from libs/binder/include/binder/ActivityManager.h
rename to libs/binder/include_activitymanager/binder/ActivityManager.h
diff --git a/libs/binder/include/binder/IActivityManager.h b/libs/binder/include_activitymanager/binder/IActivityManager.h
similarity index 99%
rename from libs/binder/include/binder/IActivityManager.h
rename to libs/binder/include_activitymanager/binder/IActivityManager.h
index fde56a0..e3b5e43 100644
--- a/libs/binder/include/binder/IActivityManager.h
+++ b/libs/binder/include_activitymanager/binder/IActivityManager.h
@@ -18,8 +18,8 @@
#ifndef __ANDROID_VNDK__
-#include <binder/IInterface.h>
#include <binder/IUidObserver.h>
+#include <binder/IInterface.h>
namespace android {
diff --git a/libs/binder/include/binder/IUidObserver.h b/libs/binder/include_activitymanager/binder/IUidObserver.h
similarity index 100%
rename from libs/binder/include/binder/IUidObserver.h
rename to libs/binder/include_activitymanager/binder/IUidObserver.h
diff --git a/libs/binder/ndk/ibinder.cpp b/libs/binder/ndk/ibinder.cpp
index 76afd4c..883403a 100644
--- a/libs/binder/ndk/ibinder.cpp
+++ b/libs/binder/ndk/ibinder.cpp
@@ -363,7 +363,8 @@
}
void AIBinder_DeathRecipient::TransferDeathRecipient::binderDied(const wp<IBinder>& who) {
- CHECK(who == mWho);
+ CHECK(who == mWho) << who.unsafe_get() << "(" << who.get_refs() << ") vs " << mWho.unsafe_get()
+ << " (" << mWho.get_refs() << ")";
mOnDied(mCookie);
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp
index 985d086..a51c987 100644
--- a/libs/binder/tests/binderRpcTest.cpp
+++ b/libs/binder/tests/binderRpcTest.cpp
@@ -406,6 +406,19 @@
EXPECT_EQ(BAD_TYPE, proc.rootBinder->transact(IBinder::PING_TRANSACTION, data, &reply, 0));
}
+TEST_P(BinderRpc, AppendSeparateFormats) {
+ auto proc = createRpcTestSocketServerProcess(1);
+
+ Parcel p1;
+ p1.markForBinder(proc.rootBinder);
+ p1.writeInt32(3);
+
+ Parcel p2;
+
+ EXPECT_EQ(BAD_TYPE, p1.appendFrom(&p2, 0, p2.dataSize()));
+ EXPECT_EQ(BAD_TYPE, p2.appendFrom(&p1, 0, p1.dataSize()));
+}
+
TEST_P(BinderRpc, UnknownTransaction) {
auto proc = createRpcTestSocketServerProcess(1);
Parcel data;
diff --git a/services/memtrackproxy/Android.bp b/services/memtrackproxy/Android.bp
index ee8b247..7d78f3b 100644
--- a/services/memtrackproxy/Android.bp
+++ b/services/memtrackproxy/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_native_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_native_license"],
+}
+
cc_library_shared {
name: "libmemtrackproxy",
shared_libs: [
diff --git a/services/memtrackproxy/MemtrackProxy.cpp b/services/memtrackproxy/MemtrackProxy.cpp
index 8da6e89..4676167 100644
--- a/services/memtrackproxy/MemtrackProxy.cpp
+++ b/services/memtrackproxy/MemtrackProxy.cpp
@@ -122,11 +122,9 @@
_aidl_return->clear();
- if (memtrack_aidl_instance_ ||
- (memtrack_aidl_instance_ = MemtrackProxy::MemtrackAidlInstance())) {
+ if (memtrack_aidl_instance_) {
return memtrack_aidl_instance_->getMemory(pid, type, _aidl_return);
- } else if (memtrack_hidl_instance_ ||
- (memtrack_hidl_instance_ = MemtrackProxy::MemtrackHidlInstance())) {
+ } else if (memtrack_hidl_instance_) {
ndk::ScopedAStatus aidl_status;
Return<void> ret = memtrack_hidl_instance_->getMemory(
diff --git a/services/memtrackproxy/test/Android.bp b/services/memtrackproxy/test/Android.bp
index e5ad8dc..f943761 100644
--- a/services/memtrackproxy/test/Android.bp
+++ b/services/memtrackproxy/test/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_native_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_native_license"],
+}
+
cc_test {
name: "memtrackproxy_test",
srcs: [
diff --git a/services/sensorservice/Android.bp b/services/sensorservice/Android.bp
index c769e97..9aecaff 100644
--- a/services/sensorservice/Android.bp
+++ b/services/sensorservice/Android.bp
@@ -49,6 +49,7 @@
"libhardware_legacy",
"libutils",
"liblog",
+ "libactivitymanager_aidl",
"libbatterystats_aidl",
"libbinder",
"libsensor",
@@ -69,8 +70,11 @@
generated_headers: ["framework-cppstream-protos"],
- // our public headers depend on libsensor and libsensorprivacy
- export_shared_lib_headers: ["libsensor", "libsensorprivacy"],
+ export_shared_lib_headers: [
+ "libactivitymanager_aidl",
+ "libsensor",
+ "libsensorprivacy",
+ ],
}
cc_binary {