Merge changes from topic "platform_shared"
* changes:
Re-export headers of libbinder from libinstalld
Add a shared header lib for libbinder/libbinder_ndk
diff --git a/cmds/lshal/DebugCommand.cpp b/cmds/lshal/DebugCommand.cpp
index 72958bd..ccf1ab1 100644
--- a/cmds/lshal/DebugCommand.cpp
+++ b/cmds/lshal/DebugCommand.cpp
@@ -28,7 +28,7 @@
}
std::string DebugCommand::getSimpleDescription() const {
- return "Debug a specified HAL.";
+ return "Debug a specified HIDL HAL.";
}
Status DebugCommand::parseArgs(const Arg &arg) {
@@ -78,7 +78,7 @@
"debug:\n"
" lshal debug [-E] <interface> [options [options [...]]] \n"
" Print debug information of a specified interface.\n"
- " -E: excludes debug output if HAL is actually a subclass.\n"
+ " -E: excludes debug output if HIDL HAL is actually a subclass.\n"
" <interface>: Format is `android.hardware.foo@1.0::IFoo/default`.\n"
" If instance name is missing `default` is used.\n"
" options: space separated options to IBase::debug.\n";
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp
index 22268ac..d5110f6 100644
--- a/cmds/lshal/ListCommand.cpp
+++ b/cmds/lshal/ListCommand.cpp
@@ -81,7 +81,7 @@
return "list";
}
std::string ListCommand::getSimpleDescription() const {
- return "List HALs.";
+ return "List HIDL HALs.";
}
std::string ListCommand::parseCmdline(pid_t pid) const {
@@ -295,21 +295,21 @@
}
mServicesTable.setDescription(
- "| All binderized services (registered with hwservicemanager)");
+ "| All HIDL binderized services (registered with hwservicemanager)");
mPassthroughRefTable.setDescription(
- "| All interfaces that getService() has ever returned as a passthrough interface;\n"
+ "| All HIDL interfaces getService() has ever returned as a passthrough interface;\n"
"| PIDs / processes shown below might be inaccurate because the process\n"
"| might have relinquished the interface or might have died.\n"
"| The Server / Server CMD column can be ignored.\n"
"| The Clients / Clients CMD column shows all process that have ever dlopen'ed \n"
"| the library and successfully fetched the passthrough implementation.");
mImplementationsTable.setDescription(
- "| All available passthrough implementations (all -impl.so files).\n"
+ "| All available HIDL passthrough implementations (all -impl.so files).\n"
"| These may return subclasses through their respective HIDL_FETCH_I* functions.");
mManifestHalsTable.setDescription(
- "| All HALs that are in VINTF manifest.");
+ "| All HIDL HALs that are in VINTF manifest.");
mLazyHalsTable.setDescription(
- "| All HALs that are declared in VINTF manifest:\n"
+ "| All HIDL HALs that are declared in VINTF manifest:\n"
"| - as hwbinder HALs but are not registered to hwservicemanager, and\n"
"| - as hwbinder/passthrough HALs with no implementation.");
}
@@ -903,11 +903,11 @@
thiz->mSelectedColumns.push_back(TableColumnType::VINTF);
return OK;
}, "print VINTF info. This column contains a comma-separated list of:\n"
- " - DM: if the HAL is in the device manifest\n"
- " - DC: if the HAL is in the device compatibility matrix\n"
- " - FM: if the HAL is in the framework manifest\n"
- " - FC: if the HAL is in the framework compatibility matrix\n"
- " - X: if the HAL is in none of the above lists"});
+ " - DM: if the HIDL HAL is in the device manifest\n"
+ " - DC: if the HIDL HAL is in the device compatibility matrix\n"
+ " - FM: if the HIDL HAL is in the framework manifest\n"
+ " - FC: if the HIDL HAL is in the framework compatibility matrix\n"
+ " - X: if the HIDL HAL is in none of the above lists"});
mOptions.push_back({'S', "service-status", no_argument, v++, [](ListCommand* thiz, const char*) {
thiz->mSelectedColumns.push_back(TableColumnType::SERVICE_STATUS);
return OK;
diff --git a/cmds/lshal/Lshal.cpp b/cmds/lshal/Lshal.cpp
index 99cb93a..bc99f4d 100644
--- a/cmds/lshal/Lshal.cpp
+++ b/cmds/lshal/Lshal.cpp
@@ -59,7 +59,8 @@
}
void Lshal::usage() {
- err() << "lshal: List and debug HALs." << std::endl << std::endl
+ err() << "lshal: List and debug HIDL HALs." << std::endl
+ << " (for AIDL HALs, see `dumpsys`)" << std::endl << std::endl
<< "commands:" << std::endl;
size_t nameMaxLength = 0;
diff --git a/cmds/lshal/WaitCommand.cpp b/cmds/lshal/WaitCommand.cpp
index 65b41b9..437a66a 100644
--- a/cmds/lshal/WaitCommand.cpp
+++ b/cmds/lshal/WaitCommand.cpp
@@ -29,7 +29,7 @@
}
std::string WaitCommand::getSimpleDescription() const {
- return "Wait for HAL to start if it is not already started.";
+ return "Wait for HIDL HAL to start if it is not already started.";
}
Status WaitCommand::parseArgs(const Arg &arg) {
diff --git a/libs/binder/include/binder/IBinder.h b/libs/binder/include/binder/IBinder.h
index c8fb448..31f63c8 100644
--- a/libs/binder/include/binder/IBinder.h
+++ b/libs/binder/include/binder/IBinder.h
@@ -60,6 +60,15 @@
EXTENSION_TRANSACTION = B_PACK_CHARS('_', 'E', 'X', 'T'),
DEBUG_PID_TRANSACTION = B_PACK_CHARS('_', 'P', 'I', 'D'),
+ // See android.os.IBinder.TWEET_TRANSACTION
+ // Most importantly, messages can be anything not exceeding 130 UTF-8
+ // characters, and callees should exclaim "jolly good message old boy!"
+ TWEET_TRANSACTION = B_PACK_CHARS('_', 'T', 'W', 'T'),
+
+ // See android.os.IBinder.LIKE_TRANSACTION
+ // Improve binder self-esteem.
+ LIKE_TRANSACTION = B_PACK_CHARS('_', 'L', 'I', 'K'),
+
// Corresponds to TF_ONE_WAY -- an asynchronous call.
FLAG_ONEWAY = 0x00000001,
diff --git a/libs/binder/tests/binderLibTest.cpp b/libs/binder/tests/binderLibTest.cpp
index a5261e5..e2193fa 100644
--- a/libs/binder/tests/binderLibTest.cpp
+++ b/libs/binder/tests/binderLibTest.cpp
@@ -21,6 +21,7 @@
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
+#include <thread>
#include <gtest/gtest.h>
@@ -28,6 +29,7 @@
#include <binder/IBinder.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
+#include <binder/ParcelRef.h>
#include <private/binder/binder_module.h>
#include <linux/sched.h>
@@ -916,6 +918,36 @@
}
}
+TEST_F(BinderLibTest, ParcelAllocatedOnAnotherThread) {
+ sp<IBinder> server = addServer();
+ ASSERT_TRUE(server != nullptr);
+
+ Parcel data;
+ sp<ParcelRef> reply = ParcelRef::create();
+
+ // when we have a Parcel which is deleted on another thread, if it gets
+ // deleted, it will tell the kernel this, and it will drop strong references
+ // to binder, so that we can't BR_ACQUIRE would fail
+ IPCThreadState::self()->createTransactionReference(reply.get());
+ ASSERT_EQ(NO_ERROR, server->transact(BINDER_LIB_TEST_CREATE_BINDER_TRANSACTION,
+ data,
+ reply.get()));
+
+ // we have sp to binder, but it is not actually acquired by kernel, the
+ // transaction is sitting on an out buffer
+ sp<IBinder> binder = reply->readStrongBinder();
+
+ std::thread([&] {
+ // without the transaction reference, this would cause the Parcel to be
+ // deallocated before the first thread flushes BR_ACQUIRE
+ reply = nullptr;
+ IPCThreadState::self()->flushCommands();
+ }).join();
+
+ ASSERT_NE(nullptr, binder);
+ ASSERT_EQ(NO_ERROR, binder->pingBinder());
+}
+
TEST_F(BinderLibTest, CheckNoHeaderMappedInUser) {
status_t ret;
Parcel data, reply;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index b15663e..4698ac6 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -596,13 +596,6 @@
if (mWindowManager != 0) {
mWindowManager->linkToDeath(static_cast<IBinder::DeathRecipient*>(this));
}
- sp<IBinder> input(defaultServiceManager()->getService(
- String16("inputflinger")));
- if (input == nullptr) {
- ALOGE("Failed to link to input service");
- } else {
- mInputFlinger = interface_cast<IInputFlinger>(input);
- }
// stop boot animation
// formerly we would just kill the process, but we now ask it to exit so it
@@ -613,7 +606,15 @@
LOG_EVENT_LONG(LOGTAG_SF_STOP_BOOTANIM,
ns2ms(systemTime(SYSTEM_TIME_MONOTONIC)));
- static_cast<void>(schedule([this] {
+ sp<IBinder> input(defaultServiceManager()->getService(String16("inputflinger")));
+
+ static_cast<void>(schedule([=] {
+ if (input == nullptr) {
+ ALOGE("Failed to link to input service");
+ } else {
+ mInputFlinger = interface_cast<IInputFlinger>(input);
+ }
+
readPersistentProperties();
mPowerAdvisor.onBootFinished();
mBootStage = BootStage::FINISHED;