Loading cmds/installd/InstalldNativeService.cpp +18 −10 Original line number Diff line number Diff line Loading @@ -634,7 +634,8 @@ static void chown_app_profile_dir(const std::string &packageName, int32_t appId, static binder::Status createAppDataDirs(const std::string& path, int32_t uid, int32_t gid, int32_t* previousUid, int32_t cacheGid, const std::string& seInfo, mode_t targetMode) { const std::string& seInfo, mode_t targetMode, long projectIdApp, long projectIdCache) { struct stat st{}; bool parent_dir_exists = (stat(path.c_str(), &st) == 0); Loading @@ -658,11 +659,9 @@ static binder::Status createAppDataDirs(const std::string& path, int32_t uid, in } // Prepare only the parent app directory long project_id_app = get_project_id(uid, PROJECT_ID_APP_START); long project_id_cache_app = get_project_id(uid, PROJECT_ID_APP_CACHE_START); if (prepare_app_dir(path, targetMode, uid, gid, project_id_app) || prepare_app_cache_dir(path, "cache", 02771, uid, cacheGid, project_id_cache_app) || prepare_app_cache_dir(path, "code_cache", 02771, uid, cacheGid, project_id_cache_app)) { if (prepare_app_dir(path, targetMode, uid, gid, projectIdApp) || prepare_app_cache_dir(path, "cache", 02771, uid, cacheGid, projectIdCache) || prepare_app_cache_dir(path, "code_cache", 02771, uid, cacheGid, projectIdCache)) { return error("Failed to prepare " + path); } Loading Loading @@ -718,10 +717,14 @@ binder::Status InstalldNativeService::createAppDataLocked( cacheGid = uid; } long projectIdApp = get_project_id(uid, PROJECT_ID_APP_START); long projectIdCache = get_project_id(uid, PROJECT_ID_APP_CACHE_START); if (flags & FLAG_STORAGE_CE) { auto path = create_data_user_ce_package_path(uuid_, userId, pkgname); auto status = createAppDataDirs(path, uid, uid, &previousUid, cacheGid, seInfo, targetMode); auto status = createAppDataDirs(path, uid, uid, &previousUid, cacheGid, seInfo, targetMode, projectIdApp, projectIdCache); if (!status.isOk()) { return status; } Loading @@ -746,7 +749,8 @@ binder::Status InstalldNativeService::createAppDataLocked( if (flags & FLAG_STORAGE_DE) { auto path = create_data_user_de_package_path(uuid_, userId, pkgname); auto status = createAppDataDirs(path, uid, uid, &previousUid, cacheGid, seInfo, targetMode); auto status = createAppDataDirs(path, uid, uid, &previousUid, cacheGid, seInfo, targetMode, projectIdApp, projectIdCache); if (!status.isOk()) { return status; } Loading Loading @@ -946,8 +950,12 @@ binder::Status InstalldNativeService::reconcileSdkData(const std::optional<std:: } const int32_t sandboxUid = multiuser_get_sdk_sandbox_uid(userId, appId); int32_t previousSandboxUid = multiuser_get_sdk_sandbox_uid(userId, previousAppId); auto status = createAppDataDirs(path, sandboxUid, AID_NOBODY, &previousSandboxUid, cacheGid, seInfo, 0700 | S_ISGID); int32_t appUid = multiuser_get_uid(userId, appId); long projectIdApp = get_project_id(appUid, PROJECT_ID_APP_START); long projectIdCache = get_project_id(appUid, PROJECT_ID_APP_CACHE_START); auto status = createAppDataDirs(path, sandboxUid, AID_NOBODY, &previousSandboxUid, cacheGid, seInfo, 0700 | S_ISGID, projectIdApp, projectIdCache); if (!status.isOk()) { res = status; continue; Loading include/android/sensor.h +11 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,13 @@ enum { * {@link ASENSOR_TYPE_HEART_BEAT} */ ASENSOR_TYPE_HEART_BEAT = 31, /** * A constant describing a dynamic sensor meta event sensor. * * A sensor event of this type is received when a dynamic sensor is added to or removed from * the system. This sensor type should always use special trigger report mode. */ ASENSOR_TYPE_DYNAMIC_SENSOR_META = 32, /** * This sensor type is for delivering additional sensor information aside * from sensor event data. Loading Loading @@ -761,6 +768,10 @@ int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list); * Each time this is called, the previously returned list is deallocated and * must no longer be used. * * Clients should call this if they receive a sensor update from * {@link ASENSOR_TYPE_DYNAMIC_SENSOR_META} indicating the sensors have changed. * If this happens, previously received lists from this method will be stale. * * Available since API level 33. * * \param manager the {@link ASensorManager} instance obtained from Loading libs/gui/SurfaceComposerClient.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -208,12 +208,14 @@ int64_t TransactionCompletedListener::getNextIdLocked() { } sp<TransactionCompletedListener> TransactionCompletedListener::sInstance = nullptr; static std::mutex sListenerInstanceMutex; void TransactionCompletedListener::setInstance(const sp<TransactionCompletedListener>& listener) { sInstance = listener; } sp<TransactionCompletedListener> TransactionCompletedListener::getInstance() { std::lock_guard<std::mutex> lock(sListenerInstanceMutex); if (sInstance == nullptr) { sInstance = new TransactionCompletedListener; } Loading libs/input/android/os/InputEventInjectionResult.aidl +2 −3 Original line number Diff line number Diff line Loading @@ -29,9 +29,8 @@ enum InputEventInjectionResult { /* Injection succeeded. */ SUCCEEDED = 0, /* Injection failed because the injector did not have permission to inject * into the application with input focus. */ PERMISSION_DENIED = 1, /* Injection failed because the injected event did not target the appropriate window. */ TARGET_MISMATCH = 1, /* Injection failed because there were no available input targets. */ FAILED = 2, Loading services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp +10 −12 Original line number Diff line number Diff line Loading @@ -31,11 +31,11 @@ using android::os::InputEventInjectionSync; namespace android::inputdispatcher { // An arbitrary device id. static const int32_t DEVICE_ID = 1; constexpr int32_t DEVICE_ID = 1; // An arbitrary injector pid / uid pair that has permission to inject events. static const int32_t INJECTOR_PID = 999; static const int32_t INJECTOR_UID = 1001; // The default pid and uid for windows created by the test. constexpr int32_t WINDOW_PID = 999; constexpr int32_t WINDOW_UID = 1001; static constexpr std::chrono::duration INJECT_EVENT_TIMEOUT = 5s; static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 100ms; Loading Loading @@ -108,8 +108,6 @@ private: void pokeUserActivity(nsecs_t, int32_t, int32_t) override {} bool checkInjectEventsPermissionNonReentrant(int32_t, int32_t) override { return false; } void onPointerDownOutsideFocus(const sp<IBinder>& newToken) override {} void setPointerCapture(const PointerCaptureRequest&) override {} Loading Loading @@ -196,8 +194,8 @@ public: mInfo.globalScaleFactor = 1.0; mInfo.touchableRegion.clear(); mInfo.addTouchableRegion(mFrame); mInfo.ownerPid = INJECTOR_PID; mInfo.ownerUid = INJECTOR_UID; mInfo.ownerPid = WINDOW_PID; mInfo.ownerUid = WINDOW_UID; mInfo.displayId = ADISPLAY_ID_DEFAULT; } Loading Loading @@ -310,14 +308,14 @@ static void benchmarkInjectMotion(benchmark::State& state) { for (auto _ : state) { MotionEvent event = generateMotionEvent(); // Send ACTION_DOWN dispatcher.injectInputEvent(&event, INJECTOR_PID, INJECTOR_UID, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT, dispatcher.injectInputEvent(&event, {} /*targetUid*/, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT, POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER); // Send ACTION_UP event.setAction(AMOTION_EVENT_ACTION_UP); dispatcher.injectInputEvent(&event, INJECTOR_PID, INJECTOR_UID, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT, dispatcher.injectInputEvent(&event, {} /*targetUid*/, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT, POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER); window->consumeEvent(); Loading Loading
cmds/installd/InstalldNativeService.cpp +18 −10 Original line number Diff line number Diff line Loading @@ -634,7 +634,8 @@ static void chown_app_profile_dir(const std::string &packageName, int32_t appId, static binder::Status createAppDataDirs(const std::string& path, int32_t uid, int32_t gid, int32_t* previousUid, int32_t cacheGid, const std::string& seInfo, mode_t targetMode) { const std::string& seInfo, mode_t targetMode, long projectIdApp, long projectIdCache) { struct stat st{}; bool parent_dir_exists = (stat(path.c_str(), &st) == 0); Loading @@ -658,11 +659,9 @@ static binder::Status createAppDataDirs(const std::string& path, int32_t uid, in } // Prepare only the parent app directory long project_id_app = get_project_id(uid, PROJECT_ID_APP_START); long project_id_cache_app = get_project_id(uid, PROJECT_ID_APP_CACHE_START); if (prepare_app_dir(path, targetMode, uid, gid, project_id_app) || prepare_app_cache_dir(path, "cache", 02771, uid, cacheGid, project_id_cache_app) || prepare_app_cache_dir(path, "code_cache", 02771, uid, cacheGid, project_id_cache_app)) { if (prepare_app_dir(path, targetMode, uid, gid, projectIdApp) || prepare_app_cache_dir(path, "cache", 02771, uid, cacheGid, projectIdCache) || prepare_app_cache_dir(path, "code_cache", 02771, uid, cacheGid, projectIdCache)) { return error("Failed to prepare " + path); } Loading Loading @@ -718,10 +717,14 @@ binder::Status InstalldNativeService::createAppDataLocked( cacheGid = uid; } long projectIdApp = get_project_id(uid, PROJECT_ID_APP_START); long projectIdCache = get_project_id(uid, PROJECT_ID_APP_CACHE_START); if (flags & FLAG_STORAGE_CE) { auto path = create_data_user_ce_package_path(uuid_, userId, pkgname); auto status = createAppDataDirs(path, uid, uid, &previousUid, cacheGid, seInfo, targetMode); auto status = createAppDataDirs(path, uid, uid, &previousUid, cacheGid, seInfo, targetMode, projectIdApp, projectIdCache); if (!status.isOk()) { return status; } Loading @@ -746,7 +749,8 @@ binder::Status InstalldNativeService::createAppDataLocked( if (flags & FLAG_STORAGE_DE) { auto path = create_data_user_de_package_path(uuid_, userId, pkgname); auto status = createAppDataDirs(path, uid, uid, &previousUid, cacheGid, seInfo, targetMode); auto status = createAppDataDirs(path, uid, uid, &previousUid, cacheGid, seInfo, targetMode, projectIdApp, projectIdCache); if (!status.isOk()) { return status; } Loading Loading @@ -946,8 +950,12 @@ binder::Status InstalldNativeService::reconcileSdkData(const std::optional<std:: } const int32_t sandboxUid = multiuser_get_sdk_sandbox_uid(userId, appId); int32_t previousSandboxUid = multiuser_get_sdk_sandbox_uid(userId, previousAppId); auto status = createAppDataDirs(path, sandboxUid, AID_NOBODY, &previousSandboxUid, cacheGid, seInfo, 0700 | S_ISGID); int32_t appUid = multiuser_get_uid(userId, appId); long projectIdApp = get_project_id(appUid, PROJECT_ID_APP_START); long projectIdCache = get_project_id(appUid, PROJECT_ID_APP_CACHE_START); auto status = createAppDataDirs(path, sandboxUid, AID_NOBODY, &previousSandboxUid, cacheGid, seInfo, 0700 | S_ISGID, projectIdApp, projectIdCache); if (!status.isOk()) { res = status; continue; Loading
include/android/sensor.h +11 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,13 @@ enum { * {@link ASENSOR_TYPE_HEART_BEAT} */ ASENSOR_TYPE_HEART_BEAT = 31, /** * A constant describing a dynamic sensor meta event sensor. * * A sensor event of this type is received when a dynamic sensor is added to or removed from * the system. This sensor type should always use special trigger report mode. */ ASENSOR_TYPE_DYNAMIC_SENSOR_META = 32, /** * This sensor type is for delivering additional sensor information aside * from sensor event data. Loading Loading @@ -761,6 +768,10 @@ int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list); * Each time this is called, the previously returned list is deallocated and * must no longer be used. * * Clients should call this if they receive a sensor update from * {@link ASENSOR_TYPE_DYNAMIC_SENSOR_META} indicating the sensors have changed. * If this happens, previously received lists from this method will be stale. * * Available since API level 33. * * \param manager the {@link ASensorManager} instance obtained from Loading
libs/gui/SurfaceComposerClient.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -208,12 +208,14 @@ int64_t TransactionCompletedListener::getNextIdLocked() { } sp<TransactionCompletedListener> TransactionCompletedListener::sInstance = nullptr; static std::mutex sListenerInstanceMutex; void TransactionCompletedListener::setInstance(const sp<TransactionCompletedListener>& listener) { sInstance = listener; } sp<TransactionCompletedListener> TransactionCompletedListener::getInstance() { std::lock_guard<std::mutex> lock(sListenerInstanceMutex); if (sInstance == nullptr) { sInstance = new TransactionCompletedListener; } Loading
libs/input/android/os/InputEventInjectionResult.aidl +2 −3 Original line number Diff line number Diff line Loading @@ -29,9 +29,8 @@ enum InputEventInjectionResult { /* Injection succeeded. */ SUCCEEDED = 0, /* Injection failed because the injector did not have permission to inject * into the application with input focus. */ PERMISSION_DENIED = 1, /* Injection failed because the injected event did not target the appropriate window. */ TARGET_MISMATCH = 1, /* Injection failed because there were no available input targets. */ FAILED = 2, Loading
services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp +10 −12 Original line number Diff line number Diff line Loading @@ -31,11 +31,11 @@ using android::os::InputEventInjectionSync; namespace android::inputdispatcher { // An arbitrary device id. static const int32_t DEVICE_ID = 1; constexpr int32_t DEVICE_ID = 1; // An arbitrary injector pid / uid pair that has permission to inject events. static const int32_t INJECTOR_PID = 999; static const int32_t INJECTOR_UID = 1001; // The default pid and uid for windows created by the test. constexpr int32_t WINDOW_PID = 999; constexpr int32_t WINDOW_UID = 1001; static constexpr std::chrono::duration INJECT_EVENT_TIMEOUT = 5s; static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 100ms; Loading Loading @@ -108,8 +108,6 @@ private: void pokeUserActivity(nsecs_t, int32_t, int32_t) override {} bool checkInjectEventsPermissionNonReentrant(int32_t, int32_t) override { return false; } void onPointerDownOutsideFocus(const sp<IBinder>& newToken) override {} void setPointerCapture(const PointerCaptureRequest&) override {} Loading Loading @@ -196,8 +194,8 @@ public: mInfo.globalScaleFactor = 1.0; mInfo.touchableRegion.clear(); mInfo.addTouchableRegion(mFrame); mInfo.ownerPid = INJECTOR_PID; mInfo.ownerUid = INJECTOR_UID; mInfo.ownerPid = WINDOW_PID; mInfo.ownerUid = WINDOW_UID; mInfo.displayId = ADISPLAY_ID_DEFAULT; } Loading Loading @@ -310,14 +308,14 @@ static void benchmarkInjectMotion(benchmark::State& state) { for (auto _ : state) { MotionEvent event = generateMotionEvent(); // Send ACTION_DOWN dispatcher.injectInputEvent(&event, INJECTOR_PID, INJECTOR_UID, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT, dispatcher.injectInputEvent(&event, {} /*targetUid*/, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT, POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER); // Send ACTION_UP event.setAction(AMOTION_EVENT_ACTION_UP); dispatcher.injectInputEvent(&event, INJECTOR_PID, INJECTOR_UID, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT, dispatcher.injectInputEvent(&event, {} /*targetUid*/, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT, POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER); window->consumeEvent(); Loading