Loading cmds/installd/otapreopt_script.sh +21 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,27 @@ else exit 1 fi if pm art on-ota-staged --slot "$TARGET_SLOT_SUFFIX"; then # A source that infinitely emits arbitrary lines. # When connected to STDIN of another process, this source keeps STDIN open until # the consumer process closes STDIN or this script dies. function infinite_source { while echo .; do sleep 1 done } # Delegate to Pre-reboot Dexopt, a feature of ART Service. # ART Service decides what to do with this request: # - If Pre-reboot Dexopt is disabled or unsupported, the command returns # non-zero. This is always the case if the current system is Android 14 or # earlier. # - If Pre-reboot Dexopt is enabled in synchronous mode, the command blocks # until Pre-reboot Dexopt finishes, and returns zero no matter it succeeds or # not. This is the default behavior if the current system is Android 15. # - If Pre-reboot Dexopt is enabled in asynchronous mode, the command schedules # an asynchronous job and returns 0 immediately. The job will then run by the # job scheduler when the device is idle and charging. if infinite_source | pm art on-ota-staged --slot "$TARGET_SLOT_SUFFIX"; then # Handled by Pre-reboot Dexopt. exit 0 fi Loading libs/binder/IPCThreadState.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -1027,6 +1027,7 @@ status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult) goto finish; case BR_FROZEN_REPLY: ALOGW("Transaction failed because process frozen."); err = FAILED_TRANSACTION; goto finish; Loading Loading @@ -1578,8 +1579,8 @@ void IPCThreadState::logExtendedError() { } #endif ALOGE_IF(ee.command != BR_OK, "Binder transaction failure: %d/%d/%d", ee.id, ee.command, ee.param); ALOGE_IF(ee.command != BR_OK, "Binder transaction failure. id: %d, BR_*: %d, error: %d (%s)", ee.id, ee.command, ee.param, strerror(-ee.param)); } void IPCThreadState::freeBuffer(const uint8_t* data, size_t /*dataSize*/, Loading libs/binder/ProcessState.cpp +12 −9 Original line number Diff line number Diff line Loading @@ -516,20 +516,21 @@ String8 ProcessState::getDriverName() { return mDriverName; } static unique_fd open_driver(const char* driver) { static unique_fd open_driver(const char* driver, String8* error) { auto fd = unique_fd(open(driver, O_RDWR | O_CLOEXEC)); if (!fd.ok()) { PLOGE("Opening '%s' failed", driver); error->appendFormat("%d (%s) Opening '%s' failed", errno, strerror(errno), driver); return {}; } int vers = 0; int result = ioctl(fd.get(), BINDER_VERSION, &vers); if (result == -1) { PLOGE("Binder ioctl to obtain version failed"); error->appendFormat("%d (%s) Binder ioctl to obtain version failed", errno, strerror(errno)); return {}; } if (result != 0 || vers != BINDER_CURRENT_PROTOCOL_VERSION) { ALOGE("Binder driver protocol(%d) does not match user space protocol(%d)! " error->appendFormat("Binder driver protocol(%d) does not match user space protocol(%d)! " "ioctl() return value: %d", vers, BINDER_CURRENT_PROTOCOL_VERSION, result); return {}; Loading Loading @@ -565,7 +566,8 @@ ProcessState::ProcessState(const char* driver) mThreadPoolStarted(false), mThreadPoolSeq(1), mCallRestriction(CallRestriction::NONE) { unique_fd opened = open_driver(driver); String8 error; unique_fd opened = open_driver(driver, &error); if (opened.ok()) { // mmap the binder, providing a chunk of virtual address space to receive transactions. Loading @@ -580,8 +582,9 @@ ProcessState::ProcessState(const char* driver) } #ifdef __ANDROID__ LOG_ALWAYS_FATAL_IF(!opened.ok(), "Binder driver '%s' could not be opened. Terminating.", driver); LOG_ALWAYS_FATAL_IF(!opened.ok(), "Binder driver '%s' could not be opened. Error: %s. Terminating.", error.c_str(), driver); #endif if (opened.ok()) { Loading libs/binder/include/binder/RpcSession.h +2 −2 Original line number Diff line number Diff line Loading @@ -129,9 +129,9 @@ public: setupUnixDomainSocketBootstrapClient(binder::unique_fd bootstrap); /** * Connects to an RPC server at the CVD & port. * Connects to an RPC server at the CID & port. */ [[nodiscard]] LIBBINDER_EXPORTED status_t setupVsockClient(unsigned int cvd, unsigned int port); [[nodiscard]] LIBBINDER_EXPORTED status_t setupVsockClient(unsigned int cid, unsigned int port); /** * Connects to an RPC server at the given address and port. Loading services/inputflinger/PointerChoreographer.cpp +31 −17 Original line number Diff line number Diff line Loading @@ -30,10 +30,6 @@ namespace android { namespace input_flags = com::android::input::flags; static const bool HIDE_TOUCH_INDICATORS_FOR_SECURE_WINDOWS = input_flags::hide_pointer_indicators_for_secure_windows(); namespace { bool isFromMouse(const NotifyMotionArgs& args) { Loading Loading @@ -106,8 +102,31 @@ std::unordered_set<ui::LogicalDisplayId> getPrivacySensitiveDisplaysFromWindowIn // --- PointerChoreographer --- PointerChoreographer::PointerChoreographer(InputListenerInterface& listener, PointerChoreographer::PointerChoreographer(InputListenerInterface& inputListener, PointerChoreographerPolicyInterface& policy) : PointerChoreographer( inputListener, policy, [](const sp<android::gui::WindowInfosListener>& listener) { auto initialInfo = std::make_pair(std::vector<android::gui::WindowInfo>{}, std::vector<android::gui::DisplayInfo>{}); #if defined(__ANDROID__) SurfaceComposerClient::getDefault()->addWindowInfosListener(listener, &initialInfo); #endif return initialInfo.first; }, [](const sp<android::gui::WindowInfosListener>& listener) { #if defined(__ANDROID__) SurfaceComposerClient::getDefault()->removeWindowInfosListener(listener); #endif }) { } PointerChoreographer::PointerChoreographer( android::InputListenerInterface& listener, android::PointerChoreographerPolicyInterface& policy, const android::PointerChoreographer::WindowListenerRegisterConsumer& registerListener, const android::PointerChoreographer::WindowListenerUnregisterConsumer& unregisterListener) : mTouchControllerConstructor([this]() { return mPolicy.createPointerController( PointerControllerInterface::ControllerType::TOUCH); Loading @@ -117,7 +136,9 @@ PointerChoreographer::PointerChoreographer(InputListenerInterface& listener, mDefaultMouseDisplayId(ui::LogicalDisplayId::DEFAULT), mNotifiedPointerDisplayId(ui::LogicalDisplayId::INVALID), mShowTouchesEnabled(false), mStylusPointerIconEnabled(false) {} mStylusPointerIconEnabled(false), mRegisterListener(registerListener), mUnregisterListener(unregisterListener) {} PointerChoreographer::~PointerChoreographer() { std::scoped_lock _l(mLock); Loading @@ -125,6 +146,7 @@ PointerChoreographer::~PointerChoreographer() { return; } mWindowInfoListener->onPointerChoreographerDestroyed(); mUnregisterListener(mWindowInfoListener); } void PointerChoreographer::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) { Loading Loading @@ -391,7 +413,7 @@ void PointerChoreographer::processDeviceReset(const NotifyDeviceResetArgs& args) } void PointerChoreographer::onControllerAddedOrRemovedLocked() { if (!HIDE_TOUCH_INDICATORS_FOR_SECURE_WINDOWS) { if (!com::android::input::flags::hide_pointer_indicators_for_secure_windows()) { return; } bool requireListener = !mTouchPointersByDevice.empty() || !mMousePointersByDisplay.empty() || Loading @@ -399,18 +421,10 @@ void PointerChoreographer::onControllerAddedOrRemovedLocked() { if (requireListener && mWindowInfoListener == nullptr) { mWindowInfoListener = sp<PointerChoreographerDisplayInfoListener>::make(this); auto initialInfo = std::make_pair(std::vector<android::gui::WindowInfo>{}, std::vector<android::gui::DisplayInfo>{}); #if defined(__ANDROID__) SurfaceComposerClient::getDefault()->addWindowInfosListener(mWindowInfoListener, &initialInfo); #endif mWindowInfoListener->setInitialDisplayInfos(initialInfo.first); mWindowInfoListener->setInitialDisplayInfos(mRegisterListener(mWindowInfoListener)); onPrivacySensitiveDisplaysChangedLocked(mWindowInfoListener->getPrivacySensitiveDisplays()); } else if (!requireListener && mWindowInfoListener != nullptr) { #if defined(__ANDROID__) SurfaceComposerClient::getDefault()->removeWindowInfosListener(mWindowInfoListener); #endif mUnregisterListener(mWindowInfoListener); mWindowInfoListener = nullptr; } else if (requireListener && mWindowInfoListener != nullptr) { // controller may have been added to an existing privacy sensitive display, we need to Loading Loading
cmds/installd/otapreopt_script.sh +21 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,27 @@ else exit 1 fi if pm art on-ota-staged --slot "$TARGET_SLOT_SUFFIX"; then # A source that infinitely emits arbitrary lines. # When connected to STDIN of another process, this source keeps STDIN open until # the consumer process closes STDIN or this script dies. function infinite_source { while echo .; do sleep 1 done } # Delegate to Pre-reboot Dexopt, a feature of ART Service. # ART Service decides what to do with this request: # - If Pre-reboot Dexopt is disabled or unsupported, the command returns # non-zero. This is always the case if the current system is Android 14 or # earlier. # - If Pre-reboot Dexopt is enabled in synchronous mode, the command blocks # until Pre-reboot Dexopt finishes, and returns zero no matter it succeeds or # not. This is the default behavior if the current system is Android 15. # - If Pre-reboot Dexopt is enabled in asynchronous mode, the command schedules # an asynchronous job and returns 0 immediately. The job will then run by the # job scheduler when the device is idle and charging. if infinite_source | pm art on-ota-staged --slot "$TARGET_SLOT_SUFFIX"; then # Handled by Pre-reboot Dexopt. exit 0 fi Loading
libs/binder/IPCThreadState.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -1027,6 +1027,7 @@ status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult) goto finish; case BR_FROZEN_REPLY: ALOGW("Transaction failed because process frozen."); err = FAILED_TRANSACTION; goto finish; Loading Loading @@ -1578,8 +1579,8 @@ void IPCThreadState::logExtendedError() { } #endif ALOGE_IF(ee.command != BR_OK, "Binder transaction failure: %d/%d/%d", ee.id, ee.command, ee.param); ALOGE_IF(ee.command != BR_OK, "Binder transaction failure. id: %d, BR_*: %d, error: %d (%s)", ee.id, ee.command, ee.param, strerror(-ee.param)); } void IPCThreadState::freeBuffer(const uint8_t* data, size_t /*dataSize*/, Loading
libs/binder/ProcessState.cpp +12 −9 Original line number Diff line number Diff line Loading @@ -516,20 +516,21 @@ String8 ProcessState::getDriverName() { return mDriverName; } static unique_fd open_driver(const char* driver) { static unique_fd open_driver(const char* driver, String8* error) { auto fd = unique_fd(open(driver, O_RDWR | O_CLOEXEC)); if (!fd.ok()) { PLOGE("Opening '%s' failed", driver); error->appendFormat("%d (%s) Opening '%s' failed", errno, strerror(errno), driver); return {}; } int vers = 0; int result = ioctl(fd.get(), BINDER_VERSION, &vers); if (result == -1) { PLOGE("Binder ioctl to obtain version failed"); error->appendFormat("%d (%s) Binder ioctl to obtain version failed", errno, strerror(errno)); return {}; } if (result != 0 || vers != BINDER_CURRENT_PROTOCOL_VERSION) { ALOGE("Binder driver protocol(%d) does not match user space protocol(%d)! " error->appendFormat("Binder driver protocol(%d) does not match user space protocol(%d)! " "ioctl() return value: %d", vers, BINDER_CURRENT_PROTOCOL_VERSION, result); return {}; Loading Loading @@ -565,7 +566,8 @@ ProcessState::ProcessState(const char* driver) mThreadPoolStarted(false), mThreadPoolSeq(1), mCallRestriction(CallRestriction::NONE) { unique_fd opened = open_driver(driver); String8 error; unique_fd opened = open_driver(driver, &error); if (opened.ok()) { // mmap the binder, providing a chunk of virtual address space to receive transactions. Loading @@ -580,8 +582,9 @@ ProcessState::ProcessState(const char* driver) } #ifdef __ANDROID__ LOG_ALWAYS_FATAL_IF(!opened.ok(), "Binder driver '%s' could not be opened. Terminating.", driver); LOG_ALWAYS_FATAL_IF(!opened.ok(), "Binder driver '%s' could not be opened. Error: %s. Terminating.", error.c_str(), driver); #endif if (opened.ok()) { Loading
libs/binder/include/binder/RpcSession.h +2 −2 Original line number Diff line number Diff line Loading @@ -129,9 +129,9 @@ public: setupUnixDomainSocketBootstrapClient(binder::unique_fd bootstrap); /** * Connects to an RPC server at the CVD & port. * Connects to an RPC server at the CID & port. */ [[nodiscard]] LIBBINDER_EXPORTED status_t setupVsockClient(unsigned int cvd, unsigned int port); [[nodiscard]] LIBBINDER_EXPORTED status_t setupVsockClient(unsigned int cid, unsigned int port); /** * Connects to an RPC server at the given address and port. Loading
services/inputflinger/PointerChoreographer.cpp +31 −17 Original line number Diff line number Diff line Loading @@ -30,10 +30,6 @@ namespace android { namespace input_flags = com::android::input::flags; static const bool HIDE_TOUCH_INDICATORS_FOR_SECURE_WINDOWS = input_flags::hide_pointer_indicators_for_secure_windows(); namespace { bool isFromMouse(const NotifyMotionArgs& args) { Loading Loading @@ -106,8 +102,31 @@ std::unordered_set<ui::LogicalDisplayId> getPrivacySensitiveDisplaysFromWindowIn // --- PointerChoreographer --- PointerChoreographer::PointerChoreographer(InputListenerInterface& listener, PointerChoreographer::PointerChoreographer(InputListenerInterface& inputListener, PointerChoreographerPolicyInterface& policy) : PointerChoreographer( inputListener, policy, [](const sp<android::gui::WindowInfosListener>& listener) { auto initialInfo = std::make_pair(std::vector<android::gui::WindowInfo>{}, std::vector<android::gui::DisplayInfo>{}); #if defined(__ANDROID__) SurfaceComposerClient::getDefault()->addWindowInfosListener(listener, &initialInfo); #endif return initialInfo.first; }, [](const sp<android::gui::WindowInfosListener>& listener) { #if defined(__ANDROID__) SurfaceComposerClient::getDefault()->removeWindowInfosListener(listener); #endif }) { } PointerChoreographer::PointerChoreographer( android::InputListenerInterface& listener, android::PointerChoreographerPolicyInterface& policy, const android::PointerChoreographer::WindowListenerRegisterConsumer& registerListener, const android::PointerChoreographer::WindowListenerUnregisterConsumer& unregisterListener) : mTouchControllerConstructor([this]() { return mPolicy.createPointerController( PointerControllerInterface::ControllerType::TOUCH); Loading @@ -117,7 +136,9 @@ PointerChoreographer::PointerChoreographer(InputListenerInterface& listener, mDefaultMouseDisplayId(ui::LogicalDisplayId::DEFAULT), mNotifiedPointerDisplayId(ui::LogicalDisplayId::INVALID), mShowTouchesEnabled(false), mStylusPointerIconEnabled(false) {} mStylusPointerIconEnabled(false), mRegisterListener(registerListener), mUnregisterListener(unregisterListener) {} PointerChoreographer::~PointerChoreographer() { std::scoped_lock _l(mLock); Loading @@ -125,6 +146,7 @@ PointerChoreographer::~PointerChoreographer() { return; } mWindowInfoListener->onPointerChoreographerDestroyed(); mUnregisterListener(mWindowInfoListener); } void PointerChoreographer::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) { Loading Loading @@ -391,7 +413,7 @@ void PointerChoreographer::processDeviceReset(const NotifyDeviceResetArgs& args) } void PointerChoreographer::onControllerAddedOrRemovedLocked() { if (!HIDE_TOUCH_INDICATORS_FOR_SECURE_WINDOWS) { if (!com::android::input::flags::hide_pointer_indicators_for_secure_windows()) { return; } bool requireListener = !mTouchPointersByDevice.empty() || !mMousePointersByDisplay.empty() || Loading @@ -399,18 +421,10 @@ void PointerChoreographer::onControllerAddedOrRemovedLocked() { if (requireListener && mWindowInfoListener == nullptr) { mWindowInfoListener = sp<PointerChoreographerDisplayInfoListener>::make(this); auto initialInfo = std::make_pair(std::vector<android::gui::WindowInfo>{}, std::vector<android::gui::DisplayInfo>{}); #if defined(__ANDROID__) SurfaceComposerClient::getDefault()->addWindowInfosListener(mWindowInfoListener, &initialInfo); #endif mWindowInfoListener->setInitialDisplayInfos(initialInfo.first); mWindowInfoListener->setInitialDisplayInfos(mRegisterListener(mWindowInfoListener)); onPrivacySensitiveDisplaysChangedLocked(mWindowInfoListener->getPrivacySensitiveDisplays()); } else if (!requireListener && mWindowInfoListener != nullptr) { #if defined(__ANDROID__) SurfaceComposerClient::getDefault()->removeWindowInfosListener(mWindowInfoListener); #endif mUnregisterListener(mWindowInfoListener); mWindowInfoListener = nullptr; } else if (requireListener && mWindowInfoListener != nullptr) { // controller may have been added to an existing privacy sensitive display, we need to Loading