diff options
author | Alex Buynytskyy <alexbuy@google.com> | 2020-05-05 12:48:41 -0700 |
---|---|---|
committer | Alex Buynytskyy <alexbuy@google.com> | 2020-05-07 21:22:14 +0000 |
commit | cca2c1110ce3eed8820579d0319d015aa4cdcf55 (patch) | |
tree | f11979e28df0dcd45c54b2319683f809758e307f /services/incremental/ServiceWrappers.cpp | |
parent | 7efdd5d903848c592d9bcd2e1fc3844f4cace3ca (diff) |
Lifecycle: detecting pending reads.
Once pending read detected, try to start the dataloader.
Bug: 153874006
Test: test PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest
Change-Id: Ia8169ccbb0f710317715e6fddb9bc6a718543766
Diffstat (limited to 'services/incremental/ServiceWrappers.cpp')
-rw-r--r-- | services/incremental/ServiceWrappers.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/services/incremental/ServiceWrappers.cpp b/services/incremental/ServiceWrappers.cpp index 85f744152ea4..08fb486c8058 100644 --- a/services/incremental/ServiceWrappers.cpp +++ b/services/incremental/ServiceWrappers.cpp @@ -113,6 +113,23 @@ private: JavaVM* const mJvm; }; +class RealLooperWrapper final : public LooperWrapper { +public: + int addFd(int fd, int ident, int events, android::Looper_callbackFunc callback, + void* data) final { + return mLooper.addFd(fd, ident, events, callback, data); + } + int removeFd(int fd) final { return mLooper.removeFd(fd); } + void wake() final { return mLooper.wake(); } + int pollAll(int timeoutMillis) final { return mLooper.pollAll(timeoutMillis); } + +private: + struct Looper : public android::Looper { + Looper() : android::Looper(/*allowNonCallbacks=*/false) {} + ~Looper() {} + } mLooper; +}; + class RealIncFs : public IncFsWrapper { public: RealIncFs() = default; @@ -203,6 +220,10 @@ std::unique_ptr<JniWrapper> RealServiceManager::getJni() { return std::make_unique<RealJniWrapper>(mJvm); } +std::unique_ptr<LooperWrapper> RealServiceManager::getLooper() { + return std::make_unique<RealLooperWrapper>(); +} + static JavaVM* getJavaVm(JNIEnv* env) { CHECK(env); JavaVM* jvm = nullptr; |