Loading cmds/dumpstate/dumpstate.cpp +12 −7 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ #include <android/hidl/manager/1.0/IServiceManager.h> #include <android/os/IIncidentCompanion.h> #include <binder/IServiceManager.h> #include <cutils/multiuser.h> #include <cutils/native_handle.h> #include <cutils/properties.h> #include <cutils/sockets.h> Loading Loading @@ -2619,10 +2620,13 @@ bool Dumpstate::FinishZipFile() { return true; } static void SendBroadcast(const std::string& action, const std::vector<std::string>& args) { static void SendBroadcast(const std::string& action, const std::vector<std::string>& args, int32_t user_id) { // clang-format off std::vector<std::string> am = {"/system/bin/cmd", "activity", "broadcast", "--user", "0", "--receiver-foreground", "--receiver-include-background", "-a", action}; std::vector<std::string> am = {"/system/bin/cmd", "activity", "broadcast", "--user", std::to_string(user_id), "--receiver-foreground", "--receiver-include-background", "-a", action}; // clang-format on am.insert(am.end(), args.begin(), args.end()); Loading Loading @@ -3057,7 +3061,8 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, }; // clang-format on // Send STARTED broadcast for apps that listen to bugreport generation events SendBroadcast("com.android.internal.intent.action.BUGREPORT_STARTED", am_args); SendBroadcast("com.android.internal.intent.action.BUGREPORT_STARTED", am_args, multiuser_get_user_id(calling_uid)); if (options_->progress_updates_to_socket) { dprintf(control_socket_fd_, "BEGIN:%s\n", path_.c_str()); } Loading Loading @@ -3305,7 +3310,7 @@ void Dumpstate::MaybeAddUiTracesToZip() { } void Dumpstate::onUiIntensiveBugreportDumpsFinished(int32_t calling_uid) { if (calling_uid == AID_SHELL || !CalledByApi()) { if (multiuser_get_app_id(calling_uid) == AID_SHELL || !CalledByApi()) { return; } if (listener_ != nullptr) { Loading @@ -3316,7 +3321,7 @@ void Dumpstate::onUiIntensiveBugreportDumpsFinished(int32_t calling_uid) { } void Dumpstate::MaybeCheckUserConsent(int32_t calling_uid, const std::string& calling_package) { if (calling_uid == AID_SHELL || !CalledByApi()) { if (multiuser_get_app_id(calling_uid) == AID_SHELL || !CalledByApi()) { // No need to get consent for shell triggered dumpstates, or not through // bugreporting API (i.e. no fd to copy back). return; Loading Loading @@ -3398,7 +3403,7 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented(int32_t calling_uid // If the caller has asked to copy the bugreport over to their directory, we need explicit // user consent (unless the caller is Shell). UserConsentResult consent_result; if (calling_uid == AID_SHELL) { if (multiuser_get_app_id(calling_uid) == AID_SHELL) { consent_result = UserConsentResult::APPROVED; } else { consent_result = consent_callback_->getResult(); Loading libs/binder/ndk/include_cpp/android/binder_to_string.h +12 −5 Original line number Diff line number Diff line Loading @@ -113,6 +113,8 @@ class IsPointerLike { #endif IsInstantiationOf<_U, std::optional>::value || // for @nullable types in the // C++/NDK backends IsInstantiationOf<_U, std::unique_ptr>::value || // for @nullable(heap=true) // in C++/NDK backends IsInstantiationOf<_U, std::shared_ptr>::value, // for interface types in the // NDK backends Loading Loading @@ -164,6 +166,11 @@ class ToEmptyString { enum { value = decltype(_test<_T>(0))::value }; }; template <typename _T> struct TypeDependentFalse { enum { value = false }; }; } // namespace details template <typename _T> Loading Loading @@ -223,7 +230,7 @@ std::string ToString(const _T& t) { out << "]"; return out.str(); } else { return "{no toString() implemented}"; static_assert(details::TypeDependentFalse<_T>::value, "no toString implemented, huh?"); } } Loading libs/input/MotionPredictor.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -78,16 +78,19 @@ std::vector<std::unique_ptr<MotionEvent>> MotionPredictor::predict(nsecs_t times for (size_t i = 0; i < event.getPointerCount(); i++) { const int32_t pointerId = event.getPointerId(i); const PointerCoords* currentPointerCoords = event.getRawPointerCoords(i); const float currentX = currentPointerCoords->getAxisValue(AMOTION_EVENT_AXIS_X); const float currentY = currentPointerCoords->getAxisValue(AMOTION_EVENT_AXIS_Y); PointerCoords coords; coords.clear(); ssize_t index = previous.findPointerIndex(pointerId); if (index >= 0) { // We have old data for this pointer. Compute the prediction. const float oldX = previous.getRawX(index); const float oldY = previous.getRawY(index); const float currentX = event.getRawX(i); const float currentY = event.getRawY(i); const PointerCoords* oldPointerCoords = previous.getRawPointerCoords(index); const float oldX = oldPointerCoords->getAxisValue(AMOTION_EVENT_AXIS_X); const float oldY = oldPointerCoords->getAxisValue(AMOTION_EVENT_AXIS_Y); // Let's do a linear interpolation while waiting for a real model const float scale = Loading @@ -97,13 +100,15 @@ std::vector<std::unique_ptr<MotionEvent>> MotionPredictor::predict(nsecs_t times coords.setAxisValue(AMOTION_EVENT_AXIS_X, futureX); coords.setAxisValue(AMOTION_EVENT_AXIS_Y, futureY); ALOGD_IF(isDebug(), "Prediction by %.1f ms, (%.1f, %.1f), (%.1f, %.1f) --> (%.1f, %.1f)", (futureTime - event.getEventTime()) * 1E-6, oldX, oldY, currentX, currentY, futureX, futureY); } futureCoords.push_back(coords); } ALOGD_IF(isDebug(), "Prediction is %.1f ms away from the event", (futureTime - event.getEventTime()) * 1E-6); /** * The process of adding samples is different for the first and subsequent samples: * 1. Add the first sample via 'initialize' as below Loading libs/jpegrecoverymap/include/jpegrecoverymap/jpegdecoder.h +3 −3 Original line number Diff line number Diff line Loading @@ -86,12 +86,12 @@ public: */ int getEXIFPos() { return mExifPos; } /* * Decompresses metadata of the image. * Decompresses metadata of the image. All vectors are owned by the caller. */ bool getCompressedImageParameters(const void* image, int length, size_t* pWidth, size_t* pHeight, std::vector<uint8_t>* &iccData, std::vector<uint8_t>* &exifData); std::vector<uint8_t>* iccData, std::vector<uint8_t>* exifData); /* * Extracts EXIF package and updates the EXIF position / length without decoding the image. */ Loading libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h +2 −1 Original line number Diff line number Diff line Loading @@ -244,7 +244,8 @@ public: * * The output is filled jpegr_info structure * @param compressed_jpegr_image compressed JPEGR image * @param jpegr_info pointer to output JPEGR info * @param jpegr_info pointer to output JPEGR info. Members of jpegr_info * are owned by the caller * @return NO_ERROR if JPEGR parsing succeeds, error code otherwise */ status_t getJPEGRInfo(jr_compressed_ptr compressed_jpegr_image, Loading Loading
cmds/dumpstate/dumpstate.cpp +12 −7 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ #include <android/hidl/manager/1.0/IServiceManager.h> #include <android/os/IIncidentCompanion.h> #include <binder/IServiceManager.h> #include <cutils/multiuser.h> #include <cutils/native_handle.h> #include <cutils/properties.h> #include <cutils/sockets.h> Loading Loading @@ -2619,10 +2620,13 @@ bool Dumpstate::FinishZipFile() { return true; } static void SendBroadcast(const std::string& action, const std::vector<std::string>& args) { static void SendBroadcast(const std::string& action, const std::vector<std::string>& args, int32_t user_id) { // clang-format off std::vector<std::string> am = {"/system/bin/cmd", "activity", "broadcast", "--user", "0", "--receiver-foreground", "--receiver-include-background", "-a", action}; std::vector<std::string> am = {"/system/bin/cmd", "activity", "broadcast", "--user", std::to_string(user_id), "--receiver-foreground", "--receiver-include-background", "-a", action}; // clang-format on am.insert(am.end(), args.begin(), args.end()); Loading Loading @@ -3057,7 +3061,8 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, }; // clang-format on // Send STARTED broadcast for apps that listen to bugreport generation events SendBroadcast("com.android.internal.intent.action.BUGREPORT_STARTED", am_args); SendBroadcast("com.android.internal.intent.action.BUGREPORT_STARTED", am_args, multiuser_get_user_id(calling_uid)); if (options_->progress_updates_to_socket) { dprintf(control_socket_fd_, "BEGIN:%s\n", path_.c_str()); } Loading Loading @@ -3305,7 +3310,7 @@ void Dumpstate::MaybeAddUiTracesToZip() { } void Dumpstate::onUiIntensiveBugreportDumpsFinished(int32_t calling_uid) { if (calling_uid == AID_SHELL || !CalledByApi()) { if (multiuser_get_app_id(calling_uid) == AID_SHELL || !CalledByApi()) { return; } if (listener_ != nullptr) { Loading @@ -3316,7 +3321,7 @@ void Dumpstate::onUiIntensiveBugreportDumpsFinished(int32_t calling_uid) { } void Dumpstate::MaybeCheckUserConsent(int32_t calling_uid, const std::string& calling_package) { if (calling_uid == AID_SHELL || !CalledByApi()) { if (multiuser_get_app_id(calling_uid) == AID_SHELL || !CalledByApi()) { // No need to get consent for shell triggered dumpstates, or not through // bugreporting API (i.e. no fd to copy back). return; Loading Loading @@ -3398,7 +3403,7 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented(int32_t calling_uid // If the caller has asked to copy the bugreport over to their directory, we need explicit // user consent (unless the caller is Shell). UserConsentResult consent_result; if (calling_uid == AID_SHELL) { if (multiuser_get_app_id(calling_uid) == AID_SHELL) { consent_result = UserConsentResult::APPROVED; } else { consent_result = consent_callback_->getResult(); Loading
libs/binder/ndk/include_cpp/android/binder_to_string.h +12 −5 Original line number Diff line number Diff line Loading @@ -113,6 +113,8 @@ class IsPointerLike { #endif IsInstantiationOf<_U, std::optional>::value || // for @nullable types in the // C++/NDK backends IsInstantiationOf<_U, std::unique_ptr>::value || // for @nullable(heap=true) // in C++/NDK backends IsInstantiationOf<_U, std::shared_ptr>::value, // for interface types in the // NDK backends Loading Loading @@ -164,6 +166,11 @@ class ToEmptyString { enum { value = decltype(_test<_T>(0))::value }; }; template <typename _T> struct TypeDependentFalse { enum { value = false }; }; } // namespace details template <typename _T> Loading Loading @@ -223,7 +230,7 @@ std::string ToString(const _T& t) { out << "]"; return out.str(); } else { return "{no toString() implemented}"; static_assert(details::TypeDependentFalse<_T>::value, "no toString implemented, huh?"); } } Loading
libs/input/MotionPredictor.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -78,16 +78,19 @@ std::vector<std::unique_ptr<MotionEvent>> MotionPredictor::predict(nsecs_t times for (size_t i = 0; i < event.getPointerCount(); i++) { const int32_t pointerId = event.getPointerId(i); const PointerCoords* currentPointerCoords = event.getRawPointerCoords(i); const float currentX = currentPointerCoords->getAxisValue(AMOTION_EVENT_AXIS_X); const float currentY = currentPointerCoords->getAxisValue(AMOTION_EVENT_AXIS_Y); PointerCoords coords; coords.clear(); ssize_t index = previous.findPointerIndex(pointerId); if (index >= 0) { // We have old data for this pointer. Compute the prediction. const float oldX = previous.getRawX(index); const float oldY = previous.getRawY(index); const float currentX = event.getRawX(i); const float currentY = event.getRawY(i); const PointerCoords* oldPointerCoords = previous.getRawPointerCoords(index); const float oldX = oldPointerCoords->getAxisValue(AMOTION_EVENT_AXIS_X); const float oldY = oldPointerCoords->getAxisValue(AMOTION_EVENT_AXIS_Y); // Let's do a linear interpolation while waiting for a real model const float scale = Loading @@ -97,13 +100,15 @@ std::vector<std::unique_ptr<MotionEvent>> MotionPredictor::predict(nsecs_t times coords.setAxisValue(AMOTION_EVENT_AXIS_X, futureX); coords.setAxisValue(AMOTION_EVENT_AXIS_Y, futureY); ALOGD_IF(isDebug(), "Prediction by %.1f ms, (%.1f, %.1f), (%.1f, %.1f) --> (%.1f, %.1f)", (futureTime - event.getEventTime()) * 1E-6, oldX, oldY, currentX, currentY, futureX, futureY); } futureCoords.push_back(coords); } ALOGD_IF(isDebug(), "Prediction is %.1f ms away from the event", (futureTime - event.getEventTime()) * 1E-6); /** * The process of adding samples is different for the first and subsequent samples: * 1. Add the first sample via 'initialize' as below Loading
libs/jpegrecoverymap/include/jpegrecoverymap/jpegdecoder.h +3 −3 Original line number Diff line number Diff line Loading @@ -86,12 +86,12 @@ public: */ int getEXIFPos() { return mExifPos; } /* * Decompresses metadata of the image. * Decompresses metadata of the image. All vectors are owned by the caller. */ bool getCompressedImageParameters(const void* image, int length, size_t* pWidth, size_t* pHeight, std::vector<uint8_t>* &iccData, std::vector<uint8_t>* &exifData); std::vector<uint8_t>* iccData, std::vector<uint8_t>* exifData); /* * Extracts EXIF package and updates the EXIF position / length without decoding the image. */ Loading
libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h +2 −1 Original line number Diff line number Diff line Loading @@ -244,7 +244,8 @@ public: * * The output is filled jpegr_info structure * @param compressed_jpegr_image compressed JPEGR image * @param jpegr_info pointer to output JPEGR info * @param jpegr_info pointer to output JPEGR info. Members of jpegr_info * are owned by the caller * @return NO_ERROR if JPEGR parsing succeeds, error code otherwise */ status_t getJPEGRInfo(jr_compressed_ptr compressed_jpegr_image, Loading