Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01b8d46b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9690662 from d3fbc898 to udc-release

Change-Id: Ieb06555759863e7f6cb396d4167e167db9647989
parents 2b026d0b d3fbc898
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3,3 +3,4 @@ set noparent
gavincorkery@google.com
nandana@google.com
jsharkey@android.com
smoreland@google.com
 No newline at end of file
+16 −8
Original line number Diff line number Diff line
@@ -442,6 +442,16 @@ static unique_fd open_current_profile(uid_t uid, userid_t user, const std::strin
static unique_fd open_reference_profile(uid_t uid, const std::string& package_name,
        const std::string& location, bool read_write, bool is_secondary_dex) {
    std::string profile = create_reference_profile_path(package_name, location, is_secondary_dex);
    if (read_write && GetBoolProperty("dalvik.vm.useartservice", false)) {
        // ART Service doesn't use flock and instead assumes profile files are
        // immutable, so ensure we don't open a file for writing when it's
        // active.
        // TODO(b/251921228): Normally installd isn't called at all in that
        // case, but OTA is still an exception that uses the legacy code.
        LOG(ERROR) << "Opening ref profile " << profile
                   << " for writing is unsafe when ART Service is enabled.";
        return invalid_unique_fd();
    }
    return open_profile(
        uid,
        profile,
@@ -450,14 +460,13 @@ static unique_fd open_reference_profile(uid_t uid, const std::string& package_na
}

static UniqueFile open_reference_profile_as_unique_file(uid_t uid, const std::string& package_name,
        const std::string& location, bool read_write, bool is_secondary_dex) {
                                                        const std::string& location,
                                                        bool is_secondary_dex) {
    std::string profile_path = create_reference_profile_path(package_name, location,
                                                             is_secondary_dex);
    unique_fd ufd = open_profile(
        uid,
        profile_path,
        read_write ? (O_CREAT | O_RDWR) : O_RDONLY,
        S_IRUSR | S_IWUSR | S_IRGRP);  // so that ART can also read it when apps run.
    unique_fd ufd = open_profile(uid, profile_path, O_RDONLY,
                                 S_IRUSR | S_IWUSR |
                                         S_IRGRP); // so that ART can also read it when apps run.

    return UniqueFile(ufd.release(), profile_path, [](const std::string& path) {
        clear_profile(path);
@@ -1104,8 +1113,7 @@ UniqueFile maybe_open_reference_profile(const std::string& pkgname,
            location = profile_name;
        }
    }
    return open_reference_profile_as_unique_file(uid, pkgname, location, /*read_write*/false,
                                                 is_secondary_dex);
    return open_reference_profile_as_unique_file(uid, pkgname, location, is_secondary_dex);
}

// Opens the vdex files and assigns the input fd to in_vdex_wrapper and the output fd to
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ int main(int argc, char* const argv[])
    ProcessState::initWithDriver("/dev/vndbinder");
#endif
#ifndef __ANDROID__
    setDefaultServiceManager(createRpcDelegateServiceManager({.maxOutgoingThreads = 1}));
    setDefaultServiceManager(createRpcDelegateServiceManager({.maxOutgoingConnections = 1}));
#endif
    sp<IServiceManager> sm = defaultServiceManager();
    fflush(stdout);

include/android/OWNERS

0 → 100644
+1 −0
Original line number Diff line number Diff line
per-file input.h, keycodes.h = file:platform/frameworks/base:/INPUT_OWNERS
+13 −5
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <string>
#include <unordered_map>

#include <android-base/result.h>
#include <android-base/thread_annotations.h>
#include <android/sysprop/InputProperties.sysprop.h>
#include <input/Input.h>
@@ -68,8 +69,15 @@ public:
     */
    MotionPredictor(nsecs_t predictionTimestampOffsetNanos, const char* modelPath = nullptr,
                    std::function<bool()> checkEnableMotionPrediction = isMotionPredictionEnabled);
    void record(const MotionEvent& event);
    std::vector<std::unique_ptr<MotionEvent>> predict(nsecs_t timestamp);
    /**
     * Record the actual motion received by the view. This event will be used for calculating the
     * predictions.
     *
     * @return empty result if the event was processed correctly, error if the event is not
     * consistent with the previously recorded events.
     */
    android::base::Result<void> record(const MotionEvent& event);
    std::unique_ptr<MotionEvent> predict(nsecs_t timestamp);
    bool isPredictionAvailable(int32_t deviceId, int32_t source);

private:
@@ -78,9 +86,9 @@ private:
    const std::function<bool()> mCheckMotionPredictionEnabled;

    std::unique_ptr<TfLiteMotionPredictorModel> mModel;
    // Buffers/events for each device seen by record().
    std::unordered_map</*deviceId*/ int32_t, TfLiteMotionPredictorBuffers> mDeviceBuffers;
    std::unordered_map</*deviceId*/ int32_t, MotionEvent> mLastEvents;

    std::unique_ptr<TfLiteMotionPredictorBuffers> mBuffers;
    std::optional<MotionEvent> mLastEvent;
};

} // namespace android
Loading