diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2020-05-27 21:06:17 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-05-27 21:06:17 +0000 |
commit | 04b0e08cc1804732e023060b8fe756d9af31aada (patch) | |
tree | 0d0c246fd642ff98cb1e4b5d40221f616251fb16 | |
parent | 9e7b2ab86ede9474b0aa071aa7399ce3c54fd9d5 (diff) | |
parent | b776fa4591f5ce9b99f6e2e2dbf05f625e9adc2a (diff) | |
download | native-04b0e08cc1804732e023060b8fe756d9af31aada.tar.gz |
Merge "Snap for 6533464 from 839fc143377282191fc2bc12811123fb225e913d to sdk-release" into sdk-releaseplatform-tools-30.0.3platform-tools-30.0.2
40 files changed, 184 insertions, 38 deletions
diff --git a/METADATA b/METADATA new file mode 100644 index 0000000000..d97975ca3b --- /dev/null +++ b/METADATA @@ -0,0 +1,3 @@ +third_party { + license_type: NOTICE +} diff --git a/cmds/cmd/cmd.cpp b/cmds/cmd/cmd.cpp index 8dad47502f..be2c702034 100644 --- a/cmds/cmd/cmd.cpp +++ b/cmds/cmd/cmd.cpp @@ -185,7 +185,7 @@ int cmdMain(const std::vector<std::string_view>& argv, TextOutput& outputLog, Te int argc = argv.size(); if (argc == 0) { - errorLog << "cmd: No service specified; use -l to list all services" << endl; + errorLog << "cmd: No service specified; use -l to list all running services. Use -w to start and wait for a service." << endl; return 20; } @@ -203,14 +203,22 @@ int cmdMain(const std::vector<std::string_view>& argv, TextOutput& outputLog, Te return 0; } - const auto cmd = argv[0]; + bool waitForService = ((argc > 1) && (argv[0] == "-w")); + int serviceIdx = (waitForService) ? 1 : 0; + const auto cmd = argv[serviceIdx]; Vector<String16> args; String16 serviceName = String16(cmd.data(), cmd.size()); - for (int i = 1; i < argc; i++) { + for (int i = serviceIdx + 1; i < argc; i++) { args.add(String16(argv[i].data(), argv[i].size())); } - sp<IBinder> service = sm->checkService(serviceName); + sp<IBinder> service; + if(waitForService) { + service = sm->waitForService(serviceName); + } else { + service = sm->checkService(serviceName); + } + if (service == nullptr) { if (runMode == RunMode::kStandalone) { ALOGW("Can't find service %.*s", static_cast<int>(cmd.size()), cmd.data()); diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index f535605dea..f64ddc3b0f 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -163,6 +163,7 @@ void add_mountinfo(); #define OTA_METADATA_DIR "/metadata/ota" #define SNAPSHOTCTL_LOG_DIR "/data/misc/snapshotctl_log" #define LINKERCONFIG_DIR "/linkerconfig" +#define PACKAGE_DEX_USE_LIST "/data/system/package-dex-usage.list" // TODO(narayan): Since this information has to be kept in sync // with tombstoned, we should just put it in a common header. @@ -1574,6 +1575,7 @@ static Dumpstate::RunStatus DumpstateDefault() { if (!PropertiesHelper::IsUserBuild()) { ds.AddDir(PROFILE_DATA_DIR_CUR, true); ds.AddDir(PROFILE_DATA_DIR_REF, true); + ds.AddZipEntry(ZIP_ROOT_DIR + PACKAGE_DEX_USE_LIST, PACKAGE_DEX_USE_LIST); } ds.AddDir(PREREBOOT_DATA_DIR, false); add_mountinfo(); diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp index 3c0443595e..82be00747a 100644 --- a/cmds/installd/dexopt.cpp +++ b/cmds/installd/dexopt.cpp @@ -318,6 +318,16 @@ static const char* kJitZygoteImage = // Phenotype property name for enabling profiling the boot class path. static const char* PROFILE_BOOT_CLASS_PATH = "profilebootclasspath"; +static bool IsBootClassPathProfilingEnable() { + std::string profile_boot_class_path = GetProperty("dalvik.vm.profilebootclasspath", ""); + profile_boot_class_path = + server_configurable_flags::GetServerConfigurableFlag( + RUNTIME_NATIVE_BOOT_NAMESPACE, + PROFILE_BOOT_CLASS_PATH, + /*default_value=*/ profile_boot_class_path); + return profile_boot_class_path == "true"; +} + class RunDex2Oat : public ExecVHelper { public: RunDex2Oat(int zip_fd, @@ -450,14 +460,7 @@ class RunDex2Oat : public ExecVHelper { ENABLE_JITZYGOTE_IMAGE, /*default_value=*/ ""); - std::string profile_boot_class_path = GetProperty("dalvik.vm.profilebootclasspath", ""); - profile_boot_class_path = - server_configurable_flags::GetServerConfigurableFlag( - RUNTIME_NATIVE_BOOT_NAMESPACE, - PROFILE_BOOT_CLASS_PATH, - /*default_value=*/ profile_boot_class_path); - - if (use_jitzygote_image == "true" || profile_boot_class_path == "true") { + if (use_jitzygote_image == "true" || IsBootClassPathProfilingEnable()) { boot_image = StringPrintf("--boot-image=%s", kJitZygoteImage); } else { boot_image = MapPropertyToArg("dalvik.vm.boot-image", "--boot-image=%s"); @@ -896,7 +899,15 @@ static bool analyze_profiles(uid_t uid, const std::string& package_name, } RunProfman profman_merge; - profman_merge.SetupMerge(profiles_fd, reference_profile_fd); + const std::vector<unique_fd>& apk_fds = std::vector<unique_fd>(); + const std::vector<std::string>& dex_locations = std::vector<std::string>(); + profman_merge.SetupMerge( + profiles_fd, + reference_profile_fd, + apk_fds, + dex_locations, + /* for_snapshot= */ false, + IsBootClassPathProfilingEnable()); pid_t pid = fork(); if (pid == 0) { /* child -- drop privileges before continuing */ @@ -2810,7 +2821,13 @@ static bool create_app_profile_snapshot(int32_t app_id, } RunProfman args; - args.SetupMerge(profiles_fd, snapshot_fd, apk_fds, dex_locations, /*for_snapshot=*/true); + // This is specifically a snapshot for an app, so don't use boot image profiles. + args.SetupMerge(profiles_fd, + snapshot_fd, + apk_fds, + dex_locations, + /* for_snapshot= */ true, + /* for_boot_image= */ false); pid_t pid = fork(); if (pid == 0) { /* child -- drop privileges before continuing */ diff --git a/cmds/servicemanager/Access.cpp b/cmds/servicemanager/Access.cpp index b7e520f2f1..1bbde2376b 100644 --- a/cmds/servicemanager/Access.cpp +++ b/cmds/servicemanager/Access.cpp @@ -31,7 +31,7 @@ constexpr bool kIsVendor = false; #endif static std::string getPidcon(pid_t pid) { - android_errorWriteLog(0x534e4554, "121035042"); + if (pid != getpid()) return ""; char* lookup = nullptr; if (getpidcon(pid, &lookup) < 0) { diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp index cbbea128a6..1f9892a262 100644 --- a/cmds/servicemanager/ServiceManager.cpp +++ b/cmds/servicemanager/ServiceManager.cpp @@ -49,14 +49,28 @@ static bool isVintfDeclared(const std::string& name) { const std::string iface = name.substr(lastDot+1, firstSlash-lastDot-1); const std::string instance = name.substr(firstSlash+1); - for (const auto& manifest : { - vintf::VintfObject::GetDeviceHalManifest(), - vintf::VintfObject::GetFrameworkHalManifest() + struct ManifestWithDescription { + std::shared_ptr<const vintf::HalManifest> manifest; + const char* description; + }; + for (const ManifestWithDescription& mwd : { + ManifestWithDescription{ vintf::VintfObject::GetDeviceHalManifest(), "device" }, + ManifestWithDescription{ vintf::VintfObject::GetFrameworkHalManifest(), "framework" }, }) { - if (manifest != nullptr && manifest->hasAidlInstance(package, iface, instance)) { + if (mwd.manifest == nullptr) { + LOG(ERROR) << "NULL VINTF MANIFEST!: " << mwd.description; + // note, we explicitly do not retry here, so that we can detect VINTF + // or other bugs (b/151696835) + continue; + } + if (mwd.manifest->hasAidlInstance(package, iface, instance)) { + LOG(INFO) << "Found " << name << " in " << mwd.description << " VINTF manifest."; return true; } } + + // Although it is tested, explicitly rebuilding qualified name, in case it + // becomes something unexpected. LOG(ERROR) << "Could not find " << package << "." << iface << "/" << instance << " in the VINTF manifest."; return false; @@ -72,13 +86,20 @@ static bool meetsDeclarationRequirements(const sp<IBinder>& binder, const std::s #endif // !VENDORSERVICEMANAGER ServiceManager::ServiceManager(std::unique_ptr<Access>&& access) : mAccess(std::move(access)) { -#ifndef VENDORSERVICEMANAGER - // can process these at any times, don't want to delay first VINTF client - std::thread([] { - vintf::VintfObject::GetDeviceHalManifest(); - vintf::VintfObject::GetFrameworkHalManifest(); - }).detach(); -#endif // !VENDORSERVICEMANAGER +// TODO(b/151696835): reenable performance hack when we solve bug, since with +// this hack and other fixes, it is unlikely we will see even an ephemeral +// failure when the manifest parse fails. The goal is that the manifest will +// be read incorrectly and cause the process trying to register a HAL to +// fail. If this is in fact an early boot kernel contention issue, then we +// will get no failure, and by its absence, be signalled to invest more +// effort in re-adding this performance hack. +// #ifndef VENDORSERVICEMANAGER +// // can process these at any times, don't want to delay first VINTF client +// std::thread([] { +// vintf::VintfObject::GetDeviceHalManifest(); +// vintf::VintfObject::GetFrameworkHalManifest(); +// }).detach(); +// #endif // !VENDORSERVICEMANAGER } ServiceManager::~ServiceManager() { // this should only happen in tests @@ -547,4 +568,4 @@ Status ServiceManager::tryUnregisterService(const std::string& name, const sp<IB return Status::ok(); } -} // namespace android
\ No newline at end of file +} // namespace android diff --git a/headers/Android.bp b/headers/Android.bp index 82bc8a15f7..8f41c2b75b 100644 --- a/headers/Android.bp +++ b/headers/Android.bp @@ -17,4 +17,12 @@ cc_library_headers { "libutils_headers", "libstagefright_foundation_headers", ], + min_sdk_version: "29", + + host_supported: true, + target: { + darwin: { + enabled: false, + }, + }, } diff --git a/include/android/trace.h b/include/android/trace.h index d59690ab2e..dbad6f6f21 100644 --- a/include/android/trace.h +++ b/include/android/trace.h @@ -115,7 +115,7 @@ void ATrace_setCounter(const char* counterName, int64_t counterValue) __INTRODUC #endif /* __ANDROID_API__ >= 29 */ #ifdef __cplusplus -}; +} #endif #endif // ANDROID_NATIVE_TRACE_H diff --git a/libs/arect/Android.bp b/libs/arect/Android.bp index 2518b1427d..f66673f6ad 100644 --- a/libs/arect/Android.bp +++ b/libs/arect/Android.bp @@ -35,4 +35,5 @@ cc_library_static { enabled: true, }, }, + min_sdk_version: "29", } diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp index c2991cd5bc..290a3a6f03 100644 --- a/libs/binder/Android.bp +++ b/libs/binder/Android.bp @@ -28,6 +28,7 @@ cc_library_headers { "libcutils_headers", "libutils_headers", ], + min_sdk_version: "29", } // These interfaces are android-specific implementation unrelated to binder @@ -152,6 +153,7 @@ cc_library { sanitize: { misc_undefined: ["integer"], }, + min_sdk_version: "29", } // AIDL interface between libbinder and framework.jar diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 9888b59854..05f43e3658 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -85,8 +85,8 @@ private: sp<AidlServiceManager> mTheRealServiceManager; }; -static std::once_flag gSmOnce; -static sp<IServiceManager> gDefaultServiceManager; +[[clang::no_destroy]] static std::once_flag gSmOnce; +[[clang::no_destroy]] static sp<IServiceManager> gDefaultServiceManager; sp<IServiceManager> defaultServiceManager() { @@ -95,6 +95,7 @@ sp<IServiceManager> defaultServiceManager() while (sm == nullptr) { sm = interface_cast<AidlServiceManager>(ProcessState::self()->getContextObject(nullptr)); if (sm == nullptr) { + ALOGE("Waiting 1s on context object on %s.", ProcessState::self()->getDriverName().c_str()); sleep(1); } } @@ -205,6 +206,10 @@ ServiceManagerShim::ServiceManagerShim(const sp<AidlServiceManager>& impl) : mTheRealServiceManager(impl) {} +// This implementation could be simplified and made more efficient by delegating +// to waitForService. However, this changes the threading structure in some +// cases and could potentially break prebuilts. Once we have higher logistical +// complexity, this could be attempted. sp<IBinder> ServiceManagerShim::getService(const String16& name) const { static bool gSystemBootCompleted = false; diff --git a/libs/binder/include/binder/IInterface.h b/libs/binder/include/binder/IInterface.h index 79d9b79915..cabfc7ff8e 100644 --- a/libs/binder/include/binder/IInterface.h +++ b/libs/binder/include/binder/IInterface.h @@ -20,6 +20,8 @@ #include <binder/Binder.h> +#include <assert.h> + namespace android { // ---------------------------------------------------------------------- @@ -155,7 +157,11 @@ public: \ std::unique_ptr<I##INTERFACE> I##INTERFACE::default_impl; \ bool I##INTERFACE::setDefaultImpl(std::unique_ptr<I##INTERFACE> impl)\ { \ - if (!I##INTERFACE::default_impl && impl) { \ + /* Only one user of this interface can use this function */ \ + /* at a time. This is a heuristic to detect if two different */ \ + /* users in the same process use this function. */ \ + assert(!I##INTERFACE::default_impl); \ + if (impl) { \ I##INTERFACE::default_impl = std::move(impl); \ return true; \ } \ diff --git a/libs/binder/include/binder/Parcelable.h b/libs/binder/include/binder/Parcelable.h index a9166e2408..c1132795de 100644 --- a/libs/binder/include/binder/Parcelable.h +++ b/libs/binder/include/binder/Parcelable.h @@ -52,6 +52,12 @@ public: // // Returns android::OK on success and an appropriate error otherwise. virtual status_t readFromParcel(const Parcel* parcel) = 0; + + // 'Stable' means this parcelable is guaranteed to be stable for multiple years. + // It must be guaranteed by setting stability field in aidl_interface. + // WARNING: isStable() is only expected to be overridden by auto-generated code. + // Returns true if this parcelable is stable. + virtual bool isStable() const { return false; } }; // class Parcelable #if defined(__clang__) diff --git a/libs/binder/ndk/test/Android.bp b/libs/binder/ndk/tests/Android.bp index 5f5265c90e..5f5265c90e 100644 --- a/libs/binder/ndk/test/Android.bp +++ b/libs/binder/ndk/tests/Android.bp diff --git a/libs/binder/ndk/test/AndroidTest.xml b/libs/binder/ndk/tests/AndroidTest.xml index 89646f7776..89646f7776 100644 --- a/libs/binder/ndk/test/AndroidTest.xml +++ b/libs/binder/ndk/tests/AndroidTest.xml diff --git a/libs/binder/ndk/test/IBinderNdkUnitTest.aidl b/libs/binder/ndk/tests/IBinderNdkUnitTest.aidl index 6e8e463ff1..6e8e463ff1 100644 --- a/libs/binder/ndk/test/IBinderNdkUnitTest.aidl +++ b/libs/binder/ndk/tests/IBinderNdkUnitTest.aidl diff --git a/libs/binder/ndk/test/IBinderVendorDoubleLoadTest.aidl b/libs/binder/ndk/tests/IBinderVendorDoubleLoadTest.aidl index 3a5bd9cc56..3a5bd9cc56 100644 --- a/libs/binder/ndk/test/IBinderVendorDoubleLoadTest.aidl +++ b/libs/binder/ndk/tests/IBinderVendorDoubleLoadTest.aidl diff --git a/libs/binder/ndk/test/IEmpty.aidl b/libs/binder/ndk/tests/IEmpty.aidl index 95e4341531..95e4341531 100644 --- a/libs/binder/ndk/test/IEmpty.aidl +++ b/libs/binder/ndk/tests/IEmpty.aidl diff --git a/libs/binder/ndk/test/binderVendorDoubleLoadTest.cpp b/libs/binder/ndk/tests/binderVendorDoubleLoadTest.cpp index ad78e319a2..ad78e319a2 100644 --- a/libs/binder/ndk/test/binderVendorDoubleLoadTest.cpp +++ b/libs/binder/ndk/tests/binderVendorDoubleLoadTest.cpp diff --git a/libs/binder/ndk/test/iface.cpp b/libs/binder/ndk/tests/iface.cpp index 64832f3081..64832f3081 100644 --- a/libs/binder/ndk/test/iface.cpp +++ b/libs/binder/ndk/tests/iface.cpp diff --git a/libs/binder/ndk/test/include/iface/iface.h b/libs/binder/ndk/tests/include/iface/iface.h index cdf5493216..cdf5493216 100644 --- a/libs/binder/ndk/test/include/iface/iface.h +++ b/libs/binder/ndk/tests/include/iface/iface.h diff --git a/libs/binder/ndk/test/libbinder_ndk_unit_test.cpp b/libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp index fd30d87c76..fd30d87c76 100644 --- a/libs/binder/ndk/test/libbinder_ndk_unit_test.cpp +++ b/libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp diff --git a/libs/binderthreadstate/Android.bp b/libs/binderthreadstate/Android.bp index 5eb509c4a0..88752ee87e 100644 --- a/libs/binderthreadstate/Android.bp +++ b/libs/binderthreadstate/Android.bp @@ -22,7 +22,7 @@ cc_library_static { shared_libs: [ "libbinder", - "libhidlbase", // libhwbinder is in here + "libhidlbase", // libhwbinder is in here ], export_include_dirs: ["include"], @@ -31,6 +31,7 @@ cc_library_static { "-Wall", "-Werror", ], + min_sdk_version: "29", } hidl_package_root { diff --git a/libs/gui/Android.bp b/libs/gui/Android.bp index f3d5aab089..9fc16ba930 100644 --- a/libs/gui/Android.bp +++ b/libs/gui/Android.bp @@ -27,6 +27,7 @@ cc_library_headers { "android.hardware.graphics.bufferqueue@1.0", "android.hardware.graphics.bufferqueue@2.0", ], + min_sdk_version: "29", } cc_library_shared { @@ -106,6 +107,11 @@ cc_library_shared { cc_library_static { name: "libgui_bufferqueue_static", vendor_available: true, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + ], + min_sdk_version: "29", cflags: [ "-DNO_BUFFERHUB", diff --git a/libs/gui/OWNERS b/libs/gui/OWNERS index b77dfda5e9..cbb4b9718e 100644 --- a/libs/gui/OWNERS +++ b/libs/gui/OWNERS @@ -1,6 +1,7 @@ adyabr@google.com akrulec@google.com alecmouri@google.com +chaviw@google.com chrisforbes@google.com jessehall@google.com lpy@google.com @@ -9,3 +10,6 @@ racarr@google.com steventhomas@google.com stoza@google.com vhau@google.com +vishnun@google.com + +per-file EndToEndNativeInputTest.cpp = svv@google.com diff --git a/libs/gui/sysprop/Android.bp b/libs/gui/sysprop/Android.bp index e7f7c1fc86..64b1eacaa2 100644 --- a/libs/gui/sysprop/Android.bp +++ b/libs/gui/sysprop/Android.bp @@ -4,4 +4,7 @@ sysprop_library { api_packages: ["android.sysprop"], property_owner: "Platform", vendor_available: true, + cpp: { + min_sdk_version: "29", + }, } diff --git a/libs/math/Android.bp b/libs/math/Android.bp index 693bace1f4..3b1edcb43a 100644 --- a/libs/math/Android.bp +++ b/libs/math/Android.bp @@ -16,6 +16,14 @@ cc_library_static { name: "libmath", host_supported: true, vendor_available: true, + apex_available: [ + "//apex_available:platform", + "com.android.media", + "com.android.media.swcodec", + "com.android.neuralnetworks", + ], + min_sdk_version: "29", + export_include_dirs: ["include"], } diff --git a/libs/nativebase/Android.bp b/libs/nativebase/Android.bp index 7375a2bc2f..9e7e4a2291 100644 --- a/libs/nativebase/Android.bp +++ b/libs/nativebase/Android.bp @@ -25,5 +25,6 @@ cc_library_headers { windows: { enabled: true, }, - } + }, + min_sdk_version: "29", } diff --git a/libs/nativewindow/Android.bp b/libs/nativewindow/Android.bp index 55400c7b32..894f45a4c6 100644 --- a/libs/nativewindow/Android.bp +++ b/libs/nativewindow/Android.bp @@ -25,6 +25,7 @@ cc_library_headers { name: "libnativewindow_headers", export_include_dirs: ["include"], vendor_available: true, + min_sdk_version: "29", } ndk_library { diff --git a/libs/renderengine/gl/GLESRenderEngine.cpp b/libs/renderengine/gl/GLESRenderEngine.cpp index d2a7525113..2b83a28157 100644 --- a/libs/renderengine/gl/GLESRenderEngine.cpp +++ b/libs/renderengine/gl/GLESRenderEngine.cpp @@ -424,6 +424,7 @@ GLESRenderEngine::GLESRenderEngine(uint32_t featureFlags, EGLDisplay display, EG mFlushTracer = std::make_unique<FlushTracer>(this); } mImageManager = std::make_unique<ImageManager>(this); + mImageManager->initThread(); mDrawingBuffer = createFramebuffer(); } diff --git a/libs/renderengine/gl/ImageManager.cpp b/libs/renderengine/gl/ImageManager.cpp index 5af0e4f857..62566494f0 100644 --- a/libs/renderengine/gl/ImageManager.cpp +++ b/libs/renderengine/gl/ImageManager.cpp @@ -14,6 +14,9 @@ * limitations under the License. */ +//#define LOG_NDEBUG 0 +#undef LOG_TAG +#define LOG_TAG "RenderEngine" #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include <pthread.h> @@ -27,7 +30,10 @@ namespace android { namespace renderengine { namespace gl { -ImageManager::ImageManager(GLESRenderEngine* engine) : mEngine(engine) { +ImageManager::ImageManager(GLESRenderEngine* engine) : mEngine(engine) {} + +void ImageManager::initThread() { + mThread = std::thread([this]() { threadMain(); }); pthread_setname_np(mThread.native_handle(), "ImageManager"); // Use SCHED_FIFO to minimize jitter struct sched_param param = {0}; @@ -133,6 +139,8 @@ void ImageManager::threadMain() { entry.barrier->condition.notify_one(); } } + + ALOGD("Reached end of threadMain, terminating ImageManager thread!"); } } // namespace gl diff --git a/libs/renderengine/gl/ImageManager.h b/libs/renderengine/gl/ImageManager.h index b5ba554c4f..be67de8367 100644 --- a/libs/renderengine/gl/ImageManager.h +++ b/libs/renderengine/gl/ImageManager.h @@ -39,6 +39,10 @@ public: }; ImageManager(GLESRenderEngine* engine); ~ImageManager(); + // Starts the background thread for the ImageManager + // We need this to guarantee that the class is fully-constructed before the + // thread begins running. + void initThread(); void cacheAsync(const sp<GraphicBuffer>& buffer, const std::shared_ptr<Barrier>& barrier) EXCLUDES(mMutex); status_t cache(const sp<GraphicBuffer>& buffer); @@ -57,7 +61,7 @@ private: void queueOperation(const QueueEntry&& entry); void threadMain(); GLESRenderEngine* const mEngine; - std::thread mThread = std::thread([this]() { threadMain(); }); + std::thread mThread; std::condition_variable_any mCondition; std::mutex mMutex; std::queue<QueueEntry> mQueue GUARDED_BY(mMutex); diff --git a/libs/ui/Android.bp b/libs/ui/Android.bp index 080336b890..8388743c22 100644 --- a/libs/ui/Android.bp +++ b/libs/ui/Android.bp @@ -135,6 +135,7 @@ cc_library_shared { "libhardware_headers", "libui_headers", ], + min_sdk_version: "29", } cc_library_headers { @@ -153,6 +154,7 @@ cc_library_headers { export_header_lib_headers: [ "libnativewindow_headers", ], + min_sdk_version: "29", } // defaults to enable VALIDATE_REGIONS traces diff --git a/libs/vr/libpdx/Android.bp b/libs/vr/libpdx/Android.bp index 23a4224e05..24ba83048d 100644 --- a/libs/vr/libpdx/Android.bp +++ b/libs/vr/libpdx/Android.bp @@ -2,6 +2,7 @@ cc_library_headers { name: "libpdx_headers", export_include_dirs: ["private"], vendor_available: true, + min_sdk_version: "29", } cc_library_static { diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp index 5ce72b0879..0afcc97b2c 100644 --- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp @@ -261,7 +261,7 @@ uint32_t OutputLayer::calculateOutputRelativeBufferTransform() const { * (NOTE: the matrices are multiplied in reverse order) */ const ui::Transform& layerTransform = layerState.geomLayerTransform; - const ui::Transform displayTransform{outputState.orientation}; + const ui::Transform displayTransform{outputState.transform}; const ui::Transform bufferTransform{layerState.geomBufferTransform}; ui::Transform transform(displayTransform * layerTransform * bufferTransform); diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp index 2060c5aaff..c9d8b5b613 100644 --- a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp @@ -236,6 +236,7 @@ TEST_F(OutputLayerTest, calculateOutputRelativeBufferTransformTestsNeeded) { mLayerState.frontEnd.geomLayerTransform.set(entry.layer, 1920, 1080); mLayerState.frontEnd.geomBufferTransform = entry.buffer; mOutputState.orientation = entry.display; + mOutputState.transform = ui::Transform{entry.display}; auto actual = mOutputLayer.calculateOutputRelativeBufferTransform(); EXPECT_EQ(entry.expected, actual) << "entry " << i; @@ -310,5 +311,20 @@ TEST_F(OutputLayerWriteStateToHWCTest, canSetsAllState) { mOutputLayer.writeStateToHWC(true); } +TEST_F(OutputLayerTest, displayInstallOrientationBufferTransformSetTo90) { + mLayerState.frontEnd.geomBufferUsesDisplayInverseTransform = false; + mLayerState.frontEnd.geomLayerTransform = ui::Transform{TR_IDENT}; + // This test simulates a scenario where displayInstallOrientation is set to + // ROT_90. This only has an effect on the transform; orientation stays 0 (see + // DisplayDevice::setProjection). + mOutputState.orientation = TR_IDENT; + mOutputState.transform = ui::Transform{TR_ROT_90}; + // Buffers are pre-rotated based on the transform hint (ROT_90); their + // geomBufferTransform is set to the inverse transform. + mLayerState.frontEnd.geomBufferTransform = TR_ROT_270; + + EXPECT_EQ(TR_IDENT, mOutputLayer.calculateOutputRelativeBufferTransform()); +} + } // namespace } // namespace android::compositionengine diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp index c463c4e40a..f4fc7477a3 100644 --- a/services/surfaceflinger/DisplayHardware/HWC2.cpp +++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp @@ -470,7 +470,7 @@ Error Display::getName(std::string* outName) const Error Display::getRequests(HWC2::DisplayRequest* outDisplayRequests, std::unordered_map<HWC2::Layer*, LayerRequest>* outLayerRequests) { - uint32_t intDisplayRequests; + uint32_t intDisplayRequests = 0; std::vector<Hwc2::Layer> layerIds; std::vector<uint32_t> layerRequests; auto intError = mComposer.getDisplayRequests( diff --git a/services/surfaceflinger/OWNERS b/services/surfaceflinger/OWNERS index 6bb999c00e..c5a4689dda 100644 --- a/services/surfaceflinger/OWNERS +++ b/services/surfaceflinger/OWNERS @@ -7,3 +7,4 @@ racarr@google.com steventhomas@google.com stoza@google.com vhau@google.com +vishnun@google.com diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index e311e3fae6..30b380183d 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3415,6 +3415,7 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<DisplayDevice>& displayDevice, const Region bounds(displayState.bounds); const DisplayRenderArea renderArea(displayDevice); const bool hasClientComposition = getHwComposer().hasClientComposition(displayId); + const bool hasFlipClientTargetRequest = getHwComposer().hasFlipClientTargetRequest(displayId); ATRACE_INT("hasClientComposition", hasClientComposition); bool applyColorMatrix = false; @@ -3480,6 +3481,15 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<DisplayDevice>& displayDevice, if (applyColorMatrix) { clientCompositionDisplay.colorTransform = displayState.colorTransformMat; } + } else if (hasFlipClientTargetRequest) { + buf = display->getRenderSurface()->dequeueBuffer(&fd); + + if (buf == nullptr) { + ALOGW("Dequeuing buffer for display [%s] failed, bailing out of " + "client composition for this frame", + displayDevice->getDisplayName().c_str()); + return false; + } } /* diff --git a/services/surfaceflinger/surfaceflinger.rc b/services/surfaceflinger/surfaceflinger.rc index d3942e8bbe..575e70d779 100644 --- a/services/surfaceflinger/surfaceflinger.rc +++ b/services/surfaceflinger/surfaceflinger.rc @@ -4,7 +4,7 @@ service surfaceflinger /system/bin/surfaceflinger group graphics drmrpc readproc capabilities SYS_NICE onrestart restart zygote - writepid /dev/stune/foreground/tasks + task_profiles HighPerformance socket pdx/system/vr/display/client stream 0666 system graphics u:object_r:pdx_display_client_endpoint_socket:s0 socket pdx/system/vr/display/manager stream 0666 system graphics u:object_r:pdx_display_manager_endpoint_socket:s0 socket pdx/system/vr/display/vsync stream 0666 system graphics u:object_r:pdx_display_vsync_endpoint_socket:s0 |