Merge "Ignore callbacks from the non-active hardware composer"
diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk
index efc050b..d1e94ed 100644
--- a/cmds/dumpstate/Android.mk
+++ b/cmds/dumpstate/Android.mk
@@ -103,8 +103,7 @@
LOCAL_MODULE := dumpstate
-LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) \
- android.hardware.vibrator@1.0
+LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 67172b6..b323624 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -42,7 +42,6 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <android/hardware/dumpstate/1.0/IDumpstateDevice.h>
-#include <android/hardware/vibrator/1.0/IVibrator.h>
#include <cutils/native_handle.h>
#include <cutils/properties.h>
#include <openssl/sha.h>
@@ -54,8 +53,6 @@
#include "dumpstate.h"
using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
-using ::android::hardware::vibrator::V1_0::IVibrator;
-using VibratorStatus = ::android::hardware::vibrator::V1_0::Status;
// TODO: remove once moved to namespace
using android::os::dumpstate::CommandOptions;
@@ -1363,6 +1360,16 @@
.Build());
}
+static void Vibrate(int duration_ms) {
+ // clang-format off
+ RunCommand("", {"cmd", "vibrator", "vibrate", std::to_string(duration_ms), "dumpstate"},
+ CommandOptions::WithTimeout(10)
+ .Log("Vibrate: '%s'\n")
+ .Always()
+ .Build());
+ // clang-format on
+}
+
int main(int argc, char *argv[]) {
int do_add_date = 0;
int do_zip_file = 0;
@@ -1608,22 +1615,8 @@
fclose(cmdline);
}
- ::android::sp<IVibrator> vibrator = nullptr;
if (do_vibrate) {
- vibrator = IVibrator::getService();
-
- if (vibrator != nullptr) {
- // cancel previous vibration if any
- ::android::hardware::Return<VibratorStatus> offStatus = vibrator->off();
- if (!offStatus.isOk() || offStatus != VibratorStatus::OK) {
- MYLOGE("Vibrator off failed.");
- } else {
- ::android::hardware::Return<VibratorStatus> onStatus = vibrator->on(150);
- if (!onStatus.isOk() || onStatus != VibratorStatus::OK) {
- MYLOGE("Vibrator on failed.");
- }
- }
- }
+ Vibrate(150);
}
if (do_fb && ds.do_early_screenshot_) {
@@ -1803,21 +1796,9 @@
}
/* vibrate a few but shortly times to let user know it's finished */
- if (vibrator != nullptr) {
- // in case dumpstate magically completes before the above vibration
- ::android::hardware::Return<VibratorStatus> offStatus = vibrator->off();
- if (!offStatus.isOk() || offStatus != VibratorStatus::OK) {
- MYLOGE("Vibrator off failed.");
- } else {
- for (int i = 0; i < 3; i++) {
- ::android::hardware::Return<VibratorStatus> onStatus = vibrator->on(75);
- if (!onStatus.isOk() || onStatus != VibratorStatus::OK) {
- MYLOGE("Vibrator on failed.");
- break;
- }
- usleep((75 + 50) * 1000);
- }
- }
+ for (int i = 0; i < 3; i++) {
+ Vibrate(75);
+ usleep((75 + 50) * 1000);
}
/* tell activity manager we're done */
diff --git a/cmds/dumpsys/tests/dumpsys_test.cpp b/cmds/dumpsys/tests/dumpsys_test.cpp
index 01a2fa3..a596a67 100644
--- a/cmds/dumpsys/tests/dumpsys_test.cpp
+++ b/cmds/dumpsys/tests/dumpsys_test.cpp
@@ -79,6 +79,8 @@
const hidl_string&,
const sp<IServiceNotification>&));
MOCK_METHOD1(debugDump, R<void>(debugDump_cb));
+ MOCK_METHOD3(registerPassthroughClient, R<void>(
+ const hidl_string&, const hidl_string&, int32_t));
};
diff --git a/cmds/lshal/lshal.cpp b/cmds/lshal/lshal.cpp
index bc5eaf2..9998a46 100644
--- a/cmds/lshal/lshal.cpp
+++ b/cmds/lshal/lshal.cpp
@@ -28,31 +28,60 @@
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <hidl/ServiceManagement.h>
-template <typename A, typename B, typename C, typename D, typename E>
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hidl::manager::V1_0::IServiceManager;
+
+template <typename A, typename B, typename C, typename D, typename E, typename F>
void printColumn(std::stringstream &stream,
- const A &a, const B &b, const C &c, const D &d, const E &e) {
+ const A &a, const B &b, const C &c, const D &d, const E &, const F &f) {
using namespace ::std;
stream << left
<< setw(70) << a << "\t"
<< setw(20) << b << "\t"
<< setw(10) << c << "\t"
<< setw(5) << d << "\t"
- << setw(0) << e
+ // TODO(b/34984175): enable selecting columns
+ // << setw(16) << e << "\t"
+ << setw(0) << f
<< endl;
}
+template <typename A>
+std::string join(const A &components, const std::string &separator) {
+ std::stringstream out;
+ bool first = true;
+ for (const auto &component : components) {
+ if (!first) {
+ out << separator;
+ }
+ out << component;
+
+ first = false;
+ }
+ return out.str();
+}
+
std::string toHexString(uint64_t t) {
std::ostringstream os;
os << std::hex << std::setfill('0') << std::setw(16) << t;
return os.str();
}
-::android::status_t getReferencedPids(
+std::pair<hidl_string, hidl_string> split(const hidl_string &s, char c) {
+ const char *pos = strchr(s.c_str(), c);
+ if (pos == nullptr) {
+ return {s, {}};
+ }
+ return {hidl_string(s.c_str(), pos - s.c_str()), hidl_string(pos + 1)};
+}
+
+bool getReferencedPids(
pid_t serverPid, std::map<uint64_t, std::string> *objects) {
std::ifstream ifs("/d/binder/proc/" + std::to_string(serverPid));
if (!ifs.is_open()) {
- return ::android::PERMISSION_DENIED;
+ return false;
}
static const std::regex prefix("^\\s*node \\d+:\\s+u([0-9a-f]+)\\s+c([0-9a-f]+)\\s+");
@@ -77,66 +106,165 @@
(*objects)[ptr] += line.substr(pos + proc.size());
}
}
- return ::android::OK;
+ return true;
}
+void dumpAllLibraries(std::stringstream &stream, const std::string &mode,
+ const sp<IServiceManager> &manager) {
+ using namespace ::std;
+ using namespace ::android::hardware;
+ using namespace ::android::hidl::manager::V1_0;
+ using namespace ::android::hidl::base::V1_0;
+ auto ret = manager->list([&] (const auto &fqInstanceNames) {
+ for (const auto &fqInstanceName : fqInstanceNames) {
+ const auto pair = split(fqInstanceName, '/');
+ const auto &serviceName = pair.first;
+ const auto &instanceName = pair.second;
+ printColumn(stream,
+ serviceName,
+ instanceName,
+ mode,
+ "N/A",
+ "N/A",
+ "N/A");
+ }
+ });
+ if (!ret.isOk()) {
+ cerr << "Error: Failed to call debugDump on defaultServiceManager(): "
+ << ret.description() << endl;
+ }
+}
+
+void dumpPassthrough(std::stringstream &stream, const std::string &mode,
+ const sp<IServiceManager> &manager) {
+ using namespace ::std;
+ using namespace ::android::hardware;
+ using namespace ::android::hidl::manager::V1_0;
+ using namespace ::android::hidl::base::V1_0;
+ auto ret = manager->debugDump([&] (const auto &infos) {
+ for (const auto &info : infos) {
+
+ printColumn(stream,
+ info.interfaceName,
+ info.instanceName,
+ mode,
+ info.clientPids.size() == 1 ? std::to_string(info.clientPids[0]) : "N/A",
+ "N/A",
+ join(info.clientPids, " "));
+ }
+ });
+ if (!ret.isOk()) {
+ cerr << "Error: Failed to call debugDump on defaultServiceManager(): "
+ << ret.description() << endl;
+ }
+}
+
+void dumpBinderized(std::stringstream &stream, const std::string &mode,
+ const sp<IServiceManager> &manager) {
+ using namespace ::std;
+ using namespace ::android::hardware;
+ using namespace ::android::hidl::manager::V1_0;
+ using namespace ::android::hidl::base::V1_0;
+ auto listRet = manager->list([&] (const auto &fqInstanceNames) {
+ // server pid, .ptr value of binder object, child pids
+ std::map<std::string, DebugInfo> allDebugInfos;
+ std::map<pid_t, std::map<uint64_t, std::string>> allPids;
+ for (const auto &fqInstanceName : fqInstanceNames) {
+ const auto pair = split(fqInstanceName, '/');
+ const auto &serviceName = pair.first;
+ const auto &instanceName = pair.second;
+ auto getRet = manager->get(serviceName, instanceName);
+ if (!getRet.isOk()) {
+ cerr << "Warning: Skipping \"" << fqInstanceName << "\": "
+ << "cannot be fetched from service manager:"
+ << getRet.description() << endl;
+ continue;
+ }
+ sp<IBase> service = getRet;
+ if (service == nullptr) {
+ cerr << "Warning: Skipping \"" << fqInstanceName << "\": "
+ << "cannot be fetched from service manager (null)";
+ continue;
+ }
+ auto debugRet = service->getDebugInfo([&] (const auto &debugInfo) {
+ allDebugInfos[fqInstanceName] = debugInfo;
+ if (debugInfo.pid >= 0) {
+ allPids[static_cast<pid_t>(debugInfo.pid)].clear();
+ }
+ });
+ if (!debugRet.isOk()) {
+ cerr << "Warning: Skipping \"" << fqInstanceName << "\": "
+ << "debugging information cannot be retrieved:"
+ << debugRet.description() << endl;
+ }
+ }
+ for (auto &pair : allPids) {
+ pid_t serverPid = pair.first;
+ if (!getReferencedPids(serverPid, &allPids[serverPid])) {
+ std::cerr << "Warning: no information for PID " << serverPid
+ << ", are you root?" << std::endl;
+ }
+ }
+ for (const auto &fqInstanceName : fqInstanceNames) {
+ const auto pair = split(fqInstanceName, '/');
+ const auto &serviceName = pair.first;
+ const auto &instanceName = pair.second;
+ auto it = allDebugInfos.find(fqInstanceName);
+ if (it == allDebugInfos.end()) {
+ printColumn(stream,
+ serviceName,
+ instanceName,
+ mode,
+ "N/A",
+ "N/A",
+ ""
+ );
+ continue;
+ }
+ const DebugInfo &info = it->second;
+ printColumn(stream,
+ serviceName,
+ instanceName,
+ mode,
+ info.pid < 0 ? "N/A" : std::to_string(info.pid),
+ info.ptr == 0 ? "N/A" : toHexString(info.ptr),
+ info.pid < 0 || info.ptr == 0 ? "" : allPids[info.pid][info.ptr]
+ );
+ }
+
+ });
+ if (!listRet.isOk()) {
+ cerr << "Error: Failed to list services for " << mode << ": "
+ << listRet.description() << endl;
+ }
+}
int dump() {
using namespace ::std;
using namespace ::android::hardware;
- using namespace ::android::hidl::manager::V1_0;
-
- std::map<std::string, ::android::sp<IServiceManager>> mapping = {
- {"hwbinder", defaultServiceManager()},
- {"passthrough", getPassthroughServiceManager()}
- };
std::stringstream stream;
stream << "All services:" << endl;
stream << left;
- printColumn(stream, "Interface", "Instance", "Transport", "Server", "Clients");
+ printColumn(stream, "Interface", "Instance", "Transport", "Server", "PTR", "Clients");
- for (const auto &pair : mapping) {
- const std::string &mode = pair.first;
- const ::android::sp<IServiceManager> &manager = pair.second;
-
- if (manager == nullptr) {
- cerr << "Failed to get IServiceManager for " << mode << "!" << endl;
- continue;
- }
-
- auto ret = manager->debugDump([&](const auto ®istered) {
- // server pid, .ptr value of binder object, child pids
- std::map<pid_t, std::map<uint64_t, std::string>> allPids;
- for (const auto &info : registered) {
- if (info.pid < 0) {
- continue;
- }
- pid_t serverPid = info.pid;
- allPids[serverPid].clear();
- }
- for (auto &pair : allPids) {
- pid_t serverPid = pair.first;
- if (getReferencedPids(serverPid, &allPids[serverPid]) != ::android::OK) {
- std::cerr << "Warning: no information for PID " << serverPid
- << ", are you root?" << std::endl;
- }
- }
- for (const auto &info : registered) {
- printColumn(stream,
- info.interfaceName,
- info.instanceName.empty() ? "N/A" : info.instanceName,
- mode,
- info.pid < 0 ? "N/A" : std::to_string(info.pid),
- info.pid < 0 || info.ptr == 0 ? "" : allPids[info.pid][info.ptr]);
- }
- });
- if (!ret.isOk()) {
- cerr << "Failed to list services for " << mode << ": "
- << ret.description() << endl;
- }
+ auto bManager = defaultServiceManager();
+ if (bManager == nullptr) {
+ cerr << "Failed to get defaultServiceManager()!" << endl;
+ } else {
+ dumpBinderized(stream, "hwbinder", bManager);
+ // Passthrough PIDs are registered to the binderized manager as well.
+ dumpPassthrough(stream, "passthrough", bManager);
}
+
+ auto pManager = getPassthroughServiceManager();
+ if (pManager == nullptr) {
+ cerr << "Failed to get getPassthroughServiceManager()!" << endl;
+ } else {
+ dumpAllLibraries(stream, "passthrough", pManager);
+ }
+
cout << stream.rdbuf();
return 0;
}
diff --git a/include/ui/GraphicBufferMapper.h b/include/ui/GraphicBufferMapper.h
index 8e93f72..001769f 100644
--- a/include/ui/GraphicBufferMapper.h
+++ b/include/ui/GraphicBufferMapper.h
@@ -39,7 +39,9 @@
public:
static inline GraphicBufferMapper& get() { return getInstance(); }
+ // This may NOT work on devices without a valid Gralloc2::Mapper.
status_t registerBuffer(buffer_handle_t handle);
+
status_t registerBuffer(const GraphicBuffer* buffer);
status_t unregisterBuffer(buffer_handle_t handle);
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index b0ed2df..a3b6e18 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -63,7 +63,14 @@
if (mMapper->valid()) {
error = static_cast<gralloc1_error_t>(mMapper->retain(handle));
} else {
+ // This always returns GRALLOC1_BAD_HANDLE when handle is from a
+ // remote process and mDevice is backed by Gralloc1On0Adapter.
error = mDevice->retain(handle);
+ if (error == GRALLOC1_ERROR_BAD_HANDLE &&
+ mDevice->hasCapability(GRALLOC1_CAPABILITY_ON_ADAPTER)) {
+ ALOGE("registerBuffer by handle is not supported with "
+ "Gralloc1On0Adapter");
+ }
}
ALOGW_IF(error != GRALLOC1_ERROR_NONE, "registerBuffer(%p) failed: %d",
diff --git a/libs/vr/libvrflinger/Android.mk b/libs/vr/libvrflinger/Android.mk
index d90e85a..1706f30 100644
--- a/libs/vr/libvrflinger/Android.mk
+++ b/libs/vr/libvrflinger/Android.mk
@@ -77,11 +77,6 @@
LOCAL_CFLAGS += -DTRACE=0
LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_GRAPHICS
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-ifeq ($(TARGET_USES_QCOM_BSP), true)
- LOCAL_C_INCLUDES += hardware/qcom/display/libgralloc
- LOCAL_C_INCLUDES += hardware/qcom/display/libqdutils
- LOCAL_SHARED_LIBRARIES += libqdutils
-endif
LOCAL_SHARED_LIBRARIES := $(sharedLibraries)
LOCAL_WHOLE_STATIC_LIBRARIES := $(staticLibraries)
LOCAL_MODULE := libvrflinger
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 32f777d..a23056c 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -739,8 +739,10 @@
const InstanceData& data = GetData(physicalDevice);
static const std::array<VkExtensionProperties, 2> loader_extensions = {{
// WSI extensions
+#if 0 // Remove this "#if 0" once the VK_KHR_incremental_present extension is ratified
{VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME,
VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION},
+#endif
{VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME,
VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION},
}};