From b24e21cb85f3361ab97b012b3000886a2eac6bf3 Mon Sep 17 00:00:00 2001 From: Hu Guo Date: Sat, 4 May 2024 10:40:33 +0000 Subject: [PATCH 001/492] Fixed null pointer exception During this view traversal, the child view may be removed, resulting in a null pointer exception Change-Id: I1507910e64516d65968c34c2e3fdb21c3e2cffce --- core/java/android/view/ViewGroup.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 287c7b29813f..4404279493ba 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -4519,6 +4519,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final View[] children = mChildren; for (int i = 0; i < count; i++) { final View child = children[i]; + if (child == null) { + throw new IllegalStateException(getClass().getSimpleName() + " contains null " + + "child at index " + i + " when traversal in dispatchGetDisplayList," + + " the view may have been removed."); + } if (((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null)) { recreateChildDisplayList(child); } -- GitLab From b5f5546c672d9786b40568911338e1e8850d7ae2 Mon Sep 17 00:00:00 2001 From: Song Chun Fan Date: Tue, 6 Aug 2024 18:24:04 +0000 Subject: [PATCH 002/492] [pm] clarify the javadoc for getArchivedAppIcon Change-Id: I1572d93c78206dd163aff052d89761c7990cdfa2 BUG: 350758155 Test: n/a FLAG: EXEMPT doc only --- .../core/java/com/android/server/pm/PackageArchiver.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageArchiver.java b/services/core/java/com/android/server/pm/PackageArchiver.java index 5e45b4c2d5af..f53234215fc6 100644 --- a/services/core/java/com/android/server/pm/PackageArchiver.java +++ b/services/core/java/com/android/server/pm/PackageArchiver.java @@ -936,13 +936,9 @@ public class PackageArchiver { *

In the rare case the app had multiple launcher activities, only one of the icons is * returned arbitrarily. * - *

By default, the icon will be overlay'd with a cloud icon on top. A launcher app can + *

By default, the icon will be overlay'd with a cloud icon on top. An app can * disable the cloud overlay via the * {@link LauncherApps.ArchiveCompatibilityParams#setEnableIconOverlay(boolean)} API. - * The default launcher's cloud overlay mode determines the cloud overlay status returned by - * any other callers. That is, if the current launcher has the cloud overlay disabled, any other - * app that fetches the app icon will also get an icon that has the cloud overlay disabled. - * This is to prevent style mismatch caused by icons that are fetched by different callers. */ @Nullable public Bitmap getArchivedAppIcon(@NonNull String packageName, @NonNull UserHandle user, -- GitLab From 89db614840e6707aedc953d07f1f4a87d3c66bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Ba=C3=AFsse?= Date: Mon, 19 Aug 2024 13:56:21 +0000 Subject: [PATCH 003/492] Fix parameter for Gatekeeper re-enroll in SyntheticPasswordManager Gatekeeper's re-enroll feature requires the enroll() API to be called with currentPasswordHandle, currentPassword, and newPassword. Currently, the currentPassword parameter in SyntheticPasswordManager is incorrectly set to spHandle instead of gatekeeperPassword. This causes the re-enroll feature to fail, as Gatekeeper receives a password handle instead of the expected password, leading to a mismatch during the re-enrollment process. Change-Id: Iad84a23e72940ad04aa9d663e871bf2cef0ce1cf --- .../android/server/locksettings/SyntheticPasswordManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java b/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java index cc58f38db65a..3a429b041b3c 100644 --- a/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java +++ b/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java @@ -1701,7 +1701,7 @@ class SyntheticPasswordManager { .setGatekeeperHAT(response.getPayload()).build(); if (response.getShouldReEnroll()) { try { - response = gatekeeper.enroll(userId, spHandle, spHandle, + response = gatekeeper.enroll(userId, spHandle, gatekeeperPassword, gatekeeperPassword); } catch (RemoteException e) { Slog.e(TAG, "Failed to invoke gatekeeper.enroll", e); -- GitLab From e3b3f741ad1c400781ed0c430716b54173a82062 Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Wed, 7 Aug 2024 15:51:00 +0000 Subject: [PATCH 004/492] Add a new group for foreground of multi-window Add THREAD_GROUP_FOREGROUND_MW. Bug: 200769420 Test: build pass Flag: com.android.window.flags.process_priority_policy_for_multi_window_mode Change-Id: I24cd327caad3be5827a45ede41cb7404246536c8 --- core/java/android/os/Process.java | 6 ++++++ core/jni/android_util_Process.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index db06a6ba0ef5..22a87512cd2c 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -589,6 +589,12 @@ public class Process { **/ public static final int THREAD_GROUP_RESTRICTED = 7; + /** + * Thread group for foreground apps in multi-window mode + * @hide + **/ + public static final int THREAD_GROUP_FOREGROUND_WINDOW = 8; + /** @hide */ public static final int SIGNAL_DEFAULT = 0; public static final int SIGNAL_QUIT = 3; diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index e5ac0e1a8f6e..49191ee02ad6 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -404,6 +404,11 @@ static void get_cpuset_cores_for_policy(SchedPolicy policy, cpu_set_t *cpu_set) return; } break; + case SP_FOREGROUND_WINDOW: + if (!CgroupGetAttributePath("HighCapacityWICPUs", &filename)) { + return; + } + break; case SP_TOP_APP: if (!CgroupGetAttributePath("MaxCapacityCPUs", &filename)) { return; -- GitLab From 72dc206a631ee695cb5c8606adec581823959204 Mon Sep 17 00:00:00 2001 From: Ronald Braunstein Date: Wed, 21 Aug 2024 18:49:48 +0000 Subject: [PATCH 005/492] Migrate more of FrameworksServicesTests to use options from Android.bp Followup to cl aosp/3225805, update non-presubmit groups and files I missed. go/test-module-variant-migration-plan Test: atest FrameworksServicesTests_accessibility \ FrameworksServicesTests_android_server_am \ FrameworksServicesTests_android_server_hdmi \ FrameworksServicesTests_android_server_logcat \ FrameworksServicesTests_android_server_power \ FrameworksServicesTests_binary_transparency \ FrameworksServicesTests_com_android_server_job \ FrameworksServicesTests_com_android_server_usage \ FrameworksServicesTests_pinner_service \ FrameworksServicesTests_presubmit % grep -B2 Tests\) fst.log [8:07:14]/0 x86_64 FrameworksServicesTests_accessibility -------------------------------------------- com.android.frameworks.servicestests (812 Tests) -- x86_64 FrameworksServicesTests_android_server_am ------------------------------------------------ com.android.frameworks.servicestests (102 Tests) -- x86_64 FrameworksServicesTests_android_server_hdmi -------------------------------------------------- com.android.frameworks.servicestests (749 Tests) -- x86_64 FrameworksServicesTests_android_server_logcat ---------------------------------------------------- com.android.frameworks.servicestests (13 Tests) -- x86_64 FrameworksServicesTests_android_server_power --------------------------------------------------- com.android.frameworks.servicestests (87 Tests) -- x86_64 FrameworksServicesTests_binary_transparency -------------------------------------------------- com.android.frameworks.servicestests (6 Tests) -- x86_64 FrameworksServicesTests_com_android_server_job ----------------------------------------------------- com.android.frameworks.servicestests (72 Tests) -- x86_64 FrameworksServicesTests_com_android_server_usage ------------------------------------------------------- com.android.frameworks.servicestests (125 Tests) -- x86_64 FrameworksServicesTests_pinner_service --------------------------------------------- com.android.frameworks.servicestests (6 Tests) -- x86_64 FrameworksServicesTests_presubmit ---------------------------------------- com.android.frameworks.servicestests (3288 Tests) Bug: b/344977340 Test-Mapping-Slo-Bypass-Bug: b/335015078 Change-Id: I4766a0f62358ff3e266a100ff3edcf439e9a1999 --- .../java/com/android/server/job/TEST_MAPPING | 5 +--- .../com/android/server/usage/TEST_MAPPING | 5 +--- services/accessibility/TEST_MAPPING | 7 +---- .../core/java/com/android/server/TEST_MAPPING | 27 +++---------------- .../java/com/android/server/am/TEST_MAPPING | 7 +---- .../java/com/android/server/hdmi/TEST_MAPPING | 10 +------ .../com/android/server/logcat/TEST_MAPPING | 5 +--- .../com/android/server/power/TEST_MAPPING | 5 +--- 8 files changed, 10 insertions(+), 61 deletions(-) diff --git a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING index 36b6c80eebe3..e89d80d02047 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING +++ b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING @@ -30,10 +30,7 @@ ] }, { - "name": "FrameworksServicesTests", - "options": [ - {"include-filter": "com.android.server.job"} - ] + "name": "FrameworksServicesTests_com_android_server_job" }, { "name": "CtsHostsideNetworkPolicyTests", diff --git a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING index 52670a2570d3..38a922ad1bc6 100644 --- a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING +++ b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING @@ -25,10 +25,7 @@ "name": "CtsUsageStatsTestCases" }, { - "name": "FrameworksServicesTests", - "options": [ - {"include-filter": "com.android.server.usage"} - ] + "name": "FrameworksServicesTests_com_android_server_usage" } ] } diff --git a/services/accessibility/TEST_MAPPING b/services/accessibility/TEST_MAPPING index 454a3299af68..b122d1f6346a 100644 --- a/services/accessibility/TEST_MAPPING +++ b/services/accessibility/TEST_MAPPING @@ -45,12 +45,7 @@ "name": "CtsUiAutomationTestCases" }, { - "name": "FrameworksServicesTests", - "options": [ - { - "include-filter": "com.android.server.accessibility" - } - ] + "name": "FrameworksServicesTests_accessibility" }, { "name": "FrameworksCoreTests", diff --git a/services/core/java/com/android/server/TEST_MAPPING b/services/core/java/com/android/server/TEST_MAPPING index 25337a434329..bacbd8be5ffc 100644 --- a/services/core/java/com/android/server/TEST_MAPPING +++ b/services/core/java/com/android/server/TEST_MAPPING @@ -62,24 +62,11 @@ "file_patterns": ["SensorPrivacyService\\.java"] }, { - "name": "FrameworksServicesTests", - "options": [ - { - "include-filter": "com.android.server.BinaryTransparencyServiceTest" - } - ], + "name": "FrameworksServicesTests_binary_transparency", "file_patterns": ["BinaryTransparencyService\\.java"] }, { - "name": "FrameworksServicesTests", - "options": [ - { - "include-filter": "com.android.server.PinnerServiceTest" - }, - { - "exclude-annotation": "org.junit.Ignore" - } - ], + "name": "FrameworksServicesTests_pinner_service", "file_patterns": ["PinnerService\\.java"] }, { @@ -153,15 +140,7 @@ "name": "CtsPackageManagerTestCases" }, { - "name": "FrameworksServicesTests", - "options": [ - { - "include-filter": "com.android.server.PinnerServiceTest" - }, - { - "exclude-annotation": "org.junit.Ignore" - } - ], + "name": "FrameworksServicesTests_pinner_service", "file_patterns": ["PinnerService\\.java"] } ] diff --git a/services/core/java/com/android/server/am/TEST_MAPPING b/services/core/java/com/android/server/am/TEST_MAPPING index c138a592378b..46684bb85c51 100644 --- a/services/core/java/com/android/server/am/TEST_MAPPING +++ b/services/core/java/com/android/server/am/TEST_MAPPING @@ -109,12 +109,7 @@ ], "postsubmit": [ { - "name": "FrameworksServicesTests", - "options": [ - { - "include-filter": "com.android.server.am." - } - ] + "name": "FrameworksServicesTests_android_server_am" }, { "name": "CtsAppDataIsolationHostTestCases" diff --git a/services/core/java/com/android/server/hdmi/TEST_MAPPING b/services/core/java/com/android/server/hdmi/TEST_MAPPING index 64c06a6f0fe2..bef1294cd795 100644 --- a/services/core/java/com/android/server/hdmi/TEST_MAPPING +++ b/services/core/java/com/android/server/hdmi/TEST_MAPPING @@ -6,15 +6,7 @@ ], "postsubmit": [ { - "name": "FrameworksServicesTests", - "options": [ - { - "include-filter": "com.android.server.hdmi" - }, - { - "exclude-annotation": "org.junit.Ignore" - } - ] + "name": "FrameworksServicesTests_android_server_hdmi" } ] } diff --git a/services/core/java/com/android/server/logcat/TEST_MAPPING b/services/core/java/com/android/server/logcat/TEST_MAPPING index 5b07cd960fbe..c9d21dec0cc5 100644 --- a/services/core/java/com/android/server/logcat/TEST_MAPPING +++ b/services/core/java/com/android/server/logcat/TEST_MAPPING @@ -6,10 +6,7 @@ ], "postsubmit": [ { - "name": "FrameworksServicesTests", - "options": [ - {"include-filter": "com.android.server.logcat"} - ] + "name": "FrameworksServicesTests_android_server_logcat" } ] } diff --git a/services/core/java/com/android/server/power/TEST_MAPPING b/services/core/java/com/android/server/power/TEST_MAPPING index e64704a84cdf..701e83b4f0aa 100644 --- a/services/core/java/com/android/server/power/TEST_MAPPING +++ b/services/core/java/com/android/server/power/TEST_MAPPING @@ -34,10 +34,7 @@ ] }, { - "name": "FrameworksServicesTests", - "options": [ - {"include-filter": "com.android.server.power"} - ] + "name": "FrameworksServicesTests_android_server_power" }, { "name": "PowerServiceTests", -- GitLab From 7c4da90c9f2bff2c7ccf8846e4ca4a62d35f4bcc Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Mon, 12 Aug 2024 19:44:59 +0000 Subject: [PATCH 006/492] Make SensorPrivacyManager and SensorPrivacyService concurrent multi user aware In Automotive's Multi Display configuration, multiple Android users - the current user (driver) and visible background users (passengers) can interact with the device concurrently therefore may be accessing the sensor privacy API surface concurrently. Existing code that assumes the calling user is the current user will cause visible background users (passengers) to be able to toggle the current user (driver)'s sensor privacy. Fixes include: - Set sensor privacy for the context user instead of always assuming the current user. - Enforce valid calling users by disallowing visible background users to toggle sensor privacy based on Automotive's product decision to only allow the driver to toggle sensor privacy. - Check valid calling user before setting sensor privacy in onUserRestrictionsChanged because DISALLOW_MICROPHONE_TOGGLE and DISALLOW_CAMERA_TOGGLE are applied on visible background users in CarService but we don't allow setting sensor privacy on a visible background user. Bug: 348510106 Flag: EXEMPT bug fix Test: manually tested on gcar_md emulator Test: Temporarily remove DISALLOW_MICROPHONE_TOGGLE on passengers to make microphone toggle available on a passenger and toggling it will fail Change-Id: Iede71fa6cd6ac2962916479b8c5751cd75e6f4e6 --- .../android/app/SystemServiceRegistry.java | 9 ++- .../hardware/SensorPrivacyManager.java | 8 ++- .../sensorprivacy/SensorPrivacyService.java | 65 ++++++++++++++++++- 3 files changed, 74 insertions(+), 8 deletions(-) diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index cb38cf297cf6..f315772a4eed 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -101,6 +101,7 @@ import android.debug.IAdbManager; import android.devicelock.DeviceLockFrameworkInitializer; import android.graphics.fonts.FontManager; import android.hardware.ConsumerIrManager; +import android.hardware.ISensorPrivacyManager; import android.hardware.ISerialManager; import android.hardware.SensorManager; import android.hardware.SensorPrivacyManager; @@ -704,8 +705,12 @@ public final class SystemServiceRegistry { registerService(Context.SENSOR_PRIVACY_SERVICE, SensorPrivacyManager.class, new CachedServiceFetcher() { @Override - public SensorPrivacyManager createService(ContextImpl ctx) { - return SensorPrivacyManager.getInstance(ctx); + public SensorPrivacyManager createService(ContextImpl ctx) + throws ServiceNotFoundException { + IBinder b = ServiceManager.getServiceOrThrow( + Context.SENSOR_PRIVACY_SERVICE); + return SensorPrivacyManager.getInstance( + ctx, ISensorPrivacyManager.Stub.asInterface(b)); }}); registerService(Context.STATUS_BAR_SERVICE, StatusBarManager.class, diff --git a/core/java/android/hardware/SensorPrivacyManager.java b/core/java/android/hardware/SensorPrivacyManager.java index 4cdaaddd05bf..a4c0e87c965b 100644 --- a/core/java/android/hardware/SensorPrivacyManager.java +++ b/core/java/android/hardware/SensorPrivacyManager.java @@ -797,7 +797,7 @@ public final class SensorPrivacyManager { public void setSensorPrivacy(@Sensors.Sensor int sensor, boolean enable) { setSensorPrivacy(resolveSourceFromCurrentContext(), sensor, enable, - UserHandle.USER_CURRENT); + mContext.getUserId()); } private @Sources.Source int resolveSourceFromCurrentContext() { @@ -837,6 +837,8 @@ public final class SensorPrivacyManager { @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacy(@Sources.Source int source, @Sensors.Sensor int sensor, boolean enable) { + // TODO(b/348510106): Replace USER_CURRENT with Context user and fix any tests that may be + // affected. setSensorPrivacy(source, sensor, enable, UserHandle.USER_CURRENT); } @@ -894,7 +896,7 @@ public final class SensorPrivacyManager { @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacyForProfileGroup(@Sources.Source int source, @Sensors.Sensor int sensor, boolean enable) { - setSensorPrivacyForProfileGroup(source , sensor, enable, UserHandle.USER_CURRENT); + setSensorPrivacyForProfileGroup(source , sensor, enable, mContext.getUserId()); } /** @@ -950,7 +952,7 @@ public final class SensorPrivacyManager { @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY) public void suppressSensorPrivacyReminders(int sensor, boolean suppress) { - suppressSensorPrivacyReminders(sensor, suppress, UserHandle.USER_CURRENT); + suppressSensorPrivacyReminders(sensor, suppress, mContext.getUserId()); } /** diff --git a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java index 06a2565da75a..81217014bafe 100644 --- a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java +++ b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java @@ -51,6 +51,7 @@ import static android.hardware.SensorPrivacyManager.StateTypes.ENABLED_EXCEPT_AL import static android.hardware.SensorPrivacyManager.TOGGLE_TYPE_HARDWARE; import static android.hardware.SensorPrivacyManager.TOGGLE_TYPE_SOFTWARE; import static android.os.UserHandle.USER_NULL; +import static android.os.UserHandle.getCallingUserId; import static android.service.SensorPrivacyIndividualEnabledSensorProto.UNKNOWN; import static com.android.internal.util.FrameworkStatsLog.PRIVACY_SENSOR_TOGGLE_INTERACTION; @@ -187,6 +188,7 @@ public final class SensorPrivacyService extends SystemService { private final TelephonyManager mTelephonyManager; private final PackageManagerInternal mPackageManagerInternal; private final NotificationManager mNotificationManager; + private final UserManager mUserManager; private CameraPrivacyLightController mCameraPrivacyLightController; @@ -214,6 +216,7 @@ public final class SensorPrivacyService extends SystemService { mTelephonyManager = context.getSystemService(TelephonyManager.class); mPackageManagerInternal = getLocalService(PackageManagerInternal.class); mNotificationManager = mContext.getSystemService(NotificationManager.class); + mUserManager = context.getSystemService(UserManager.class); mSensorPrivacyServiceImpl = new SensorPrivacyServiceImpl(); for (String entry : SystemConfig.getInstance().getCameraPrivacyAllowlist()) { mCameraPrivacyAllowlist.add(entry); @@ -379,14 +382,23 @@ public final class SensorPrivacyService extends SystemService { public void onUserRestrictionsChanged(int userId, Bundle newRestrictions, Bundle prevRestrictions) { // Reset sensor privacy when restriction is added + // Note: isValidCallingUser needs to be called before resetting sensor privacy + // because DISALLOW_CAMERA_TOGGLE and DISALLOW_MICROPHONE_TOGGLE are applied on + // visible background users in Automotive's Multi Display configuration but we don't + // allow sensor privacy to be set on a visible background user. if (!prevRestrictions.getBoolean(UserManager.DISALLOW_CAMERA_TOGGLE) && newRestrictions.getBoolean(UserManager.DISALLOW_CAMERA_TOGGLE)) { - setToggleSensorPrivacyUnchecked(TOGGLE_TYPE_SOFTWARE, userId, OTHER, CAMERA, false); + if (isValidCallingUser(userId)) { + setToggleSensorPrivacyUnchecked(TOGGLE_TYPE_SOFTWARE, userId, OTHER, CAMERA, + false); + } } if (!prevRestrictions.getBoolean(UserManager.DISALLOW_MICROPHONE_TOGGLE) && newRestrictions.getBoolean(UserManager.DISALLOW_MICROPHONE_TOGGLE)) { - setToggleSensorPrivacyUnchecked(TOGGLE_TYPE_SOFTWARE, userId, OTHER, MICROPHONE, - false); + if (isValidCallingUser(userId)) { + setToggleSensorPrivacyUnchecked(TOGGLE_TYPE_SOFTWARE, userId, OTHER, MICROPHONE, + false); + } } } @@ -779,6 +791,10 @@ public final class SensorPrivacyService extends SystemService { @Override public void setSensorPrivacy(boolean enable) { enforceManageSensorPrivacyPermission(); + + // Enforce valid calling user on devices that enable visible background users. + enforceValidCallingUser(getCallingUserId()); + mSensorPrivacyStateController.setAllSensorState(enable); } @@ -795,11 +811,15 @@ public final class SensorPrivacyService extends SystemService { + " enable=" + enable + ")"); } + enforceManageSensorPrivacyPermission(); if (userId == UserHandle.USER_CURRENT) { userId = mCurrentUser; } + // Enforce valid calling user on devices that enable visible background users. + enforceValidCallingUser(userId); + if (!canChangeToggleSensorPrivacy(userId, sensor)) { return; } @@ -831,6 +851,9 @@ public final class SensorPrivacyService extends SystemService { userId = mCurrentUser; } + // Enforce valid calling user on devices that enable visible background users. + enforceValidCallingUser(userId); + if (!canChangeToggleSensorPrivacy(userId, sensor)) { return; } @@ -1151,6 +1174,42 @@ public final class SensorPrivacyService extends SystemService { }); } + // This method enforces valid calling user on devices that enable visible background users. + // Only system user or current user or the user that belongs to the same profile group + // as the current user is permitted to toggle sensor privacy. + // Visible background users are not permitted to toggle sensor privacy. + private void enforceValidCallingUser(@UserIdInt int userId) { + if (!isValidCallingUser(userId)) { + throw new SecurityException("User " + userId + + " is not permitted to toggle sensor privacy"); + } + } + + private boolean isValidCallingUser(@UserIdInt int userId) { + // Check whether visible background users are enabled. + // Visible background users are non current but can have UI access. + // The main use case for visible background users is the passenger in Automotive's + // Multi-Display configuration. + if (!UserManager.isVisibleBackgroundUsersEnabled()) { + return true; + } + + if (userId == UserHandle.USER_SYSTEM || userId == mCurrentUser) { + return true; + } + + final long ident = Binder.clearCallingIdentity(); + try { + if (mUserManager.isSameProfileGroup(userId, mCurrentUser)) { + return true; + } + } finally { + Binder.restoreCallingIdentity(ident); + } + + return false; + } + /** * Enforces the caller contains the necessary permission to change the state of sensor * privacy. -- GitLab From 841f68cb1955fd9e944778dda274c62707de8b0c Mon Sep 17 00:00:00 2001 From: archisha Date: Tue, 20 Aug 2024 08:56:14 +0000 Subject: [PATCH 007/492] Adding ViewCaptureAwareWindowManager to MirrorControlWindow. Bug: 361019202 Flag: com.android.systemui.enable_view_capture_tracing Test: MirrowWindowControlTest Change-Id: If8ecc6755a202d39f72287ecbf1630d31a7f6163 --- .../accessibility/MirrorWindowControlTest.java | 4 ++-- .../systemui/accessibility/MirrorWindowControl.java | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/MirrorWindowControlTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/MirrorWindowControlTest.java index 8f9b7c8cbc45..12c866f0adb2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/MirrorWindowControlTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/MirrorWindowControlTest.java @@ -30,11 +30,11 @@ import android.graphics.Point; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.WindowManager; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; +import com.android.app.viewcapture.ViewCaptureAwareWindowManager; import com.android.systemui.SysuiTestCase; import org.junit.Before; @@ -48,7 +48,7 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidJUnit4.class) public class MirrorWindowControlTest extends SysuiTestCase { - @Mock WindowManager mWindowManager; + @Mock ViewCaptureAwareWindowManager mWindowManager; View mView; int mViewWidth; int mViewHeight; diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/MirrorWindowControl.java b/packages/SystemUI/src/com/android/systemui/accessibility/MirrorWindowControl.java index 443441f1ef48..eb4de6837d41 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/MirrorWindowControl.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/MirrorWindowControl.java @@ -18,6 +18,9 @@ package com.android.systemui.accessibility; import static android.view.WindowManager.LayoutParams; +import static com.android.app.viewcapture.ViewCaptureFactory.getViewCaptureAwareWindowManagerInstance; +import static com.android.systemui.Flags.enableViewCaptureTracing; + import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; @@ -29,8 +32,8 @@ import android.util.MathUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; -import android.view.WindowManager; +import com.android.app.viewcapture.ViewCaptureAwareWindowManager; import com.android.systemui.res.R; /** @@ -70,11 +73,12 @@ public abstract class MirrorWindowControl { * @see #setDefaultPosition(LayoutParams) */ private final Point mControlPosition = new Point(); - private final WindowManager mWindowManager; + private final ViewCaptureAwareWindowManager mWindowManager; MirrorWindowControl(Context context) { mContext = context; - mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); + mWindowManager = getViewCaptureAwareWindowManagerInstance(mContext, + enableViewCaptureTracing()); } public void setWindowDelegate(@Nullable MirrorWindowDelegate windowDelegate) { -- GitLab From a196b6392fa39e76a689ede14962381388d543d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pomini?= Date: Mon, 26 Aug 2024 17:21:28 +0000 Subject: [PATCH 008/492] Properly check MANAGE_EXTERNAL_STORAGE for wallpaper checkCallingOrSelfPermission is not correct for apps that get MANAGE_EXTERNAL_STORAGE through AppOp. Flag: EXEMPT single-CL bugfix Bug: 341974583 Test: manual with a sample app from public bug b/360905185 Change-Id: I32b1d8fab2aa7316aa5060a6e67e83d0e6b38df0 --- .../wallpaper/WallpaperManagerService.java | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index ba2594abd4d4..34865dd72c54 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -2210,15 +2210,21 @@ public class WallpaperManagerService extends IWallpaperManager.Stub public ParcelFileDescriptor getWallpaperWithFeature(String callingPkg, String callingFeatureId, IWallpaperManagerCallback cb, final int which, Bundle outParams, int wallpaperUserId, boolean getCropped) { - final boolean hasPrivilege = hasPermission(READ_WALLPAPER_INTERNAL) - || hasPermission(MANAGE_EXTERNAL_STORAGE); + final int callingPid = Binder.getCallingPid(); + final int callingUid = Binder.getCallingUid(); + final boolean hasPrivilege = hasPermission(READ_WALLPAPER_INTERNAL); if (!hasPrivilege) { - mContext.getSystemService(StorageManager.class).checkPermissionReadImages(true, - Binder.getCallingPid(), Binder.getCallingUid(), callingPkg, callingFeatureId); + boolean hasManageExternalStorage = hasPermission(MANAGE_EXTERNAL_STORAGE) + || hasAppOpPermission(MANAGE_EXTERNAL_STORAGE, callingUid, callingPkg, + callingFeatureId, "getWallpaperWithFeature from package: " + callingPkg); + if (!hasManageExternalStorage) { + mContext.getSystemService(StorageManager.class).checkPermissionReadImages(true, + callingPid, callingUid, callingPkg, callingFeatureId); + } } - wallpaperUserId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), - Binder.getCallingUid(), wallpaperUserId, false, true, "getWallpaper", null); + wallpaperUserId = ActivityManager.handleIncomingUser(callingPid, callingUid, + wallpaperUserId, false, true, "getWallpaper", null); if (which != FLAG_SYSTEM && which != FLAG_LOCK) { throw new IllegalArgumentException("Must specify exactly one kind of wallpaper to read"); @@ -2334,6 +2340,22 @@ public class WallpaperManagerService extends IWallpaperManager.Stub return mContext.checkCallingOrSelfPermission(permission) == PERMISSION_GRANTED; } + private boolean hasAppOpPermission(String permission, int callingUid, String callingPackage, + String attributionTag, String message) { + final String op = AppOpsManager.permissionToOp(permission); + final int opMode = mAppOpsManager.noteOpNoThrow(op, callingUid, callingPackage, + attributionTag, message); + switch (opMode) { + case AppOpsManager.MODE_ALLOWED: + case AppOpsManager.MODE_FOREGROUND: + return true; + case AppOpsManager.MODE_DEFAULT: + return hasPermission(permission); + default: + return false; + } + } + @Override public WallpaperInfo getWallpaperInfo(int userId) { return getWallpaperInfoWithFlags(FLAG_SYSTEM, userId); -- GitLab From e1e6a946365c23964d1818b97e33d7e6e907fb6f Mon Sep 17 00:00:00 2001 From: arunvoddu Date: Wed, 28 Aug 2024 09:27:13 +0000 Subject: [PATCH 009/492] Provision to enable VDBG logs through mobile for UICC component. Flag: EXEMPT bugfix Bug: 362674945 Test: Built successfully Change-Id: I430d3521cbe51ec9695bf617f8b11438d6a940cd --- .../com/android/internal/telephony/util/TelephonyUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java index f31a87f2b1bf..4224338918f4 100644 --- a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java +++ b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java @@ -60,6 +60,7 @@ import java.util.regex.Pattern; public final class TelephonyUtils { private static final String LOG_TAG = "TelephonyUtils"; + public static final boolean FORCE_VERBOSE_STATE_LOGGING = false; /* stopship if true */ public static boolean IS_USER = "user".equals(android.os.Build.TYPE); public static boolean IS_DEBUGGABLE = SystemProperties.getInt("ro.debuggable", 0) == 1; -- GitLab From 605010b8d2d64f770a3ddb24ce56caea4a0e2ea5 Mon Sep 17 00:00:00 2001 From: Ioana Alexandru Date: Wed, 14 Aug 2024 10:09:47 +0000 Subject: [PATCH 010/492] setAccessibilityHeading for silent notif section This is an addition suggested by the a11y team. Change-Id: I17a180f3c701a36197b00621ccbe1369ca96c56a Fix: 320295324 Test: tested manually that "Silent" is considered a heading by TalkBack Flag: EXEMPT trivial change --- .../systemui/statusbar/notification/stack/SectionHeaderView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java index 580431a13d1b..969ff1b4ffe7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java @@ -68,6 +68,7 @@ public class SectionHeaderView extends StackScrollerDecorView { if (mLabelTextId != null) { mLabelView.setText(mLabelTextId); } + mLabelView.setAccessibilityHeading(true); } @Override -- GitLab From 75f7f7c20133532656b669c6fc360e2a4a406781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Kozynski?= Date: Tue, 27 Aug 2024 16:08:04 -0400 Subject: [PATCH 011/492] Adding dumps to QSFragmentCompose and viewmodel This allowed us to detect and fix some discrepancies and bugs in the bounds reported for the header (QQS), compared with the current QSFragmentLegacy.getHeaderView() implementation. Test: manual, dump QSFragmentCompose Test: manual, compare with flag off Flag: com.android.systemui.qs_ui_refactor_compose_fragment Fixes: 362507674 Change-Id: Ie2bbf663b54e2589e3d15f03f42c282eda411b7e --- .../qs/composefragment/QSFragmentCompose.kt | 127 +++++++++++++----- .../viewmodel/QSFragmentComposeViewModel.kt | 31 ++++- 2 files changed, 125 insertions(+), 33 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/composefragment/QSFragmentCompose.kt b/packages/SystemUI/src/com/android/systemui/qs/composefragment/QSFragmentCompose.kt index c39ff557e54f..c2f1c3dcd426 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/composefragment/QSFragmentCompose.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/composefragment/QSFragmentCompose.kt @@ -19,6 +19,7 @@ package com.android.systemui.qs.composefragment import android.annotation.SuppressLint import android.graphics.Rect import android.os.Bundle +import android.util.IndentingPrintWriter import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -41,8 +42,8 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.layout.layout -import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.layout.onPlaced +import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.layout.positionInRoot import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.res.dimensionResource @@ -59,7 +60,9 @@ import com.android.compose.modifiers.height import com.android.compose.modifiers.padding import com.android.compose.modifiers.thenIf import com.android.compose.theme.PlatformTheme +import com.android.systemui.Dumpable import com.android.systemui.compose.modifiers.sysuiResTag +import com.android.systemui.dump.DumpManager import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.media.controls.ui.controller.MediaHierarchyManager import com.android.systemui.media.controls.ui.view.MediaHost @@ -76,6 +79,10 @@ import com.android.systemui.qs.ui.composable.QuickSettingsTheme import com.android.systemui.qs.ui.composable.ShadeBody import com.android.systemui.res.R import com.android.systemui.util.LifecycleFragment +import com.android.systemui.util.asIndenting +import com.android.systemui.util.printSection +import com.android.systemui.util.println +import java.io.PrintWriter import java.util.function.Consumer import javax.inject.Inject import javax.inject.Named @@ -91,9 +98,10 @@ class QSFragmentCompose @Inject constructor( private val qsFragmentComposeViewModelFactory: QSFragmentComposeViewModel.Factory, + private val dumpManager: DumpManager, @Named(QUICK_QS_PANEL) private val qqsMediaHost: MediaHost, @Named(QS_PANEL) private val qsMediaHost: MediaHost, -) : LifecycleFragment(), QS { +) : LifecycleFragment(), QS, Dumpable { private val scrollListener = MutableStateFlow(null) private val heightListener = MutableStateFlow(null) @@ -118,8 +126,24 @@ constructor( var top by mutableStateOf(0) var bottom by mutableStateOf(0) var radius by mutableStateOf(0) + + fun dump(pw: IndentingPrintWriter) { + pw.printSection("NotificationScrimClippingParams") { + pw.println("isEnabled", isEnabled) + pw.println("leftInset", "${leftInset}px") + pw.println("rightInset", "${rightInset}px") + pw.println("top", "${top}px") + pw.println("bottom", "${bottom}px") + pw.println("radius", "${radius}px") + } + } } + override fun onStart() { + super.onStart() + registerDumpable() + } + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -343,11 +367,11 @@ constructor( } override fun getHeaderTop(): Int { - return viewModel.qqsHeaderHeight.value + return qqsPositionOnRoot.top } override fun getHeaderBottom(): Int { - return headerTop + qqsHeight.value + return qqsPositionOnRoot.bottom } override fun getHeaderLeft(): Int { @@ -358,7 +382,7 @@ constructor( outBounds.set(qqsPositionOnRoot) view?.getBoundsOnScreen(composeViewPositionOnScreen) ?: run { composeViewPositionOnScreen.setEmpty() } - qqsPositionOnRoot.offset(composeViewPositionOnScreen.left, composeViewPositionOnScreen.top) + outBounds.offset(composeViewPositionOnScreen.left, composeViewPositionOnScreen.top) } override fun isHeaderShown(): Boolean { @@ -404,37 +428,29 @@ constructor( onDispose { qqsVisible.value = false } } Column(modifier = Modifier.sysuiResTag("quick_qs_panel")) { - Box(modifier = Modifier.fillMaxWidth()) { + Box( + modifier = + Modifier.fillMaxWidth() + .onPlaced { coordinates -> + val (leftFromRoot, topFromRoot) = coordinates.positionInRoot().round() + qqsPositionOnRoot.set( + leftFromRoot, + topFromRoot, + leftFromRoot + coordinates.size.width, + topFromRoot + coordinates.size.height, + ) + } + .onSizeChanged { size -> qqsHeight.value = size.height } + .padding(top = { qqsPadding }) + ) { val qsEnabled by viewModel.qsEnabled.collectAsStateWithLifecycle() if (qsEnabled) { QuickQuickSettings( viewModel = viewModel.containerViewModel.quickQuickSettingsViewModel, modifier = - Modifier.onGloballyPositioned { coordinates -> - val (leftFromRoot, topFromRoot) = - coordinates.positionInRoot().round() - val (width, height) = coordinates.size - qqsPositionOnRoot.set( - leftFromRoot, - topFromRoot, - leftFromRoot + width, - topFromRoot + height - ) - } - .layout { measurable, constraints -> - val placeable = measurable.measure(constraints) - qqsHeight.value = placeable.height - - layout(placeable.width, placeable.height) { - placeable.place(0, 0) - } - } - .padding(top = { qqsPadding }) - .collapseExpandSemanticAction( - stringResource( - id = R.string.accessibility_quick_settings_expand - ) - ) + Modifier.collapseExpandSemanticAction( + stringResource(id = R.string.accessibility_quick_settings_expand) + ) ) } } @@ -486,6 +502,44 @@ constructor( } } ?: this } + + private fun registerDumpable() { + val instanceId = instanceProvider.getNextId() + // Add an instanceId because the system may have more than 1 of these when re-inflating and + // DumpManager doesn't like repeated identifiers. Also, put it first because DumpHandler + // matches by end. + val stringId = "$instanceId-QSFragmentCompose" + lifecycleScope.launch { + lifecycle.repeatOnLifecycle(Lifecycle.State.CREATED) { + try { + dumpManager.registerNormalDumpable(stringId, this@QSFragmentCompose) + awaitCancellation() + } finally { + dumpManager.unregisterDumpable(stringId) + } + } + } + } + + override fun dump(pw: PrintWriter, args: Array) { + pw.asIndenting().run { + notificationScrimClippingParams.dump(this) + printSection("QQS positioning") { + println("qqsHeight", "${headerHeight}px") + println("qqsTop", "${headerTop}px") + println("qqsBottom", "${headerBottom}px") + println("qqsLeft", "${headerLeft}px") + println("qqsPositionOnRoot", qqsPositionOnRoot) + val rect = Rect() + getHeaderBoundsOnScreen(rect) + println("qqsPositionOnScreen", rect) + } + println("QQS visible", qqsVisible.value) + if (::viewModel.isInitialized) { + printSection("View Model") { viewModel.dump(this@run, args) } + } + } + } } private fun View.setBackPressedDispatcher() { @@ -526,3 +580,12 @@ private suspend inline fun setListenerJob( } } } + +private val instanceProvider = + object { + private var currentId = 0 + + fun getNextId(): Int { + return currentId++ + } + } diff --git a/packages/SystemUI/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModel.kt index 16133f482f7b..7ab11d22ee49 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModel.kt @@ -21,6 +21,7 @@ import android.graphics.Rect import androidx.annotation.FloatRange import androidx.annotation.VisibleForTesting import androidx.lifecycle.LifecycleCoroutineScope +import com.android.systemui.Dumpable import com.android.systemui.common.ui.domain.interactor.ConfigurationInteractor import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.plugins.statusbar.StatusBarStateController @@ -34,10 +35,14 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.disableflags.data.repository.DisableFlagsRepository import com.android.systemui.statusbar.phone.KeyguardBypassController import com.android.systemui.util.LargeScreenUtils +import com.android.systemui.util.asIndenting +import com.android.systemui.util.printSection +import com.android.systemui.util.println import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject +import java.io.PrintWriter import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted @@ -62,7 +67,7 @@ constructor( private val configurationInteractor: ConfigurationInteractor, private val largeScreenHeaderHelper: LargeScreenHeaderHelper, @Assisted private val lifecycleScope: LifecycleCoroutineScope, -) { +) : Dumpable { val footerActionsViewModel = footerActionsViewModelFactory.create(lifecycleScope).also { lifecycleScope.launch { footerActionsController.init() } @@ -228,6 +233,30 @@ constructor( */ var collapseExpandAccessibilityAction: Runnable? = null + override fun dump(pw: PrintWriter, args: Array) { + pw.asIndenting().run { + printSection("Quick Settings state") { + println("isQSExpanded", isQSExpanded) + println("isQSVisible", isQSVisible) + println("isQSEnabled", qsEnabled.value) + println("isCustomizing", containerViewModel.editModeViewModel.isEditing.value) + } + printSection("Expansion state") { + println("qsExpansion", qsExpansionValue) + println("panelExpansionFraction", panelExpansionFractionValue) + println("squishinessFraction", squishinessFractionValue) + println("expansionState", expansionState.value) + } + printSection("Shade state") { + println("stackOverscrolling", stackScrollerOverscrollingValue) + println("statusBarState", StatusBarState.toString(statusBarState.value)) + println("isSmallScreen", isSmallScreenValue) + println("heightOverride", "${heightOverrideValue}px") + println("qqsHeaderHeight", "${qqsHeaderHeight.value}px") + } + } + } + @AssistedFactory interface Factory { fun create(lifecycleScope: LifecycleCoroutineScope): QSFragmentComposeViewModel -- GitLab From 6f6679bf35c373746645dc1a148164d6d743e116 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 15 Jul 2024 22:43:54 +0000 Subject: [PATCH 012/492] Add gainmap support for screencap There still would need to be support added to the PNG spec to properly support gainmaps without affecting downstream clients. So, this patch: 1. Allows for screencap to (temporarily) export jpegs 2. Adds plumbing in HWUI's apex layer to encode gainmaps 3. Wires up the attachGainmap flag to allow screenshots to output a gainmap Bug: 329470026 Flag: com.android.graphics.surfaceflinger.flags.true_hdr_screenshots Test: adb screencap -j sdcard/test.jpeg Change-Id: I210a3e24ad2cfd6e0c0a954f42b9171d9e82e991 --- cmds/screencap/Android.bp | 1 + cmds/screencap/screencap.cpp | 131 +++++++++++++----- libs/hwui/apex/android_bitmap.cpp | 92 ++++++++++-- .../apex/include/android/graphics/bitmap.h | 7 + libs/hwui/libhwui.map.txt | 1 + 5 files changed, 186 insertions(+), 46 deletions(-) diff --git a/cmds/screencap/Android.bp b/cmds/screencap/Android.bp index c009c1f5b08b..16026eca2980 100644 --- a/cmds/screencap/Android.bp +++ b/cmds/screencap/Android.bp @@ -17,6 +17,7 @@ cc_binary { "libutils", "libbinder", "libjnigraphics", + "libhwui", "libui", "libgui", ], diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index 01b20f4a5267..12de82a46263 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -15,36 +15,28 @@ */ #include +#include #include #include #include -#include -#include #include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include - #include #include +#include #include #include #include - +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include - using namespace android; #define COLORSPACE_UNKNOWN 0 @@ -85,11 +77,12 @@ enum { }; } -static const struct option LONG_OPTIONS[] = { - {"png", no_argument, nullptr, 'p'}, - {"help", no_argument, nullptr, 'h'}, - {"hint-for-seamless", no_argument, nullptr, LongOpts::HintForSeamless}, - {0, 0, 0, 0}}; +static const struct option LONG_OPTIONS[] = {{"png", no_argument, nullptr, 'p'}, + {"jpeg", no_argument, nullptr, 'j'}, + {"help", no_argument, nullptr, 'h'}, + {"hint-for-seamless", no_argument, nullptr, + LongOpts::HintForSeamless}, + {0, 0, 0, 0}}; static int32_t flinger2bitmapFormat(PixelFormat f) { @@ -170,10 +163,11 @@ status_t capture(const DisplayId displayId, return 0; } -status_t saveImage(const char* fn, bool png, const ScreenCaptureResults& captureResults) { +status_t saveImage(const char* fn, std::optional format, + const ScreenCaptureResults& captureResults) { void* base = nullptr; ui::Dataspace dataspace = captureResults.capturedDataspace; - sp buffer = captureResults.buffer; + const sp& buffer = captureResults.buffer; status_t result = buffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, &base); @@ -188,22 +182,48 @@ status_t saveImage(const char* fn, bool png, const ScreenCaptureResults& capture return 1; } + void* gainmapBase = nullptr; + sp gainmap = captureResults.optionalGainMap; + + if (gainmap) { + result = gainmap->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, &gainmapBase); + if (gainmapBase == nullptr || result != NO_ERROR) { + fprintf(stderr, "Failed to capture gainmap with error code (%d)\n", result); + gainmapBase = nullptr; + // Fall-through: just don't attempt to write the gainmap + } + } + int fd = -1; if (fn == nullptr) { fd = dup(STDOUT_FILENO); if (fd == -1) { fprintf(stderr, "Error writing to stdout. (%s)\n", strerror(errno)); + if (gainmapBase) { + gainmap->unlock(); + } + + if (base) { + buffer->unlock(); + } return 1; } } else { fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0664); if (fd == -1) { fprintf(stderr, "Error opening file: %s (%s)\n", fn, strerror(errno)); + if (gainmapBase) { + gainmap->unlock(); + } + + if (base) { + buffer->unlock(); + } return 1; } } - if (png) { + if (format) { AndroidBitmapInfo info; info.format = flinger2bitmapFormat(buffer->getPixelFormat()); info.flags = ANDROID_BITMAP_FLAGS_ALPHA_PREMUL; @@ -211,16 +231,31 @@ status_t saveImage(const char* fn, bool png, const ScreenCaptureResults& capture info.height = buffer->getHeight(); info.stride = buffer->getStride() * bytesPerPixel(buffer->getPixelFormat()); - int result = AndroidBitmap_compress(&info, static_cast(dataspace), base, - ANDROID_BITMAP_COMPRESS_FORMAT_PNG, 100, &fd, + int result; + + if (gainmapBase) { + result = ABitmap_compressWithGainmap(&info, static_cast(dataspace), base, + gainmapBase, captureResults.hdrSdrRatio, *format, + 100, &fd, + [](void* fdPtr, const void* data, + size_t size) -> bool { + int bytesWritten = + write(*static_cast(fdPtr), data, + size); + return bytesWritten == size; + }); + } else { + result = AndroidBitmap_compress(&info, static_cast(dataspace), base, *format, + 100, &fd, [](void* fdPtr, const void* data, size_t size) -> bool { int bytesWritten = write(*static_cast(fdPtr), data, size); return bytesWritten == size; }); + } if (result != ANDROID_BITMAP_RESULT_SUCCESS) { - fprintf(stderr, "Failed to compress PNG (error code: %d)\n", result); + fprintf(stderr, "Failed to compress (error code: %d)\n", result); } if (fn != NULL) { @@ -245,6 +280,14 @@ status_t saveImage(const char* fn, bool png, const ScreenCaptureResults& capture } close(fd); + if (gainmapBase) { + gainmap->unlock(); + } + + if (base) { + buffer->unlock(); + } + return 0; } @@ -262,13 +305,17 @@ int main(int argc, char** argv) gui::CaptureArgs captureArgs; const char* pname = argv[0]; bool png = false; + bool jpeg = false; bool all = false; int c; - while ((c = getopt_long(argc, argv, "aphd:", LONG_OPTIONS, nullptr)) != -1) { + while ((c = getopt_long(argc, argv, "apjhd:", LONG_OPTIONS, nullptr)) != -1) { switch (c) { case 'p': png = true; break; + case 'j': + jpeg = true; + break; case 'd': { errno = 0; char* end = nullptr; @@ -325,6 +372,14 @@ int main(int argc, char** argv) baseName = filename.substr(0, filename.size()-4); suffix = ".png"; png = true; + } else if (filename.ends_with(".jpeg")) { + baseName = filename.substr(0, filename.size() - 5); + suffix = ".jpeg"; + jpeg = true; + } else if (filename.ends_with(".jpg")) { + baseName = filename.substr(0, filename.size() - 4); + suffix = ".jpg"; + jpeg = true; } else { baseName = filename; } @@ -350,6 +405,20 @@ int main(int argc, char** argv) } } + if (png && jpeg) { + fprintf(stderr, "Ambiguous file type"); + return 1; + } + + std::optional format = std::nullopt; + + if (png) { + format = ANDROID_BITMAP_COMPRESS_FORMAT_PNG; + } else if (jpeg) { + format = ANDROID_BITMAP_COMPRESS_FORMAT_JPEG; + captureArgs.attachGainmap = true; + } + // setThreadPoolMaxThreadCount(0) actually tells the kernel it's // not allowed to spawn any additional threads, but we still spawn // a binder thread from userspace when we call startThreadPool(). @@ -385,7 +454,7 @@ int main(int argc, char** argv) if (!filename.empty()) { fn = filename.c_str(); } - if (const status_t saveImageStatus = saveImage(fn, png, result) != 0) { + if (const status_t saveImageStatus = saveImage(fn, format, result) != 0) { fprintf(stderr, "Saving image failed.\n"); return saveImageStatus; } diff --git a/libs/hwui/apex/android_bitmap.cpp b/libs/hwui/apex/android_bitmap.cpp index c80a9b4ae97f..000f1092eb17 100644 --- a/libs/hwui/apex/android_bitmap.cpp +++ b/libs/hwui/apex/android_bitmap.cpp @@ -14,21 +14,21 @@ * limitations under the License. */ -#include - -#include "android/graphics/bitmap.h" -#include "TypeCast.h" -#include "GraphicsJNI.h" - +#include #include -#include #include #include #include #include #include +#include +#include #include +#include "GraphicsJNI.h" +#include "TypeCast.h" +#include "android/graphics/bitmap.h" + using namespace android; ABitmap* ABitmap_acquireBitmapFromJava(JNIEnv* env, jobject bitmapObj) { @@ -215,6 +215,14 @@ private: int ABitmap_compress(const AndroidBitmapInfo* info, ADataSpace dataSpace, const void* pixels, AndroidBitmapCompressFormat inFormat, int32_t quality, void* userContext, AndroidBitmap_CompressWriteFunc fn) { + return ABitmap_compressWithGainmap(info, dataSpace, pixels, nullptr, -1.f, inFormat, quality, + userContext, fn); +} + +int ABitmap_compressWithGainmap(const AndroidBitmapInfo* info, ADataSpace dataSpace, + const void* pixels, const void* gainmapPixels, float hdrSdrRatio, + AndroidBitmapCompressFormat inFormat, int32_t quality, + void* userContext, AndroidBitmap_CompressWriteFunc fn) { Bitmap::JavaCompressFormat format; switch (inFormat) { case ANDROID_BITMAP_COMPRESS_FORMAT_JPEG: @@ -275,7 +283,7 @@ int ABitmap_compress(const AndroidBitmapInfo* info, ADataSpace dataSpace, const // besides ADATASPACE_UNKNOWN as an error? cs = nullptr; } else { - cs = uirenderer::DataSpaceToColorSpace((android_dataspace) dataSpace); + cs = uirenderer::DataSpaceToColorSpace((android_dataspace)dataSpace); // DataSpaceToColorSpace treats UNKNOWN as SRGB, but compress forces the // client to specify SRGB if that is what they want. if (!cs || dataSpace == ADATASPACE_UNKNOWN) { @@ -292,16 +300,70 @@ int ABitmap_compress(const AndroidBitmapInfo* info, ADataSpace dataSpace, const auto imageInfo = SkImageInfo::Make(info->width, info->height, colorType, alphaType, std::move(cs)); - SkBitmap bitmap; - // We are not going to modify the pixels, but installPixels expects them to - // not be const, since for all it knows we might want to draw to the SkBitmap. - if (!bitmap.installPixels(imageInfo, const_cast(pixels), info->stride)) { - return ANDROID_BITMAP_RESULT_BAD_PARAMETER; + + // Validate the image info + { + SkBitmap tempBitmap; + if (!tempBitmap.installPixels(imageInfo, const_cast(pixels), info->stride)) { + return ANDROID_BITMAP_RESULT_BAD_PARAMETER; + } + } + + SkPixelRef pixelRef = + SkPixelRef(info->width, info->height, const_cast(pixels), info->stride); + + auto bitmap = Bitmap::createFrom(imageInfo, pixelRef); + + if (gainmapPixels) { + auto gainmap = sp::make(); + gainmap->info.fGainmapRatioMin = { + 1.f, + 1.f, + 1.f, + 1.f, + }; + gainmap->info.fGainmapRatioMax = { + hdrSdrRatio, + hdrSdrRatio, + hdrSdrRatio, + 1.f, + }; + gainmap->info.fGainmapGamma = { + 1.f, + 1.f, + 1.f, + 1.f, + }; + + static constexpr auto kDefaultEpsilon = 1.f / 64.f; + gainmap->info.fEpsilonSdr = { + kDefaultEpsilon, + kDefaultEpsilon, + kDefaultEpsilon, + 1.f, + }; + gainmap->info.fEpsilonHdr = { + kDefaultEpsilon, + kDefaultEpsilon, + kDefaultEpsilon, + 1.f, + }; + gainmap->info.fDisplayRatioSdr = 1.f; + gainmap->info.fDisplayRatioHdr = hdrSdrRatio; + + SkPixelRef gainmapPixelRef = SkPixelRef(info->width, info->height, + const_cast(gainmapPixels), info->stride); + auto gainmapBitmap = Bitmap::createFrom(imageInfo, gainmapPixelRef); + gainmap->bitmap = std::move(gainmapBitmap); + bitmap->setGainmap(std::move(gainmap)); } CompressWriter stream(userContext, fn); - return Bitmap::compress(bitmap, format, quality, &stream) ? ANDROID_BITMAP_RESULT_SUCCESS - : ANDROID_BITMAP_RESULT_JNI_EXCEPTION; + + return bitmap->compress(format, quality, &stream) + + ? ANDROID_BITMAP_RESULT_SUCCESS + : ANDROID_BITMAP_RESULT_JNI_EXCEPTION; } AHardwareBuffer* ABitmap_getHardwareBuffer(ABitmap* bitmapHandle) { diff --git a/libs/hwui/apex/include/android/graphics/bitmap.h b/libs/hwui/apex/include/android/graphics/bitmap.h index 8c4b439d2a2b..6f65e9eb0495 100644 --- a/libs/hwui/apex/include/android/graphics/bitmap.h +++ b/libs/hwui/apex/include/android/graphics/bitmap.h @@ -65,6 +65,13 @@ ANDROID_API jobject ABitmapConfig_getConfigFromFormat(JNIEnv* env, AndroidBitmap ANDROID_API int ABitmap_compress(const AndroidBitmapInfo* info, ADataSpace dataSpace, const void* pixels, AndroidBitmapCompressFormat format, int32_t quality, void* userContext, AndroidBitmap_CompressWriteFunc); +// If gainmapPixels is null, then no gainmap is encoded, and hdrSdrRatio is +// unused +ANDROID_API int ABitmap_compressWithGainmap(const AndroidBitmapInfo* info, ADataSpace dataSpace, + const void* pixels, const void* gainmapPixels, + float hdrSdrRatio, AndroidBitmapCompressFormat format, + int32_t quality, void* userContext, + AndroidBitmap_CompressWriteFunc); /** * Retrieve the native object associated with a HARDWARE Bitmap. * diff --git a/libs/hwui/libhwui.map.txt b/libs/hwui/libhwui.map.txt index d03ceb471d6c..2414299321a9 100644 --- a/libs/hwui/libhwui.map.txt +++ b/libs/hwui/libhwui.map.txt @@ -13,6 +13,7 @@ LIBHWUI { # platform-only /* HWUI isn't current a module, so all of these are st ABitmapConfig_getFormatFromConfig; ABitmapConfig_getConfigFromFormat; ABitmap_compress; + ABitmap_compressWithGainmap; ABitmap_getHardwareBuffer; ACanvas_isSupportedPixelFormat; ACanvas_getNativeHandleFromJava; -- GitLab From ba425af6f83e56fce2361e74273389be05ee0e59 Mon Sep 17 00:00:00 2001 From: Kwangkyu Park Date: Sat, 31 Aug 2024 01:24:57 +0900 Subject: [PATCH 013/492] Camera: relay sync fence to vendor library Currently, a sync fence from ParcelImage is not relayed to a vendor library. However, a fence might be required to implement a service-based vendor library. This patch will make changes to dup/provide a fence to the vendor library. Bug: 363229739 Test: Manual test with service based vendor library Change-Id: Iecc30e4a2523f64aa36271a75f67bf805c7b9a79 --- .../CameraExtensionsProxyService.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java b/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java index 5a2d26502003..10f94a88f2a4 100644 --- a/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java +++ b/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java @@ -22,6 +22,7 @@ import android.content.pm.PackageManager; import android.graphics.GraphicBuffer; import android.graphics.Rect; import android.hardware.HardwareBuffer; +import android.hardware.SyncFence; import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraExtensionCharacteristics; @@ -2460,6 +2461,19 @@ public class CameraExtensionsProxyService extends Service { return mPlanes.clone(); } + @Override + public SyncFence getFence() { + if (mParcelImage.fence != null) { + try { + return SyncFence.create(mParcelImage.fence.dup()); + } catch (IOException e) { + Log.e(TAG, "Failed to parcel buffer fence!"); + } + } + + return SyncFence.createEmpty(); + } + @Override protected final void finalize() throws Throwable { try { -- GitLab From 1e1774588914a7181357e9af99ef782fccfdcf1e Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 30 Aug 2024 17:22:59 +0000 Subject: [PATCH 014/492] RESTRICT AUTOMERGE Clear app-provided shortcut icons When displaying keyboard shortcuts provided by an app, clear any icon that may have been set (this is only possible via reflection, and is not a intended for usage outside of the system). Bug: 331180422 Test: Verify on device Change-Id: If7e291eb2254c3cbec23673c65e7477e6ad45b09 --- core/java/android/view/KeyboardShortcutInfo.java | 13 +++++++++++-- .../systemui/statusbar/KeyboardShortcuts.java | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/KeyboardShortcutInfo.java b/core/java/android/view/KeyboardShortcutInfo.java index 2660e74dcb20..2075d77a9871 100644 --- a/core/java/android/view/KeyboardShortcutInfo.java +++ b/core/java/android/view/KeyboardShortcutInfo.java @@ -29,7 +29,7 @@ import android.os.Parcelable; */ public final class KeyboardShortcutInfo implements Parcelable { private final CharSequence mLabel; - private final Icon mIcon; + private Icon mIcon; private final char mBaseCharacter; private final int mKeycode; private final int mModifiers; @@ -115,6 +115,15 @@ public final class KeyboardShortcutInfo implements Parcelable { return mIcon; } + /** + * Removes an icon that was previously set. + * + * @hide + */ + public void clearIcon() { + mIcon = null; + } + /** * Returns the base keycode that, combined with the modifiers, triggers this shortcut. If the * base character was set instead, returns {@link KeyEvent#KEYCODE_UNKNOWN}. Valid keycodes are @@ -165,4 +174,4 @@ public final class KeyboardShortcutInfo implements Parcelable { return new KeyboardShortcutInfo[size]; } }; -} \ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index 7e6ddcfea762..cc373d3c8b0f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -378,6 +378,7 @@ public final class KeyboardShortcuts { @Override public void onKeyboardShortcutsReceived( final List result) { + sanitiseShortcuts(result); result.add(getSystemShortcuts()); final KeyboardShortcutGroup appShortcuts = getDefaultApplicationShortcuts(); if (appShortcuts != null) { @@ -388,6 +389,14 @@ public final class KeyboardShortcuts { }, deviceId); } + static void sanitiseShortcuts(List shortcutGroups) { + for (KeyboardShortcutGroup group : shortcutGroups) { + for (KeyboardShortcutInfo info : group.getItems()) { + info.clearIcon(); + } + } + } + private void dismissKeyboardShortcuts() { if (mKeyboardShortcutsDialog != null) { mKeyboardShortcutsDialog.dismiss(); -- GitLab From cb890a0619fc5b87faf79001834cb7629a80905b Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 30 Aug 2024 17:22:59 +0000 Subject: [PATCH 015/492] RESTRICT AUTOMERGE Clear app-provided shortcut icons When displaying keyboard shortcuts provided by an app, clear any icon that may have been set (this is only possible via reflection, and is not a intended for usage outside of the system). Bug: 331180422 Test: Verify on device Change-Id: If7e291eb2254c3cbec23673c65e7477e6ad45b09 --- core/java/android/view/KeyboardShortcutInfo.java | 13 +++++++++++-- .../systemui/statusbar/KeyboardShortcuts.java | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/KeyboardShortcutInfo.java b/core/java/android/view/KeyboardShortcutInfo.java index 2660e74dcb20..2075d77a9871 100644 --- a/core/java/android/view/KeyboardShortcutInfo.java +++ b/core/java/android/view/KeyboardShortcutInfo.java @@ -29,7 +29,7 @@ import android.os.Parcelable; */ public final class KeyboardShortcutInfo implements Parcelable { private final CharSequence mLabel; - private final Icon mIcon; + private Icon mIcon; private final char mBaseCharacter; private final int mKeycode; private final int mModifiers; @@ -115,6 +115,15 @@ public final class KeyboardShortcutInfo implements Parcelable { return mIcon; } + /** + * Removes an icon that was previously set. + * + * @hide + */ + public void clearIcon() { + mIcon = null; + } + /** * Returns the base keycode that, combined with the modifiers, triggers this shortcut. If the * base character was set instead, returns {@link KeyEvent#KEYCODE_UNKNOWN}. Valid keycodes are @@ -165,4 +174,4 @@ public final class KeyboardShortcutInfo implements Parcelable { return new KeyboardShortcutInfo[size]; } }; -} \ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index 7e6ddcfea762..cc373d3c8b0f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -378,6 +378,7 @@ public final class KeyboardShortcuts { @Override public void onKeyboardShortcutsReceived( final List result) { + sanitiseShortcuts(result); result.add(getSystemShortcuts()); final KeyboardShortcutGroup appShortcuts = getDefaultApplicationShortcuts(); if (appShortcuts != null) { @@ -388,6 +389,14 @@ public final class KeyboardShortcuts { }, deviceId); } + static void sanitiseShortcuts(List shortcutGroups) { + for (KeyboardShortcutGroup group : shortcutGroups) { + for (KeyboardShortcutInfo info : group.getItems()) { + info.clearIcon(); + } + } + } + private void dismissKeyboardShortcuts() { if (mKeyboardShortcutsDialog != null) { mKeyboardShortcutsDialog.dismiss(); -- GitLab From cfead1ab1b0ea5e67b370dccf923217a8dd1a2f1 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 30 Aug 2024 17:22:59 +0000 Subject: [PATCH 016/492] RESTRICT AUTOMERGE Clear app-provided shortcut icons When displaying keyboard shortcuts provided by an app, clear any icon that may have been set (this is only possible via reflection, and is not a intended for usage outside of the system). Bug: 331180422 Test: Verify on device Change-Id: If7e291eb2254c3cbec23673c65e7477e6ad45b09 --- core/java/android/view/KeyboardShortcutInfo.java | 13 +++++++++++-- .../systemui/statusbar/KeyboardShortcuts.java | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/KeyboardShortcutInfo.java b/core/java/android/view/KeyboardShortcutInfo.java index 118b03ce5504..3a79e5b13a8b 100644 --- a/core/java/android/view/KeyboardShortcutInfo.java +++ b/core/java/android/view/KeyboardShortcutInfo.java @@ -29,7 +29,7 @@ import android.os.Parcelable; */ public final class KeyboardShortcutInfo implements Parcelable { private final CharSequence mLabel; - private final Icon mIcon; + private Icon mIcon; private final char mBaseCharacter; private final int mKeycode; private final int mModifiers; @@ -115,6 +115,15 @@ public final class KeyboardShortcutInfo implements Parcelable { return mIcon; } + /** + * Removes an icon that was previously set. + * + * @hide + */ + public void clearIcon() { + mIcon = null; + } + /** * Returns the base keycode that, combined with the modifiers, triggers this shortcut. If the * base character was set instead, returns {@link KeyEvent#KEYCODE_UNKNOWN}. Valid keycodes are @@ -165,4 +174,4 @@ public final class KeyboardShortcutInfo implements Parcelable { return new KeyboardShortcutInfo[size]; } }; -} \ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index 7e6ddcfea762..cc373d3c8b0f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -378,6 +378,7 @@ public final class KeyboardShortcuts { @Override public void onKeyboardShortcutsReceived( final List result) { + sanitiseShortcuts(result); result.add(getSystemShortcuts()); final KeyboardShortcutGroup appShortcuts = getDefaultApplicationShortcuts(); if (appShortcuts != null) { @@ -388,6 +389,14 @@ public final class KeyboardShortcuts { }, deviceId); } + static void sanitiseShortcuts(List shortcutGroups) { + for (KeyboardShortcutGroup group : shortcutGroups) { + for (KeyboardShortcutInfo info : group.getItems()) { + info.clearIcon(); + } + } + } + private void dismissKeyboardShortcuts() { if (mKeyboardShortcutsDialog != null) { mKeyboardShortcutsDialog.dismiss(); -- GitLab From 7cd3d089f23963605159b4c6b6979e309608f70c Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 30 Aug 2024 17:22:59 +0000 Subject: [PATCH 017/492] RESTRICT AUTOMERGE Clear app-provided shortcut icons When displaying keyboard shortcuts provided by an app, clear any icon that may have been set (this is only possible via reflection, and is not a intended for usage outside of the system). Bug: 331180422 Test: Verify on device Change-Id: I3d80fedab9ef547ef3ac54eaccf2aa048a180be9 --- core/java/android/view/KeyboardShortcutInfo.java | 13 +++++++++++-- .../statusbar/KeyboardShortcutListSearch.java | 2 ++ .../systemui/statusbar/KeyboardShortcuts.java | 9 +++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/KeyboardShortcutInfo.java b/core/java/android/view/KeyboardShortcutInfo.java index 118b03ce5504..3a79e5b13a8b 100644 --- a/core/java/android/view/KeyboardShortcutInfo.java +++ b/core/java/android/view/KeyboardShortcutInfo.java @@ -29,7 +29,7 @@ import android.os.Parcelable; */ public final class KeyboardShortcutInfo implements Parcelable { private final CharSequence mLabel; - private final Icon mIcon; + private Icon mIcon; private final char mBaseCharacter; private final int mKeycode; private final int mModifiers; @@ -115,6 +115,15 @@ public final class KeyboardShortcutInfo implements Parcelable { return mIcon; } + /** + * Removes an icon that was previously set. + * + * @hide + */ + public void clearIcon() { + mIcon = null; + } + /** * Returns the base keycode that, combined with the modifiers, triggers this shortcut. If the * base character was set instead, returns {@link KeyEvent#KEYCODE_UNKNOWN}. Valid keycodes are @@ -165,4 +174,4 @@ public final class KeyboardShortcutInfo implements Parcelable { return new KeyboardShortcutInfo[size]; } }; -} \ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java index ec66e994b58a..e23767e48e8f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java @@ -429,6 +429,7 @@ public final class KeyboardShortcutListSearch { if (result.isEmpty()) { mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, false); } else { + KeyboardShortcuts.sanitiseShortcuts(result); mSpecificAppGroup.addAll(reMapToKeyboardShortcutMultiMappingGroup(result)); mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, true); } @@ -440,6 +441,7 @@ public final class KeyboardShortcutListSearch { mWindowManager.requestImeKeyboardShortcuts(result -> { // Add specific Ime shortcuts if (!result.isEmpty()) { + KeyboardShortcuts.sanitiseShortcuts(result); mInputGroup.addAll(reMapToKeyboardShortcutMultiMappingGroup(result)); } mImeShortcutsReceived = true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index a3fd82e9b140..51ae4583b522 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -410,6 +410,7 @@ public final class KeyboardShortcuts { } List shortcutGroups = mReceivedAppShortcutGroups; shortcutGroups.addAll(mReceivedImeShortcutGroups); + sanitiseShortcuts(shortcutGroups); mReceivedAppShortcutGroups = null; mReceivedImeShortcutGroups = null; @@ -422,6 +423,14 @@ public final class KeyboardShortcuts { showKeyboardShortcutsDialog(shortcutGroups); } + static void sanitiseShortcuts(List shortcutGroups) { + for (KeyboardShortcutGroup group : shortcutGroups) { + for (KeyboardShortcutInfo info : group.getItems()) { + info.clearIcon(); + } + } + } + private void dismissKeyboardShortcuts() { if (mKeyboardShortcutsDialog != null) { mKeyboardShortcutsDialog.dismiss(); -- GitLab From 2c3c124ea436d76fd30cbf1541ef59867d9e7f43 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 30 Aug 2024 17:22:59 +0000 Subject: [PATCH 018/492] RESTRICT AUTOMERGE Clear app-provided shortcut icons When displaying keyboard shortcuts provided by an app, clear any icon that may have been set (this is only possible via reflection, and is not a intended for usage outside of the system). Bug: 331180422 Test: Verify on device Merged-In: I3d80fedab9ef547ef3ac54eaccf2aa048a180be9 Change-Id: If7e291eb2254c3cbec23673c65e7477e6ad45b09 --- core/java/android/view/KeyboardShortcutInfo.java | 13 +++++++++++-- .../statusbar/KeyboardShortcutListSearch.java | 1 + .../systemui/statusbar/KeyboardShortcuts.java | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/KeyboardShortcutInfo.java b/core/java/android/view/KeyboardShortcutInfo.java index 118b03ce5504..3a79e5b13a8b 100644 --- a/core/java/android/view/KeyboardShortcutInfo.java +++ b/core/java/android/view/KeyboardShortcutInfo.java @@ -29,7 +29,7 @@ import android.os.Parcelable; */ public final class KeyboardShortcutInfo implements Parcelable { private final CharSequence mLabel; - private final Icon mIcon; + private Icon mIcon; private final char mBaseCharacter; private final int mKeycode; private final int mModifiers; @@ -115,6 +115,15 @@ public final class KeyboardShortcutInfo implements Parcelable { return mIcon; } + /** + * Removes an icon that was previously set. + * + * @hide + */ + public void clearIcon() { + mIcon = null; + } + /** * Returns the base keycode that, combined with the modifiers, triggers this shortcut. If the * base character was set instead, returns {@link KeyEvent#KEYCODE_UNKNOWN}. Valid keycodes are @@ -165,4 +174,4 @@ public final class KeyboardShortcutInfo implements Parcelable { return new KeyboardShortcutInfo[size]; } }; -} \ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java index 906c5ed0fb89..8499de529837 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java @@ -422,6 +422,7 @@ public final class KeyboardShortcutListSearch { if (result.isEmpty()) { mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, false); } else { + KeyboardShortcuts.sanitiseShortcuts(result); mSpecificAppGroup = reMapToKeyboardShortcutMultiMappingGroup(result); mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, true); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index 43fbc7cbae03..0cd574c2d3c5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -386,6 +386,7 @@ public final class KeyboardShortcuts { @Override public void onKeyboardShortcutsReceived( final List result) { + sanitiseShortcuts(result); result.add(getSystemShortcuts()); final KeyboardShortcutGroup appShortcuts = getDefaultApplicationShortcuts(); if (appShortcuts != null) { @@ -396,6 +397,14 @@ public final class KeyboardShortcuts { }, deviceId); } + static void sanitiseShortcuts(List shortcutGroups) { + for (KeyboardShortcutGroup group : shortcutGroups) { + for (KeyboardShortcutInfo info : group.getItems()) { + info.clearIcon(); + } + } + } + private void dismissKeyboardShortcuts() { if (mKeyboardShortcutsDialog != null) { mKeyboardShortcutsDialog.dismiss(); -- GitLab From 37d295444aca10f92d9934eff744dfc8fb216f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Mon, 1 Jul 2024 09:46:55 +0200 Subject: [PATCH 019/492] Add android.sdk aconfig flags Add the infrastructure for aconfig flags in the android.sdk package. Also add the flag android.sdk.major_minor_versioning_scheme. Bug: 350458259 Test: m nothing Flag: EXEMPT no need to flag the introduction of new flags Change-Id: I928b44dd802dc3d1351547d516d3c195329219a6 --- AconfigFlags.bp | 1 + android-sdk-flags/Android.bp | 30 ++++++++++++++++++++++++++++++ android-sdk-flags/flags.aconfig | 12 ++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 android-sdk-flags/Android.bp create mode 100644 android-sdk-flags/flags.aconfig diff --git a/AconfigFlags.bp b/AconfigFlags.bp index c76812111cec..b3284a52031e 100644 --- a/AconfigFlags.bp +++ b/AconfigFlags.bp @@ -20,6 +20,7 @@ aconfig_declarations_group { java_aconfig_libraries: [ // !!! KEEP THIS LIST ALPHABETICAL !!! "aconfig_mediacodec_flags_java_lib", + "android-sdk-flags-java", "android.adaptiveauth.flags-aconfig-java", "android.app.appfunctions.flags-aconfig-java", "android.app.contextualsearch.flags-aconfig-java", diff --git a/android-sdk-flags/Android.bp b/android-sdk-flags/Android.bp new file mode 100644 index 000000000000..79a0b9a4f273 --- /dev/null +++ b/android-sdk-flags/Android.bp @@ -0,0 +1,30 @@ +// Copyright (C) 2024 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package { + default_applicable_licenses: ["frameworks_base_license"], +} + +aconfig_declarations { + name: "android-sdk-flags", + package: "android.sdk", + container: "system", + srcs: ["flags.aconfig"], +} + +java_aconfig_library { + name: "android-sdk-flags-java", + aconfig_declarations: "android-sdk-flags", + defaults: ["framework-minus-apex-aconfig-java-defaults"], +} diff --git a/android-sdk-flags/flags.aconfig b/android-sdk-flags/flags.aconfig new file mode 100644 index 000000000000..cfe298e187d1 --- /dev/null +++ b/android-sdk-flags/flags.aconfig @@ -0,0 +1,12 @@ +package: "android.sdk" +container: "system" + +flag { + name: "major_minor_versioning_scheme" + namespace: "android_sdk" + description: "Use the new SDK major.minor versioning scheme (e.g. Android 40.1) which replaces the old single-integer scheme (e.g. Android 15)." + bug: "350458259" + + # Use is_fixed_read_only because DeviceConfig may not be available when Build.VERSION_CODES is first accessed + is_fixed_read_only: true +} -- GitLab From 06b93a79767449244b2947afc5c75340ac7f3287 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Wed, 17 Jul 2024 12:38:25 -0400 Subject: [PATCH 020/492] Retrieve IFIngerprint from IVirtual interface over Fingerprint Virtual HAL Bug: 326227403 Test: atest CtsBiometricsTestCases -c Flag: TEST_ONLY Change-Id: I85f697a4e217e27f6371a7d80c9d42c0f7e1ed57 --- Android.bp | 1 + .../FingerprintSensorConfigurations.java | 42 ++++++++++++++++++- .../server/biometrics/AuthService.java | 4 +- .../fingerprint/FingerprintService.java | 25 +++++++++-- .../aidl/BiometricTestSessionImpl.java | 8 ++-- .../fingerprint/aidl/FingerprintProvider.java | 27 ++++++------ .../sensors/fingerprint/aidl/Sensor.java | 6 ++- 7 files changed, 87 insertions(+), 26 deletions(-) diff --git a/Android.bp b/Android.bp index f8907f3d82e8..258440f24084 100644 --- a/Android.bp +++ b/Android.bp @@ -98,6 +98,7 @@ filegroup { ":android.frameworks.location.altitude-V2-java-source", ":android.hardware.biometrics.common-V4-java-source", ":android.hardware.biometrics.fingerprint-V5-java-source", + ":android.hardware.biometrics.fingerprint.virtualhal-java-source", ":android.hardware.biometrics.face-V4-java-source", ":android.hardware.gnss-V2-java-source", ":android.hardware.graphics.common-V3-java-source", diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java b/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java index 43c0da9bd8ed..48c5887d80d0 100644 --- a/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java +++ b/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java @@ -23,12 +23,14 @@ import android.annotation.Nullable; import android.content.Context; import android.hardware.biometrics.fingerprint.IFingerprint; import android.hardware.biometrics.fingerprint.SensorProps; +import android.hardware.biometrics.fingerprint.virtualhal.IVirtualHal; import android.os.Binder; import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; +import android.util.Slog; import java.util.ArrayList; import java.util.HashMap; @@ -162,6 +164,43 @@ public class FingerprintSensorConfigurations implements Parcelable { dest.writeMap(mSensorPropsMap); } + + /** + * Remap fqName of VHAL because the `virtual` instance is registered + * with IVirtulalHal now (IFingerprint previously) + * @param fqName fqName to be translated + * @return real fqName + */ + public static String remapFqName(String fqName) { + if (!fqName.contains(IFingerprint.DESCRIPTOR + "/virtual")) { + return fqName; //no remap needed for real hardware HAL + } else { + //new Vhal instance name + return fqName.replace("IFingerprint", "virtualhal.IVirtualHal"); + } + } + + /** + * @param fqName aidl interface instance name + * @return aidl interface + */ + public static IFingerprint getIFingerprint(String fqName) { + if (fqName.contains("virtual")) { + String fqNameMapped = remapFqName(fqName); + Slog.i(TAG, "getIFingerprint fqName is mapped: " + fqName + "->" + fqNameMapped); + try { + IVirtualHal vhal = IVirtualHal.Stub.asInterface( + Binder.allowBlocking(ServiceManager.waitForService(fqNameMapped))); + return vhal.getFingerprintHal(); + } catch (RemoteException e) { + Slog.e(TAG, "Remote exception in vhal.getFingerprintHal() call" + fqNameMapped); + } + } + + return IFingerprint.Stub.asInterface( + Binder.allowBlocking(ServiceManager.waitForDeclaredService(fqName))); + } + /** * Returns fingerprint sensor props for the HAL {@param instance}. */ @@ -176,8 +215,7 @@ public class FingerprintSensorConfigurations implements Parcelable { try { final String fqName = IFingerprint.DESCRIPTOR + "/" + instance; - final IFingerprint fp = IFingerprint.Stub.asInterface(Binder.allowBlocking( - ServiceManager.waitForDeclaredService(fqName))); + final IFingerprint fp = getIFingerprint(fqName); if (fp != null) { props = fp.getSensorProps(); } else { diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java index 2a1687209aad..dba6c3372ae7 100644 --- a/services/core/java/com/android/server/biometrics/AuthService.java +++ b/services/core/java/com/android/server/biometrics/AuthService.java @@ -50,7 +50,6 @@ import android.hardware.biometrics.PromptInfo; import android.hardware.biometrics.SensorLocationInternal; import android.hardware.biometrics.SensorPropertiesInternal; import android.hardware.biometrics.face.IFace; -import android.hardware.biometrics.fingerprint.IFingerprint; import android.hardware.face.FaceSensorConfigurations; import android.hardware.face.FaceSensorProperties; import android.hardware.face.FaceSensorPropertiesInternal; @@ -74,6 +73,7 @@ import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; import com.android.server.SystemService; +import com.android.server.biometrics.sensors.fingerprint.FingerprintService; import com.android.server.companion.virtual.VirtualDeviceManagerInternal; import java.util.ArrayList; @@ -203,7 +203,7 @@ public class AuthService extends SystemService { */ @VisibleForTesting public String[] getFingerprintAidlInstances() { - return ServiceManager.getDeclaredInstances(IFingerprint.DESCRIPTOR); + return FingerprintService.getDeclaredInstances(); } /** diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java index 60cfd5a5a6ae..2f6ba0b852ee 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java @@ -26,6 +26,7 @@ import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPR import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_USER_CANCELED; import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_VENDOR; import static android.hardware.biometrics.SensorProperties.STRENGTH_STRONG; +import static android.hardware.fingerprint.FingerprintSensorConfigurations.getIFingerprint; import android.annotation.NonNull; import android.annotation.Nullable; @@ -78,6 +79,7 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.util.ArrayUtils; import com.android.internal.util.DumpUtils; import com.android.internal.widget.LockPatternUtils; import com.android.server.SystemService; @@ -1015,7 +1017,7 @@ public class FingerprintService extends SystemService { this(context, BiometricContext.getInstance(context), () -> IBiometricService.Stub.asInterface( ServiceManager.getService(Context.BIOMETRIC_SERVICE)), - () -> ServiceManager.getDeclaredInstances(IFingerprint.DESCRIPTOR), + () -> getDeclaredInstances(), null /* fingerprintProvider */, null /* fingerprintProviderFunction */); } @@ -1039,8 +1041,7 @@ public class FingerprintService extends SystemService { mFingerprintProvider = fingerprintProvider != null ? fingerprintProvider : (name) -> { final String fqName = IFingerprint.DESCRIPTOR + "/" + name; - final IFingerprint fp = IFingerprint.Stub.asInterface( - Binder.allowBlocking(ServiceManager.waitForDeclaredService(fqName))); + final IFingerprint fp = getIFingerprint(fqName); if (fp != null) { try { return new FingerprintProvider(getContext(), @@ -1129,6 +1130,24 @@ public class FingerprintService extends SystemService { publishBinderService(Context.FINGERPRINT_SERVICE, mServiceWrapper); } + /** + * Get all fingerprint hal instances declared in manifest + * @return instance names + */ + public static String[] getDeclaredInstances() { + String[] a = ServiceManager.getDeclaredInstances(IFingerprint.DESCRIPTOR); + Slog.i(TAG, "Before:getDeclaredInstances: IFingerprint instance found, a.length=" + + a.length); + if (!ArrayUtils.contains(a, "virtual")) { + // Now, the virtual hal is registered with IVirtualHal interface and it is also + // moved from vendor to system_ext partition without a device manifest. So + // if the old vhal is not declared, add here. + a = ArrayUtils.appendElement(String.class, a, "virtual"); + } + Slog.i(TAG, "After:getDeclaredInstances: a.length=" + a.length); + return a; + } + @NonNull private List getEnrolledFingerprintsDeprecated(int userId, String opPackageName) { final Pair provider = mRegistry.getSingleProvider(); diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/BiometricTestSessionImpl.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/BiometricTestSessionImpl.java index caa2c1c34ff7..fd3d9963c5e3 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/BiometricTestSessionImpl.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/BiometricTestSessionImpl.java @@ -20,9 +20,9 @@ import android.annotation.NonNull; import android.content.Context; import android.hardware.biometrics.ITestSession; import android.hardware.biometrics.ITestSessionCallback; -import android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode; -import android.hardware.biometrics.fingerprint.EnrollmentProgressStep; -import android.hardware.biometrics.fingerprint.NextEnrollment; +import android.hardware.biometrics.fingerprint.virtualhal.AcquiredInfoAndVendorCode; +import android.hardware.biometrics.fingerprint.virtualhal.EnrollmentProgressStep; +import android.hardware.biometrics.fingerprint.virtualhal.NextEnrollment; import android.hardware.fingerprint.Fingerprint; import android.hardware.fingerprint.FingerprintEnrollOptions; import android.hardware.fingerprint.FingerprintManager; @@ -300,4 +300,4 @@ class BiometricTestSessionImpl extends ITestSession.Stub { super.getSensorId_enforcePermission(); return mSensorId; } -} \ No newline at end of file +} diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java index 9edaa4e6d818..8195efe6a56a 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java @@ -17,6 +17,8 @@ package com.android.server.biometrics.sensors.fingerprint.aidl; import static android.hardware.fingerprint.FingerprintManager.SENSOR_ID_ANY; +import static android.hardware.fingerprint.FingerprintSensorConfigurations.getIFingerprint; +import static android.hardware.fingerprint.FingerprintSensorConfigurations.remapFqName; import android.annotation.NonNull; import android.annotation.Nullable; @@ -34,9 +36,9 @@ import android.hardware.biometrics.ITestSession; import android.hardware.biometrics.ITestSessionCallback; import android.hardware.biometrics.SensorLocationInternal; import android.hardware.biometrics.fingerprint.IFingerprint; -import android.hardware.biometrics.fingerprint.IVirtualHal; import android.hardware.biometrics.fingerprint.PointerContext; import android.hardware.biometrics.fingerprint.SensorProps; +import android.hardware.biometrics.fingerprint.virtualhal.IVirtualHal; import android.hardware.fingerprint.Fingerprint; import android.hardware.fingerprint.FingerprintAuthenticateOptions; import android.hardware.fingerprint.FingerprintEnrollOptions; @@ -291,7 +293,8 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi if (mTestHalEnabled) { return true; } - return (ServiceManager.checkService(IFingerprint.DESCRIPTOR + "/" + mHalInstanceName) + return (ServiceManager.checkService( + remapFqName(IFingerprint.DESCRIPTOR + "/" + mHalInstanceName)) != null); } @@ -330,10 +333,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi Slog.d(getTag(), "Daemon was null, reconnecting"); - mDaemon = IFingerprint.Stub.asInterface( - Binder.allowBlocking( - ServiceManager.waitForDeclaredService( - IFingerprint.DESCRIPTOR + "/" + mHalInstanceNameCurrent))); + mDaemon = getIFingerprint(IFingerprint.DESCRIPTOR + "/" + mHalInstanceNameCurrent); if (mDaemon == null) { Slog.e(getTag(), "Unable to get daemon"); return null; @@ -905,8 +905,8 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi void setTestHalEnabled(boolean enabled) { final boolean changed = enabled != mTestHalEnabled; mTestHalEnabled = enabled; - Slog.i(getTag(), "setTestHalEnabled(): useVhalForTesting=" + Flags.useVhalForTesting() - + "mTestHalEnabled=" + mTestHalEnabled + " changed=" + changed); + Slog.i(getTag(), "setTestHalEnabled(): useVhalForTestingFlags=" + Flags.useVhalForTesting() + + " mTestHalEnabled=" + mTestHalEnabled + " changed=" + changed); if (changed && useVhalForTesting()) { getHalInstance(); } @@ -999,12 +999,13 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi */ public IVirtualHal getVhal() throws RemoteException { if (mVhal == null && useVhalForTesting()) { - mVhal = IVirtualHal.Stub.asInterface(mDaemon.asBinder().getExtension()); - if (mVhal == null) { - Slog.e(getTag(), "Unable to get fingerprint virtualhal interface"); - } + mVhal = IVirtualHal.Stub.asInterface( + Binder.allowBlocking( + ServiceManager.waitForService( + IVirtualHal.DESCRIPTOR + "/" + + mHalInstanceNameCurrent))); + Slog.d(getTag(), "getVhal " + mHalInstanceNameCurrent); } - return mVhal; } diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/Sensor.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/Sensor.java index d12d7b2dc89a..25d1fe7d32ba 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/Sensor.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/Sensor.java @@ -16,6 +16,8 @@ package com.android.server.biometrics.sensors.fingerprint.aidl; +import static android.hardware.fingerprint.FingerprintSensorConfigurations.remapFqName; + import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; @@ -356,8 +358,8 @@ public class Sensor { if (mTestHalEnabled) { return true; } - return (ServiceManager.checkService(IFingerprint.DESCRIPTOR + "/" + halInstance) - != null); + return (ServiceManager.checkService( + remapFqName(IFingerprint.DESCRIPTOR + "/" + halInstance)) != null); } @NonNull protected BiometricContext getBiometricContext() { -- GitLab From 228acb7e4534b501a0006ee2e5f9e414e4d6b491 Mon Sep 17 00:00:00 2001 From: Lais Andrade Date: Tue, 30 Jul 2024 15:48:19 +0100 Subject: [PATCH 021/492] Create cc library for vibrator flags Bug: 356144312 Flag: android.os.vibrator.fix_audio_coupled_haptics_scaling Test: libvibrator_test Change-Id: I8a452fc26391d58bc006c2f887fcc91b3c1f82c3 Merged-In: I8a452fc26391d58bc006c2f887fcc91b3c1f82c3 --- AconfigFlags.bp | 7 +++++++ core/java/android/os/vibrator/flags.aconfig | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/AconfigFlags.bp b/AconfigFlags.bp index 5f23edaeb01a..0ae60c9bc65d 100644 --- a/AconfigFlags.bp +++ b/AconfigFlags.bp @@ -400,6 +400,13 @@ java_aconfig_library { defaults: ["framework-minus-apex-aconfig-java-defaults"], } +cc_aconfig_library { + name: "android.os.vibrator.flags-aconfig-cc", + aconfig_declarations: "android.os.vibrator.flags-aconfig", + host_supported: true, + vendor_available: true, +} + // View aconfig_declarations { name: "android.view.flags-aconfig", diff --git a/core/java/android/os/vibrator/flags.aconfig b/core/java/android/os/vibrator/flags.aconfig index 77af31e5b2c7..d3c23ea51182 100644 --- a/core/java/android/os/vibrator/flags.aconfig +++ b/core/java/android/os/vibrator/flags.aconfig @@ -38,3 +38,13 @@ flag { description: "Enables the adaptive haptics feature" bug: "305961689" } + +flag { + namespace: "haptics" + name: "fix_audio_coupled_haptics_scaling" + description: "Fix the audio-coupled haptics scaling to use same function as VibrationEffect" + bug: "356144312" + metadata { + purpose: PURPOSE_BUGFIX + } +} -- GitLab From 6a78ba4b150c7e143d082a27eed7c61974b89abd Mon Sep 17 00:00:00 2001 From: mattsziklay Date: Wed, 4 Sep 2024 12:13:37 -0700 Subject: [PATCH 022/492] Tweak fullscreen transition region. Make the following adjustments to fullscreen drag region: - Width of screen adjusted from 40% to 20% - Rather than a specified dp, set height to status bar height. Bug: 350933509 Test: Manual Flag: EXEMPT, refactoring Change-Id: I0eaa52f55ee26f668026cdfd0bc7e15ba1099fb0 --- libs/WindowManager/Shell/res/values/dimen.xml | 2 +- .../wm/shell/desktopmode/DesktopModeVisualIndicator.java | 4 ++-- .../wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index 2d98a2b675a3..755e0d5f742d 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -569,7 +569,7 @@ 44dp - 0.4 + 0.2 false + + + true diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 38aff7590a42..f6267f6174b6 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -7121,4 +7121,8 @@ 500 + + + false diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 46938948b133..3c8c04e23087 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -5601,4 +5601,6 @@ + + diff --git a/core/tests/coretests/src/com/android/internal/widget/ViewGroupFaderTest.java b/core/tests/coretests/src/com/android/internal/widget/ViewGroupFaderTest.java new file mode 100644 index 000000000000..eeabc2f4e0ed --- /dev/null +++ b/core/tests/coretests/src/com/android/internal/widget/ViewGroupFaderTest.java @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.widget; + +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; + +import android.content.Context; +import android.content.res.Resources; +import android.platform.test.annotations.EnableFlags; +import android.platform.test.flag.junit.SetFlagsRule; +import android.test.AndroidTestCase; +import android.view.View; +import android.view.ViewGroup; +import android.widget.flags.Flags; + +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +/** + * Tests for {@link ViewGroupFader}. + */ +public class ViewGroupFaderTest extends AndroidTestCase { + + private Context mContext; + private ViewGroupFader mViewGroupFader; + private Resources mResources; + + @Mock + private ViewGroup mViewGroup,mViewGroup1; + + @Mock + private ViewGroupFader mockViewGroupFader; + + @Mock + private ViewGroupFader.AnimationCallback mAnimationCallback; + + @Mock + private ViewGroupFader.ChildViewBoundsProvider mChildViewBoundsProvider; + + @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + final Context mContext = getInstrumentation().getContext(); + mResources = spy(mContext.getResources()); + when(mResources.getBoolean(com.android.internal.R.bool.config_enableViewGroupScalingFading)) + .thenReturn(true); + when(mViewGroup.getResources()).thenReturn(mResources); + + mViewGroupFader = new ViewGroupFader( + mViewGroup, + mAnimationCallback, + mChildViewBoundsProvider); + } + + /** This test checks that for each child of the parent viewgroup, + * updateListElementFades is called for each of its child, when the Flag is set to true + */ + @Test + @EnableFlags(Flags.FLAG_ENABLE_FADING_VIEW_GROUP) + public void testFadingAndScrollingAnimationWorking_FlagOn() { + mViewGroup.addView(mViewGroup1); + mViewGroupFader.updateFade(); + + for (int i = 0; i < mViewGroup.getChildCount(); i++) { + View child = mViewGroup.getChildAt(i); + verify(mockViewGroupFader).updateListElementFades((ViewGroup)child,true); + } + } + + /** This test checks that for each child of the parent viewgroup, + * updateListElementFades is never called for each of its child, when the Flag is set to false + */ + @Test + public void testFadingAndScrollingAnimationNotWorking_FlagOff() { + mViewGroup.addView(mViewGroup1); + mViewGroupFader.updateFade(); + + for (int i = 0; i < mViewGroup.getChildCount(); i++) { + View child = mViewGroup.getChildAt(i); + verify(mockViewGroupFader,never()).updateListElementFades((ViewGroup)child,true); + } + } +} \ No newline at end of file -- GitLab From 9c771c23662e3d2ed0c1a79bc56858d9239e8148 Mon Sep 17 00:00:00 2001 From: Vova Sharaienko Date: Thu, 5 Sep 2024 22:23:36 +0000 Subject: [PATCH 041/492] StatsPullAtomCallbackImpl: fixed StrictMode policy violation - The caller of getBatteryUsageStats must call close() on the resulting BatteryUsageStats object Flag: com.android.server.power.optimization.add_battery_usage_stats_slice_atom Bug: 353536815 Test: adb shell cmd stats pull-source 10209; and review logcat for warnings Change-Id: I038464c66bd1759a29637c0d994be6e09e0f806b --- .../java/com/android/server/am/BatteryStatsService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index 955b75d8bba0..3f4902db70f5 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -1122,7 +1122,11 @@ public final class BatteryStatsService extends IBatteryStats.Stub throw new UnsupportedOperationException("Unknown tagId=" + atomTag); } final byte[] statsProto = bus.getStatsProto(); - + try { + bus.close(); + } catch (IOException e) { + Slog.w(TAG, "Failure close BatteryUsageStats", e); + } data.add(FrameworkStatsLog.buildStatsEvent(atomTag, statsProto)); return StatsManager.PULL_SUCCESS; -- GitLab From 46461c142d32437c99776062682cf6c65fcaf9ab Mon Sep 17 00:00:00 2001 From: Grant Menke Date: Thu, 5 Sep 2024 16:12:31 -0700 Subject: [PATCH 042/492] Updated relevant aidl to pass current user when setting PhoneAcctSuggSrvc. This CL updates the relevant Telecom Service aidl to ensure the current primary user can be passed when setting the PhoneAccountSuggestionService for Telecom CTS test purposes. In HSUM mode, this should be user 10 and in non HSUM mode this should be user 0. Without this change, PhoneAccountSuggestionServiceTest tests were failing in HSUM mode. Test: atest PhoneAccountSuggestionServiceTest Bug: 358587742 Flag: TEST_ONLY Change-Id: I81431805da813c48ab2ef776e121a60b59abec63 --- .../java/com/android/internal/telecom/ITelecomService.aidl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 112471b2af57..c85374e0b660 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -376,7 +376,8 @@ interface ITelecomService { */ void requestLogMark(in String message); - void setTestPhoneAcctSuggestionComponent(String flattenedComponentName); + void setTestPhoneAcctSuggestionComponent(String flattenedComponentName, + in UserHandle userHandle); void setTestDefaultCallScreeningApp(String packageName); -- GitLab From 02818432da969a6498657491abc358222a167289 Mon Sep 17 00:00:00 2001 From: Lyn Date: Thu, 5 Sep 2024 23:17:42 +0000 Subject: [PATCH 043/492] Fix remove animation running for HUN already seen in shade Fixes: 277936467 Test: send HUN, open shade, close shade, send second HUN => observe no removal animation for first HUN when it times out Flag: com.android.systemui.notification_avalanche_throttle_hun Change-Id: I077c2f95c5aaea9a6e529869c3c5e5e1fbbf02e6 --- .../android/systemui/statusbar/phone/HeadsUpManagerPhone.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java index 1efad3b9fa66..0e7beb9d17da 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java @@ -262,6 +262,9 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements releaseAllImmediately(); mReleaseOnExpandFinish = false; } else { + for (NotificationEntry entry: getAllEntries().toList()) { + entry.setSeenInShade(true); + } for (NotificationEntry entry : mEntriesToRemoveAfterExpand) { if (isHeadsUpEntry(entry.getKey())) { // Maybe the heads-up was removed already -- GitLab From 21c95207e818f6b8ba7d6df2c6e3fa6c9cc247fe Mon Sep 17 00:00:00 2001 From: Riley Jones Date: Tue, 2 Jul 2024 19:59:25 +0000 Subject: [PATCH 044/492] Internalize handling of a11y button click and long click Move the logic regarding a11y button click and long click inside a11y manager, and use the current navigation mode to determine shortcut type. Bug: 297544054 Flag: android.provider.a11y_standalone_gesture_enabled Test: atest AccessibilityManagerServiceTest Change-Id: I9597c1975877f1c7188e7192145b6e4da44495b9 --- .../accessibility/AccessibilityManager.java | 31 ++++++- .../accessibility/IAccessibilityManager.aidl | 2 + .../AccessibilityButtonChooserActivity.java | 7 +- .../systemui/accessibility/SystemActions.java | 12 +-- .../navigationbar/views/NavigationBar.java | 11 +-- .../recents/OverviewProxyService.java | 21 ++--- .../AccessibilityManagerService.java | 49 ++++++++-- .../accessibility/AccessibilityUserState.java | 12 ++- .../AccessibilityManagerServiceTest.java | 93 +++++++++++++++++++ .../AccessibilityUserStateTest.java | 47 ++++++++++ 10 files changed, 238 insertions(+), 47 deletions(-) diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java index a87e5c8e1b56..2b7cf427a562 100644 --- a/core/java/android/view/accessibility/AccessibilityManager.java +++ b/core/java/android/view/accessibility/AccessibilityManager.java @@ -1774,7 +1774,8 @@ public final class AccessibilityManager { } /** - * Notifies that the accessibility button in the system's navigation area has been clicked + * Notifies that the accessibility button in the system's navigation area has been clicked, + * or a gesture shortcut input has been performed. * * @param displayId The logical display id. * @hide @@ -1785,7 +1786,8 @@ public final class AccessibilityManager { } /** - * Perform the accessibility button for the given target which is assigned to the button. + * Perform the accessibility button or gesture + * for the given target which is assigned to the button. * * @param displayId displayId The logical display id. * @param targetName The flattened {@link ComponentName} string or the class name of a system @@ -1809,6 +1811,31 @@ public final class AccessibilityManager { } } + /** + * Notifies that a shortcut was long-clicked. + * This displays the dialog used to select which target the given shortcut will use, + * from its list of targets. + * The current shortcut type is determined by the current navigation mode. + * + * @param displayId The id of the display to show the dialog on. + * @hide + */ + @RequiresPermission(Manifest.permission.STATUS_BAR_SERVICE) + public void notifyAccessibilityButtonLongClicked(int displayId) { + final IAccessibilityManager service; + synchronized (mLock) { + service = getServiceLocked(); + if (service == null) { + return; + } + } + try { + service.notifyAccessibilityButtonLongClicked(displayId); + } catch (RemoteException re) { + Log.e(LOG_TAG, "Error while dispatching accessibility button long click. ", re); + } + } + /** * Notifies that the visibility of the accessibility button in the system's navigation area * has changed. diff --git a/core/java/android/view/accessibility/IAccessibilityManager.aidl b/core/java/android/view/accessibility/IAccessibilityManager.aidl index 2de3ce8532e3..e04fa1537d54 100644 --- a/core/java/android/view/accessibility/IAccessibilityManager.aidl +++ b/core/java/android/view/accessibility/IAccessibilityManager.aidl @@ -88,6 +88,8 @@ interface IAccessibilityManager { @EnforcePermission("STATUS_BAR_SERVICE") void notifyAccessibilityButtonClicked(int displayId, String targetName); + @EnforcePermission("STATUS_BAR_SERVICE") + void notifyAccessibilityButtonLongClicked(int displayId); @EnforcePermission("STATUS_BAR_SERVICE") void notifyAccessibilityButtonVisibilityChanged(boolean available); diff --git a/core/java/com/android/internal/accessibility/dialog/AccessibilityButtonChooserActivity.java b/core/java/com/android/internal/accessibility/dialog/AccessibilityButtonChooserActivity.java index 01cbb5514669..81d8adfce2ae 100644 --- a/core/java/com/android/internal/accessibility/dialog/AccessibilityButtonChooserActivity.java +++ b/core/java/com/android/internal/accessibility/dialog/AccessibilityButtonChooserActivity.java @@ -20,7 +20,6 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_COMPONENT_NAME; import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME; -import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.GESTURE; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE; import static com.android.internal.accessibility.dialog.AccessibilityTargetHelper.getTargets; import static com.android.internal.accessibility.util.AccessibilityStatsLogUtils.logAccessibilityButtonLongPressStatus; @@ -44,6 +43,8 @@ import java.util.List; * Activity used to display and persist a service or feature target for the Accessibility button. */ public class AccessibilityButtonChooserActivity extends Activity { + public static final String EXTRA_TYPE_TO_CHOOSE = "TYPE"; + private final List mTargets = new ArrayList<>(); @Override @@ -67,8 +68,8 @@ public class AccessibilityButtonChooserActivity extends Activity { NAV_BAR_MODE_GESTURAL == getResources().getInteger( com.android.internal.R.integer.config_navBarInteractionMode); - final int targetType = (isGestureNavigateEnabled - && android.provider.Flags.a11yStandaloneGestureEnabled()) ? GESTURE : SOFTWARE; + final int targetType = android.provider.Flags.a11yStandaloneGestureEnabled() + ? getIntent().getIntExtra(EXTRA_TYPE_TO_CHOOSE, SOFTWARE) : SOFTWARE; if (isGestureNavigateEnabled) { final TextView promptPrologue = findViewById(R.id.accessibility_button_prompt_prologue); diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java index 7750f6bf4178..51c5b00daae4 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java @@ -18,8 +18,6 @@ package com.android.systemui.accessibility; import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_ACCESSIBILITY_ACTIONS; -import static com.android.internal.accessibility.common.ShortcutConstants.CHOOSER_PACKAGE_NAME; - import android.accessibilityservice.AccessibilityService; import android.app.PendingIntent; import android.app.RemoteAction; @@ -45,7 +43,6 @@ import android.view.accessibility.AccessibilityManager; import android.view.accessibility.Flags; import com.android.internal.R; -import com.android.internal.accessibility.dialog.AccessibilityButtonChooserActivity; import com.android.internal.accessibility.util.AccessibilityUtils; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ScreenshotHelper; @@ -561,16 +558,13 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con } private void handleAccessibilityButton() { - AccessibilityManager.getInstance(mContext).notifyAccessibilityButtonClicked( + mA11yManager.notifyAccessibilityButtonClicked( mDisplayTracker.getDefaultDisplayId()); } private void handleAccessibilityButtonChooser() { - final Intent intent = new Intent(AccessibilityManager.ACTION_CHOOSE_ACCESSIBILITY_BUTTON); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); - final String chooserClassName = AccessibilityButtonChooserActivity.class.getName(); - intent.setClassName(CHOOSER_PACKAGE_NAME, chooserClassName); - mContext.startActivityAsUser(intent, mUserTracker.getUserHandle()); + mA11yManager.notifyAccessibilityButtonLongClicked( + mDisplayTracker.getDefaultDisplayId()); } private void handleAccessibilityShortcut() { diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java index e8c90c1fc9bf..c70a5234dfca 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java @@ -34,7 +34,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; -import static com.android.internal.accessibility.common.ShortcutConstants.CHOOSER_PACKAGE_NAME; import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.HOME_BUTTON_LONG_PRESS_DURATION_MS; import static com.android.systemui.navigationbar.NavBarHelper.transitionMode; import static com.android.systemui.recents.OverviewProxyService.OverviewProxyListener; @@ -60,7 +59,6 @@ import android.app.ActivityTaskManager; import android.app.IActivityTaskManager; import android.app.StatusBarManager; import android.content.Context; -import android.content.Intent; import android.content.res.Configuration; import android.graphics.Insets; import android.graphics.PixelFormat; @@ -105,7 +103,6 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.app.viewcapture.ViewCaptureAwareWindowManager; -import com.android.internal.accessibility.dialog.AccessibilityButtonChooserActivity; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; @@ -1625,11 +1622,9 @@ public class NavigationBar extends ViewController implements } private boolean onAccessibilityLongClick(View v) { - final Intent intent = new Intent(AccessibilityManager.ACTION_CHOOSE_ACCESSIBILITY_BUTTON); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); - final String chooserClassName = AccessibilityButtonChooserActivity.class.getName(); - intent.setClassName(CHOOSER_PACKAGE_NAME, chooserClassName); - mContext.startActivityAsUser(intent, mUserTracker.getUserHandle()); + final Display display = v.getDisplay(); + mAccessibilityManager.notifyAccessibilityButtonLongClicked( + display != null ? display.getDisplayId() : mDisplayTracker.getDefaultDisplayId()); return true; } diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 000781acec58..a402a9d5ae7c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -25,7 +25,6 @@ import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_UP; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; -import static com.android.internal.accessibility.common.ShortcutConstants.CHOOSER_PACKAGE_NAME; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_UNFOLD_ANIMATION_FORWARDER; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_UNLOCK_ANIMATION_CONTROLLER; @@ -76,7 +75,6 @@ import android.view.inputmethod.InputMethodManager; import androidx.annotation.NonNull; -import com.android.internal.accessibility.dialog.AccessibilityButtonChooserActivity; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionListener; @@ -404,23 +402,16 @@ public class OverviewProxyService implements CallbackController - AccessibilityManager.getInstance(mContext) - .notifyAccessibilityButtonClicked(displayId)); + AccessibilityManager.getInstance(mContext).notifyAccessibilityButtonClicked( + displayId)); } @Override public void notifyAccessibilityButtonLongClicked() { - verifyCallerAndClearCallingIdentity("notifyAccessibilityButtonLongClicked", - () -> { - final Intent intent = - new Intent(AccessibilityManager.ACTION_CHOOSE_ACCESSIBILITY_BUTTON); - final String chooserClassName = AccessibilityButtonChooserActivity - .class.getName(); - intent.setClassName(CHOOSER_PACKAGE_NAME, chooserClassName); - intent.addFlags( - Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); - mContext.startActivityAsUser(intent, mUserTracker.getUserHandle()); - }); + verifyCallerAndClearCallingIdentity("notifyAccessibilityButtonLongClicked", () -> + AccessibilityManager.getInstance(mContext) + .notifyAccessibilityButtonLongClicked( + mDisplayTracker.getDefaultDisplayId())); } @Override diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java index b541345e1cb8..7580b697b516 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -58,6 +58,7 @@ import static com.android.internal.accessibility.common.ShortcutConstants.UserSh import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.TRIPLETAP; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.TWOFINGER_DOUBLETAP; +import static com.android.internal.accessibility.dialog.AccessibilityButtonChooserActivity.EXTRA_TYPE_TO_CHOOSE; import static com.android.internal.accessibility.util.AccessibilityStatsLogUtils.logAccessibilityShortcutActivated; import static com.android.internal.accessibility.util.AccessibilityUtils.isUserSetupCompleted; import static com.android.internal.util.FunctionalUtils.ignoreRemoteException; @@ -1616,7 +1617,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub /** * Invoked remotely over AIDL by SysUi when the accessibility button within the system's - * navigation area has been clicked. + * navigation area has been clicked, or a gesture shortcut input has been performed. * * @param displayId The logical display id. * @param targetName The flattened {@link ComponentName} string or the class name of a system @@ -1646,7 +1647,26 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub } mMainHandler.sendMessage(obtainMessage( AccessibilityManagerService::performAccessibilityShortcutInternal, this, - displayId, SOFTWARE, targetName)); + displayId, getShortcutTypeForGenericShortcutCalls(currentUserId), targetName)); + } + + /** + * AIDL-exposed method to show the dialog + * for choosing the target for the gesture or button shortcuts. + * The shortcut is determined by the current navigation mode. + * + * @param displayId The id for the display to show the dialog on. + */ + @Override + @EnforcePermission(STATUS_BAR_SERVICE) + public void notifyAccessibilityButtonLongClicked(int displayId) { + notifyAccessibilityButtonLongClicked_enforcePermission(); + int userId; + synchronized (mLock) { + userId = mCurrentUserId; + } + showAccessibilityTargetsSelection(displayId, + getShortcutTypeForGenericShortcutCalls(userId), userId); } /** @@ -2344,16 +2364,18 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub } } - private void showAccessibilityTargetsSelection(int displayId, - @UserShortcutType int shortcutType) { + private void showAccessibilityTargetsSelection(int displayId, int shortcutType, + int userId) { final Intent intent = new Intent(AccessibilityManager.ACTION_CHOOSE_ACCESSIBILITY_BUTTON); final String chooserClassName = (shortcutType == HARDWARE) ? AccessibilityShortcutChooserActivity.class.getName() : AccessibilityButtonChooserActivity.class.getName(); intent.setClassName(CHOOSER_PACKAGE_NAME, chooserClassName); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + intent.putExtra(EXTRA_TYPE_TO_CHOOSE, shortcutType); final Bundle bundle = ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle(); - mContext.startActivityAsUser(intent, bundle, UserHandle.of(mCurrentUserId)); + mMainHandler.post(() -> + mContext.startActivityAsUser(intent, bundle, UserHandle.of(userId))); } private void launchShortcutTargetActivity(int displayId, ComponentName name) { @@ -4011,7 +4033,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub * Perform the accessibility shortcut action. * * @param shortcutType The shortcut type. - * @param displayId The display id of the accessibility button. + * @param displayId The display id the shortcut is being performed from. * @param targetName The flattened {@link ComponentName} string or the class name of a system * class implementing a supported accessibility feature, or {@code null} if there's no * specified target. @@ -4031,7 +4053,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub if (targetName == null) { // In case there are many targets assigned to the given shortcut. if (shortcutTargets.size() > 1) { - showAccessibilityTargetsSelection(displayId, shortcutType); + showAccessibilityTargetsSelection( + displayId, shortcutType, getCurrentUserState().mUserId); return; } targetName = shortcutTargets.get(0); @@ -6563,6 +6586,18 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub callback)); } + @VisibleForTesting + int getShortcutTypeForGenericShortcutCalls(int userId) { + int navigationMode = Settings.Secure.getIntForUser( + mContext.getContentResolver(), + Settings.Secure.NAVIGATION_MODE, -1, userId); + if (android.provider.Flags.a11yStandaloneGestureEnabled()) { + return (navigationMode == NAV_BAR_MODE_GESTURAL) ? GESTURE : SOFTWARE; + } else { + return SOFTWARE; + } + } + void attachAccessibilityOverlayToDisplayInternal( int interactionId, int displayId, diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityUserState.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityUserState.java index b18e6ba8444d..0bf7ec001d4d 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityUserState.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityUserState.java @@ -57,6 +57,7 @@ import android.view.accessibility.IAccessibilityManagerClient; import com.android.internal.R; import com.android.internal.accessibility.AccessibilityShortcutController; +import com.android.internal.accessibility.common.ShortcutConstants; import com.android.internal.accessibility.util.ShortcutUtils; import java.io.FileDescriptor; @@ -707,11 +708,16 @@ class AccessibilityUserState { } /** - * Returns true if navibar magnification or shortcut key magnification is enabled. + * Returns true if a magnification shortcut of any type is enabled. */ public boolean isShortcutMagnificationEnabledLocked() { - return mAccessibilityShortcutKeyTargets.contains(MAGNIFICATION_CONTROLLER_NAME) - || mAccessibilityButtonTargets.contains(MAGNIFICATION_CONTROLLER_NAME); + for (int shortcutType : ShortcutConstants.USER_SHORTCUT_TYPES) { + if (getShortcutTargetsInternalLocked(shortcutType) + .contains(MAGNIFICATION_CONTROLLER_NAME)) { + return true; + } + } + return false; } /** diff --git a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityManagerServiceTest.java index 2e6c93cb92aa..566feb7e3d80 100644 --- a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityManagerServiceTest.java @@ -35,6 +35,7 @@ import static com.android.internal.accessibility.common.ShortcutConstants.UserSh import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.HARDWARE; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.QUICK_SETTINGS; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE; +import static com.android.internal.accessibility.dialog.AccessibilityButtonChooserActivity.EXTRA_TYPE_TO_CHOOSE; import static com.android.server.accessibility.AccessibilityManagerService.ACTION_LAUNCH_HEARING_DEVICES_DIALOG; import static com.android.window.flags.Flags.FLAG_ALWAYS_DRAW_MAGNIFICATION_FULLSCREEN_BORDER; @@ -2045,6 +2046,53 @@ public class AccessibilityManagerServiceTest { .isEqualTo(ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR); } + @Test + public void showAccessibilityTargetSelection_navBarNavigationMode_softwareExtra() { + mFakePermissionEnforcer.grant(Manifest.permission.STATUS_BAR_SERVICE); + final AccessibilityUserState userState = new AccessibilityUserState( + UserHandle.USER_SYSTEM, mTestableContext, mA11yms); + mA11yms.mUserStates.put(UserHandle.USER_SYSTEM, userState); + Settings.Secure.putIntForUser(mTestableContext.getContentResolver(), + NAVIGATION_MODE, NAV_BAR_MODE_3BUTTON, userState.mUserId); + + mA11yms.notifyAccessibilityButtonLongClicked(Display.DEFAULT_DISPLAY); + mTestableLooper.processAllMessages(); + + assertStartActivityWithExpectedShortcutType(mTestableContext.getMockContext(), SOFTWARE); + } + + @Test + @DisableFlags(android.provider.Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED) + public void showAccessibilityTargetSelection_gestureNavigationMode_softwareExtra() { + mFakePermissionEnforcer.grant(Manifest.permission.STATUS_BAR_SERVICE); + final AccessibilityUserState userState = new AccessibilityUserState( + UserHandle.USER_SYSTEM, mTestableContext, mA11yms); + mA11yms.mUserStates.put(UserHandle.USER_SYSTEM, userState); + Settings.Secure.putIntForUser(mTestableContext.getContentResolver(), + NAVIGATION_MODE, NAV_BAR_MODE_GESTURAL, userState.mUserId); + + mA11yms.notifyAccessibilityButtonLongClicked(Display.DEFAULT_DISPLAY); + mTestableLooper.processAllMessages(); + + assertStartActivityWithExpectedShortcutType(mTestableContext.getMockContext(), SOFTWARE); + } + + @Test + @EnableFlags(android.provider.Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED) + public void showAccessibilityTargetSelection_gestureNavigationMode_gestureExtra() { + mFakePermissionEnforcer.grant(Manifest.permission.STATUS_BAR_SERVICE); + final AccessibilityUserState userState = new AccessibilityUserState( + UserHandle.USER_SYSTEM, mTestableContext, mA11yms); + mA11yms.mUserStates.put(UserHandle.USER_SYSTEM, userState); + Settings.Secure.putIntForUser(mTestableContext.getContentResolver(), + NAVIGATION_MODE, NAV_BAR_MODE_GESTURAL, userState.mUserId); + + mA11yms.notifyAccessibilityButtonLongClicked(Display.DEFAULT_DISPLAY); + mTestableLooper.processAllMessages(); + + assertStartActivityWithExpectedShortcutType(mTestableContext.getMockContext(), GESTURE); + } + @Test public void registerUserInitializationCompleteCallback_isRegistered() { mA11yms.mUserInitializationCompleteCallbacks.clear(); @@ -2075,6 +2123,43 @@ public class AccessibilityManagerServiceTest { UserHandle.MIN_SECONDARY_USER_ID); } + @Test + @DisableFlags(android.provider.Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED) + public void getShortcutTypeForGenericShortcutCalls_softwareType() { + final AccessibilityUserState userState = new AccessibilityUserState( + UserHandle.USER_SYSTEM, mTestableContext, mA11yms); + mA11yms.mUserStates.put(UserHandle.USER_SYSTEM, userState); + + assertThat(mA11yms.getShortcutTypeForGenericShortcutCalls(userState.mUserId)) + .isEqualTo(SOFTWARE); + } + + @Test + @EnableFlags(android.provider.Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED) + public void getShortcutTypeForGenericShortcutCalls_gestureNavigationMode_gestureType() { + final AccessibilityUserState userState = new AccessibilityUserState( + UserHandle.USER_SYSTEM, mTestableContext, mA11yms); + mA11yms.mUserStates.put(UserHandle.USER_SYSTEM, userState); + Settings.Secure.putIntForUser(mTestableContext.getContentResolver(), + NAVIGATION_MODE, NAV_BAR_MODE_GESTURAL, userState.mUserId); + + assertThat(mA11yms.getShortcutTypeForGenericShortcutCalls(userState.mUserId)) + .isEqualTo(GESTURE); + } + + @Test + @EnableFlags(android.provider.Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED) + public void getShortcutTypeForGenericShortcutCalls_buttonNavigationMode_softwareType() { + final AccessibilityUserState userState = new AccessibilityUserState( + UserHandle.USER_SYSTEM, mTestableContext, mA11yms); + mA11yms.mUserStates.put(UserHandle.USER_SYSTEM, userState); + Settings.Secure.putIntForUser(mTestableContext.getContentResolver(), + NAVIGATION_MODE, NAV_BAR_MODE_3BUTTON, userState.mUserId); + + assertThat(mA11yms.getShortcutTypeForGenericShortcutCalls(userState.mUserId)) + .isEqualTo(SOFTWARE); + } + private Set readStringsFromSetting(String setting) { final Set result = new ArraySet<>(); mA11yms.readColonDelimitedSettingToSet( @@ -2148,6 +2233,14 @@ public class AccessibilityManagerServiceTest { Intent.EXTRA_COMPONENT_NAME)).isEqualTo(componentName); } + private void assertStartActivityWithExpectedShortcutType(Context mockContext, + @UserShortcutType int shortcutType) { + verify(mockContext).startActivityAsUser(mIntentArgumentCaptor.capture(), + any(Bundle.class), any(UserHandle.class)); + assertThat(mIntentArgumentCaptor.getValue().getIntExtra( + EXTRA_TYPE_TO_CHOOSE, -1)).isEqualTo(shortcutType); + } + private void setupShortcutTargetServices() { setupShortcutTargetServices(mA11yms.getCurrentUserState()); } diff --git a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityUserStateTest.java b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityUserStateTest.java index 62fa95149067..627b5e39a20a 100644 --- a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityUserStateTest.java +++ b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityUserStateTest.java @@ -28,10 +28,13 @@ import static android.view.accessibility.AccessibilityManager.STATE_FLAG_ACCESSI import static android.view.accessibility.AccessibilityManager.STATE_FLAG_HIGH_TEXT_CONTRAST_ENABLED; import static android.view.accessibility.AccessibilityManager.STATE_FLAG_TOUCH_EXPLORATION_ENABLED; +import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.GESTURE; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.HARDWARE; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.QUICK_SETTINGS; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE; +import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.TRIPLETAP; +import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.TWOFINGER_DOUBLETAP; import static com.android.server.accessibility.AccessibilityUserState.doesShortcutTargetsStringContain; import static com.google.common.truth.Truth.assertThat; @@ -67,6 +70,8 @@ import androidx.test.InstrumentationRegistry; import com.android.internal.R; import com.android.internal.accessibility.AccessibilityShortcutController; +import com.android.internal.accessibility.common.ShortcutConstants; +import com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType; import com.android.internal.util.test.FakeSettingsProvider; import org.junit.After; @@ -504,6 +509,36 @@ public class AccessibilityUserStateTest { assertThat(actual).containsExactly(tileComponent, mMockServiceInfo); } + @Test + public void isShortcutMagnificationEnabledLocked_anyShortcutType_returnsTrue() { + // Clear every shortcut + for (int shortcutType : ShortcutConstants.USER_SHORTCUT_TYPES) { + setMagnificationForShortcutType(shortcutType, false); + } + // Check each shortcut individually + for (int shortcutType : ShortcutConstants.USER_SHORTCUT_TYPES) { + // Setup + setMagnificationForShortcutType(shortcutType, true); + + // Checking + assertThat(mUserState.getShortcutTargetsLocked(shortcutType)) + .containsExactly(MAGNIFICATION_CONTROLLER_NAME); + assertThat(mUserState.isShortcutMagnificationEnabledLocked()).isTrue(); + + // Cleanup + setMagnificationForShortcutType(shortcutType, false); + } + } + + @Test + public void isShortcutMagnificationEnabledLocked_noShortcutTypes_returnsFalse() { + // Clear every shortcut + for (int shortcutType : ShortcutConstants.USER_SHORTCUT_TYPES) { + setMagnificationForShortcutType(shortcutType, false); + } + assertThat(mUserState.isShortcutMagnificationEnabledLocked()).isFalse(); + } + private int getSecureIntForUser(String key, int userId) { return Settings.Secure.getIntForUser(mMockResolver, key, -1, userId); } @@ -511,4 +546,16 @@ public class AccessibilityUserStateTest { private void putSecureIntForUser(String key, int value, int userId) { Settings.Secure.putIntForUser(mMockResolver, key, value, userId); } + + private void setMagnificationForShortcutType( + @UserShortcutType int shortcutType, boolean enabled) { + if (shortcutType == TRIPLETAP) { + mUserState.setMagnificationSingleFingerTripleTapEnabledLocked(enabled); + } else if (shortcutType == TWOFINGER_DOUBLETAP) { + mUserState.setMagnificationTwoFingerTripleTapEnabledLocked(enabled); + } else { + mUserState.updateShortcutTargetsLocked( + enabled ? Set.of(MAGNIFICATION_CONTROLLER_NAME) : Set.of(), shortcutType); + } + } } -- GitLab From 4bddaa7618347ad008047d2adb3ffb1db214a723 Mon Sep 17 00:00:00 2001 From: Riley Jones Date: Thu, 5 Sep 2024 22:59:07 +0000 Subject: [PATCH 045/492] Using SecureSettings to monitor settings on worker thread Adjusting the SecureSettingsContentObserver to comply with the guidelines at go/register-observer-bg-migration. Bug: 362737091 Test: atest com.android.systemui.accessibility Flag: EXEMPT internal cleanup Change-Id: Id6b24aa555fa4a25ec8f47a8b4d30301b52966cc --- .../AccessibilityButtonModeObserver.java | 6 ++++-- .../AccessibilityButtonTargetsObserver.java | 6 ++++-- .../AccessibilityGestureTargetsObserver.java | 6 ++++-- .../accessibility/SecureSettingsContentObserver.java | 12 +++++++----- .../AccessibilityButtonModeObserverTest.java | 4 +++- .../AccessibilityButtonTargetsObserverTest.java | 4 +++- .../AccessibilityGestureTargetsObserverTest.java | 4 +++- .../SecureSettingsContentObserverTest.java | 3 ++- 8 files changed, 30 insertions(+), 15 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityButtonModeObserver.java b/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityButtonModeObserver.java index 2c97d62d690e..4d5e717536f6 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityButtonModeObserver.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityButtonModeObserver.java @@ -28,6 +28,7 @@ import android.util.Log; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.SecureSettings; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -68,8 +69,9 @@ public class AccessibilityButtonModeObserver extends } @Inject - public AccessibilityButtonModeObserver(Context context, UserTracker userTracker) { - super(context, userTracker, Settings.Secure.ACCESSIBILITY_BUTTON_MODE); + public AccessibilityButtonModeObserver( + Context context, UserTracker userTracker, SecureSettings secureSettings) { + super(context, userTracker, secureSettings, Settings.Secure.ACCESSIBILITY_BUTTON_MODE); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityButtonTargetsObserver.java b/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityButtonTargetsObserver.java index 53a21b329594..1363b1c12332 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityButtonTargetsObserver.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityButtonTargetsObserver.java @@ -24,6 +24,7 @@ import androidx.annotation.Nullable; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.SecureSettings; import javax.inject.Inject; @@ -49,8 +50,9 @@ public class AccessibilityButtonTargetsObserver extends } @Inject - public AccessibilityButtonTargetsObserver(Context context, UserTracker userTracker) { - super(context, userTracker, Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS); + public AccessibilityButtonTargetsObserver( + Context context, UserTracker userTracker, SecureSettings secureSettings) { + super(context, userTracker, secureSettings, Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityGestureTargetsObserver.java b/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityGestureTargetsObserver.java index c94487848b81..736217a699fd 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityGestureTargetsObserver.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/AccessibilityGestureTargetsObserver.java @@ -24,6 +24,7 @@ import androidx.annotation.Nullable; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.SecureSettings; import javax.inject.Inject; @@ -49,8 +50,9 @@ public class AccessibilityGestureTargetsObserver extends } @Inject - public AccessibilityGestureTargetsObserver(Context context, UserTracker userTracker) { - super(context, userTracker, Settings.Secure.ACCESSIBILITY_GESTURE_TARGETS); + public AccessibilityGestureTargetsObserver( + Context context, UserTracker userTracker, SecureSettings secureSettings) { + super(context, userTracker, secureSettings, Settings.Secure.ACCESSIBILITY_GESTURE_TARGETS); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SecureSettingsContentObserver.java b/packages/SystemUI/src/com/android/systemui/accessibility/SecureSettingsContentObserver.java index 326773fb5bef..c50cf85feccb 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/SecureSettingsContentObserver.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/SecureSettingsContentObserver.java @@ -28,6 +28,7 @@ import androidx.annotation.NonNull; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.SecureSettings; import java.util.ArrayList; import java.util.List; @@ -48,6 +49,7 @@ public abstract class SecureSettingsContentObserver { private final UserTracker mUserTracker; @VisibleForTesting final ContentObserver mContentObserver; + private final SecureSettings mSecureSettings; private final String mKey; @@ -55,7 +57,7 @@ public abstract class SecureSettingsContentObserver { final List mListeners = new ArrayList<>(); protected SecureSettingsContentObserver(Context context, UserTracker userTracker, - String secureSettingsKey) { + SecureSettings secureSettings, String secureSettingsKey) { mKey = secureSettingsKey; mContentResolver = context.getContentResolver(); mUserTracker = userTracker; @@ -65,6 +67,7 @@ public abstract class SecureSettingsContentObserver { updateValueChanged(); } }; + mSecureSettings = secureSettings; } /** @@ -80,9 +83,8 @@ public abstract class SecureSettingsContentObserver { } if (mListeners.size() == 1) { - mContentResolver.registerContentObserver( - Settings.Secure.getUriFor(mKey), /* notifyForDescendants= */ - false, mContentObserver, UserHandle.USER_ALL); + mSecureSettings.registerContentObserverForUserAsync(Settings.Secure.getUriFor(mKey), + /* notifyForDescendants= */ false, mContentObserver, UserHandle.USER_ALL); } } @@ -97,7 +99,7 @@ public abstract class SecureSettingsContentObserver { mListeners.remove(listener); if (mListeners.isEmpty()) { - mContentResolver.unregisterContentObserver(mContentObserver); + mSecureSettings.unregisterContentObserverAsync(mContentObserver); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityButtonModeObserverTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityButtonModeObserverTest.java index 4a5c1bed7b44..038ec406c3d1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityButtonModeObserverTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityButtonModeObserverTest.java @@ -32,12 +32,14 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.SecureSettings; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; @@ -66,7 +68,7 @@ public class AccessibilityButtonModeObserverTest extends SysuiTestCase { Settings.Secure.ACCESSIBILITY_BUTTON_MODE, Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR, MY_USER_ID); mAccessibilityButtonModeObserver = new AccessibilityButtonModeObserver(mContext, - mUserTracker); + mUserTracker, Mockito.mock(SecureSettings.class)); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityButtonTargetsObserverTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityButtonTargetsObserverTest.java index a5a7a4a09227..f5649266d0a9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityButtonTargetsObserverTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityButtonTargetsObserverTest.java @@ -31,12 +31,14 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.SecureSettings; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; @@ -62,7 +64,7 @@ public class AccessibilityButtonTargetsObserverTest extends SysuiTestCase { public void setUp() { when(mUserTracker.getUserId()).thenReturn(MY_USER_ID); mAccessibilityButtonTargetsObserver = new AccessibilityButtonTargetsObserver(mContext, - mUserTracker); + mUserTracker, Mockito.mock(SecureSettings.class)); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityGestureTargetsObserverTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityGestureTargetsObserverTest.java index ba990efd5162..afed12fb700b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityGestureTargetsObserverTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/AccessibilityGestureTargetsObserverTest.java @@ -31,12 +31,14 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.SecureSettings; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; @@ -62,7 +64,7 @@ public class AccessibilityGestureTargetsObserverTest extends SysuiTestCase { public void setUp() { when(mUserTracker.getUserId()).thenReturn(MY_USER_ID); mAccessibilityGestureTargetsObserver = new AccessibilityGestureTargetsObserver(mContext, - mUserTracker); + mUserTracker, Mockito.mock(SecureSettings.class)); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/SecureSettingsContentObserverTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SecureSettingsContentObserverTest.java index 9222fc2222be..1d88b904668c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/SecureSettingsContentObserverTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SecureSettingsContentObserverTest.java @@ -27,6 +27,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.SecureSettings; import org.junit.Before; import org.junit.Test; @@ -72,7 +73,7 @@ public class SecureSettingsContentObserverTest extends SysuiTestCase { protected FakeSecureSettingsContentObserver(Context context, UserTracker userTracker, String secureSettingsKey) { - super(context, userTracker, secureSettingsKey); + super(context, userTracker, Mockito.mock(SecureSettings.class), secureSettingsKey); } @Override -- GitLab From 08a298aa6d7bf1ae0ab6f8bf83294ffa9f9874d5 Mon Sep 17 00:00:00 2001 From: Josh Chien Date: Wed, 4 Sep 2024 06:25:31 +0000 Subject: [PATCH 046/492] Adjusted the systembar display in mock game test app to only hiding statusbar while under immersive mode. Sometimes the systembar will be automatically hid in a short time after swiping down to show the systembar under immersive mode. That will cause the quick switch gesture failed since the navigation bar is hidden. So, adjusted the system bar hiding behavior to only hiding Statusbar to avoid flakiness. Test: https://android-build.corp.google.com/abtd/run/L95200030006266256 Bug: 342654085 Flag: TEST_ONLY Change-Id: I22609318c47513d40a67d71dd8906cb6323557cd --- .../com/android/server/wm/flicker/testapp/GameActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/GameActivity.java b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/GameActivity.java index ef75d4ddcdcd..93254f7247b6 100644 --- a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/GameActivity.java +++ b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/GameActivity.java @@ -71,7 +71,7 @@ public class GameActivity extends Activity implements SurfaceHolder.Callback { windowInsetsController.setSystemBarsBehavior( WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE ); - // Hide both the status bar and the navigation bar. - windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); + // Hide status bar only to avoid flakiness on gesture quick switch cases. + windowInsetsController.hide(WindowInsetsCompat.Type.statusBars()); } } -- GitLab From d5be0605dc14839462d73a8dd4c569b8e5c8b9de Mon Sep 17 00:00:00 2001 From: Yan Yan Date: Thu, 5 Sep 2024 18:56:40 -0700 Subject: [PATCH 047/492] Clean up allow_disable_ipsec_loss_detector flag Bug: 336638836 Test: atest FrameworksVcnTests && atest CtsVcnTestCases Flag: EXEMPT flag clean up Change-Id: Ifbeaf7c4baa31a782a0632345af9016f6b6456fb --- core/java/android/net/vcn/flags.aconfig | 10 ---------- .../vcn/routeselection/IpSecPacketLossDetector.java | 4 ++-- .../vcn/routeselection/NetworkEvaluationTestBase.java | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/core/java/android/net/vcn/flags.aconfig b/core/java/android/net/vcn/flags.aconfig index d4d1ed22dd4e..dcb363ccf535 100644 --- a/core/java/android/net/vcn/flags.aconfig +++ b/core/java/android/net/vcn/flags.aconfig @@ -55,14 +55,4 @@ flag{ metadata { purpose: PURPOSE_BUGFIX } -} - -flag{ - name: "allow_disable_ipsec_loss_detector" - namespace: "vcn" - description: "Allow disabling IPsec packet loss detector" - bug: "336638836" - metadata { - purpose: PURPOSE_BUGFIX - } } \ No newline at end of file diff --git a/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java b/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java index 474253223628..5f704a002a33 100644 --- a/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java +++ b/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java @@ -276,7 +276,7 @@ public class IpSecPacketLossDetector extends NetworkMetricMonitor { // enabled on the last one as a sample mInboundTransform = inboundTransform; - if (!Flags.allowDisableIpsecLossDetector() || canStart()) { + if (canStart()) { start(); } } @@ -292,7 +292,7 @@ public class IpSecPacketLossDetector extends NetworkMetricMonitor { mMaxSeqNumIncreasePerSecond = getMaxSeqNumIncreasePerSecond(carrierConfig); } - if (Flags.allowDisableIpsecLossDetector() && canStart() != isStarted()) { + if (canStart() != isStarted()) { if (canStart()) { start(); } else { diff --git a/tests/vcn/java/com/android/server/vcn/routeselection/NetworkEvaluationTestBase.java b/tests/vcn/java/com/android/server/vcn/routeselection/NetworkEvaluationTestBase.java index 0439d5f54e23..edad67896e8e 100644 --- a/tests/vcn/java/com/android/server/vcn/routeselection/NetworkEvaluationTestBase.java +++ b/tests/vcn/java/com/android/server/vcn/routeselection/NetworkEvaluationTestBase.java @@ -123,7 +123,6 @@ public abstract class NetworkEvaluationTestBase { mSetFlagsRule.enableFlags(Flags.FLAG_VALIDATE_NETWORK_ON_IPSEC_LOSS); mSetFlagsRule.enableFlags(Flags.FLAG_EVALUATE_IPSEC_LOSS_ON_LP_NC_CHANGE); mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_SEQ_NUM_LEAP); - mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_DISABLE_IPSEC_LOSS_DETECTOR); when(mNetwork.getNetId()).thenReturn(-1); -- GitLab From c84cf77d48690c8fb188fd0550a6ee9e2ea1464a Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Fri, 6 Sep 2024 02:59:08 +0000 Subject: [PATCH 048/492] Update home visibility status once receive close transition Still need to update home's visibility to HomeVisibilityState, so the HomeVisibilityState#isHomeVisible can be updated. Defer the update visibility event for back gesture until close transition ready. Flag: com.android.window.flags.migrate_predictive_back_transition Bug: 364869547 Test: atest HomeTransitionObserverTest Test: atest TaplTestsQuickstep Change-Id: Ib74556948422a5a064532540675cbde99a9c66bb --- .../transition/HomeTransitionObserver.java | 8 +++-- .../HomeTransitionObserverTest.java | 31 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java index 3d79a1c8cebe..c385f9afcf3a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java @@ -74,8 +74,12 @@ public class HomeTransitionObserver implements TransitionObserver, final boolean isBackGesture = change.hasFlags(FLAG_BACK_GESTURE_ANIMATED); if (taskInfo.getActivityType() == ACTIVITY_TYPE_HOME) { if (Flags.migratePredictiveBackTransition()) { - if (!isBackGesture && TransitionUtil.isOpenOrCloseMode(mode)) { - notifyHomeVisibilityChanged(TransitionUtil.isOpeningType(mode)); + final boolean gestureToHomeTransition = isBackGesture + && TransitionUtil.isClosingType(info.getType()); + if (gestureToHomeTransition + || (!isBackGesture && TransitionUtil.isOpenOrCloseMode(mode))) { + notifyHomeVisibilityChanged(gestureToHomeTransition + || TransitionUtil.isOpeningType(mode)); } } else { if (TransitionUtil.isOpenOrCloseMode(mode) || isBackGesture) { diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java index f51a9608d442..8f49de0a98fb 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java @@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_OPEN; +import static android.view.WindowManager.TRANSIT_PREPARE_BACK_NAVIGATION; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.window.TransitionInfo.FLAG_BACK_GESTURE_ANIMATED; @@ -39,6 +40,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.platform.test.annotations.RequiresFlagsDisabled; +import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.view.SurfaceControl; @@ -213,6 +215,35 @@ public class HomeTransitionObserverTest extends ShellTestCase { verify(mListener, times(1)).onHomeVisibilityChanged(true); } + @Test + @RequiresFlagsEnabled(Flags.FLAG_MIGRATE_PREDICTIVE_BACK_TRANSITION) + public void testHomeActivityWithBackGestureNotifiesHomeIsVisibleAfterClose() + throws RemoteException { + TransitionInfo info = mock(TransitionInfo.class); + TransitionInfo.Change change = mock(TransitionInfo.Change.class); + ActivityManager.RunningTaskInfo taskInfo = mock(ActivityManager.RunningTaskInfo.class); + when(change.getTaskInfo()).thenReturn(taskInfo); + when(info.getChanges()).thenReturn(new ArrayList<>(List.of(change))); + when(info.getType()).thenReturn(TRANSIT_PREPARE_BACK_NAVIGATION); + + when(change.hasFlags(FLAG_BACK_GESTURE_ANIMATED)).thenReturn(true); + setupTransitionInfo(taskInfo, change, ACTIVITY_TYPE_HOME, TRANSIT_OPEN, true); + + mHomeTransitionObserver.onTransitionReady(mock(IBinder.class), + info, + mock(SurfaceControl.Transaction.class), + mock(SurfaceControl.Transaction.class)); + verify(mListener, times(0)).onHomeVisibilityChanged(anyBoolean()); + + when(info.getType()).thenReturn(TRANSIT_TO_BACK); + setupTransitionInfo(taskInfo, change, ACTIVITY_TYPE_HOME, TRANSIT_CHANGE, true); + mHomeTransitionObserver.onTransitionReady(mock(IBinder.class), + info, + mock(SurfaceControl.Transaction.class), + mock(SurfaceControl.Transaction.class)); + verify(mListener, times(1)).onHomeVisibilityChanged(true); + } + /** * Helper class to initialize variables for the rest. */ -- GitLab From 26861ca74970480ff993f4a66238314e33409c16 Mon Sep 17 00:00:00 2001 From: Winni Chang Date: Wed, 4 Sep 2024 08:52:31 +0000 Subject: [PATCH 049/492] Refactor RequestSadAction Some AVR sends out multiple messages. Upon receiving these, the TV responds with corresponding RequestSadAction, and the AVR is required to reply with multiple SADs. However, SADs sent out later may not be fully responded to before the ARC times out, resulting in these SADs not being updated. Bug: 361295470 Test: Tested with Samsung Q99C, CEC can now update SADs correctly. Flag: EXEMPT bugfix Change-Id: Ide9c417faa4a18b59d567aedb1a9ad222f621112 --- .../android/server/hdmi/SetArcTransmissionStateAction.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java b/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java index 5ab22e1dcd61..e6abcb958b55 100644 --- a/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java +++ b/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java @@ -60,6 +60,12 @@ final class SetArcTransmissionStateAction extends HdmiCecFeatureAction { boolean start() { // Seq #37. if (mEnabled) { + // Avoid triggering duplicate RequestSadAction events. + // This could lead to unexpected responses from the AVR and cause the TV to receive data + // out of order. The SAD report does not provide information about the order of events. + if ((tv().hasAction(RequestSadAction.class))) { + return true; + } // Request SADs before enabling ARC RequestSadAction action = new RequestSadAction( localDevice(), Constants.ADDR_AUDIO_SYSTEM, -- GitLab From b8242c067196d8befcc140a25c5b3fbac1fd8a1c Mon Sep 17 00:00:00 2001 From: Kazuki Takise Date: Fri, 6 Sep 2024 13:18:14 +0900 Subject: [PATCH 050/492] Create a flag for display focus switch in shell transitions Flag: EXEMPT adding flag Test: m Bug: 356109871 Change-Id: I351aea69a7c092bf6202a10259cf9edb286acce1 --- .../android/window/flags/lse_desktop_experience.aconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/java/android/window/flags/lse_desktop_experience.aconfig b/core/java/android/window/flags/lse_desktop_experience.aconfig index cab6d8e9774a..7753291a3eb7 100644 --- a/core/java/android/window/flags/lse_desktop_experience.aconfig +++ b/core/java/android/window/flags/lse_desktop_experience.aconfig @@ -252,3 +252,10 @@ flag { description: "Persists the desktop windowing session across reboots." bug: "350456942" } + +flag { + name: "enable_display_focus_in_shell_transitions" + namespace: "lse_desktop_experience" + description: "Creates a shell transition when display focus switches." + bug: "356109871" +} -- GitLab From 85cc18447def03031850e3cc68659f1310ffe2b3 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Fri, 6 Sep 2024 11:40:43 +0800 Subject: [PATCH 051/492] Avoid race of checking screen states and sleep token The callback *GoingToSleep and screenTurn* run on different threads, so there could be a race if screen on/off in a short time and the thread has some delays: Thread1 gets isScreenOnEarly==false Thread2 modifies isScreenOnEarly=true Thread2 releases sleep-token Thread1 acquire sleep-token Then the final state is screen on but sleep-token is still acquired. This change moves the fail-safe check from startedGoingToSleep to finishedGoingToSleep>setAwake(false) and reuse the existing SleepTokenAcquirer, so it is easier to acquire/release in DisplayPolicy inside a lock. Now the check of isScreenOnEarly and sleep-token in screenTurningOn and setAwake are synchronized. Bug: 364760760 Flag: EXEMPT bugfix Test: PhoneWindowManagerTests Change-Id: I5c47b4a745fcd369d3ec825c41a7c1d35ce9feca --- .../server/policy/PhoneWindowManager.java | 29 ++----------------- .../wm/ActivityTaskManagerInternal.java | 29 ------------------- .../server/wm/ActivityTaskManagerService.java | 16 ++++------ .../com/android/server/wm/DisplayContent.java | 7 ++--- .../com/android/server/wm/DisplayPolicy.java | 15 +++++++++- .../android/server/wm/KeyguardController.java | 8 ++--- .../server/wm/RootWindowContainer.java | 4 +-- .../policy/PhoneWindowManagerTests.java | 23 +++------------ .../server/wm/ActivityRecordTests.java | 2 +- .../android/server/wm/DisplayPolicyTests.java | 6 ++-- .../android/server/wm/TaskFragmentTest.java | 2 +- 11 files changed, 39 insertions(+), 102 deletions(-) diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index f96706e474be..d4972da5464b 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -529,7 +529,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { volatile boolean mRequestedOrSleepingDefaultDisplay; /** - * This is used to check whether to invoke {@link #updateScreenOffSleepToken} when screen is + * This is used to check whether to acquire screen-off sleep token when screen is * turned off. E.g. if it is false when screen is turned off and the display is swapping, it * is expected that the screen will be on in a short time. Then it is unnecessary to acquire * screen-off-sleep-token, so it can avoid intermediate visibility or lifecycle changes. @@ -604,7 +604,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mPendingKeyguardOccluded; private boolean mKeyguardOccludedChanged; - private ActivityTaskManagerInternal.SleepTokenAcquirer mScreenOffSleepTokenAcquirer; Intent mHomeIntent; Intent mCarDockIntent; Intent mDeskDockIntent; @@ -2217,9 +2216,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { mLockPatternUtils = new LockPatternUtils(mContext); mLogger = new MetricsLogger(); - mScreenOffSleepTokenAcquirer = mActivityTaskManagerInternal - .createSleepTokenAcquirer("ScreenOff"); - Resources res = mContext.getResources(); mWakeOnDpadKeyPress = res.getBoolean(com.android.internal.R.bool.config_wakeOnDpadKeyPress); @@ -5526,13 +5522,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { mRequestedOrSleepingDefaultDisplay = true; mIsGoingToSleepDefaultDisplay = true; - // In case startedGoingToSleep is called after screenTurnedOff (the source caller is in - // order but the methods run on different threads) and updateScreenOffSleepToken was - // skipped. Then acquire sleep token if screen was off. - if (!mDefaultDisplayPolicy.isScreenOnFully() && !mDefaultDisplayPolicy.isScreenOnEarly()) { - updateScreenOffSleepToken(true /* acquire */); - } - if (mKeyguardDelegate != null) { mKeyguardDelegate.onStartedGoingToSleep(pmSleepReason); } @@ -5693,11 +5682,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (DEBUG_WAKEUP) Slog.i(TAG, "Display" + displayId + " turned off..."); if (displayId == DEFAULT_DISPLAY) { - if (!isSwappingDisplay || mIsGoingToSleepDefaultDisplay) { - updateScreenOffSleepToken(true /* acquire */); - } + final boolean acquireSleepToken = !isSwappingDisplay || mIsGoingToSleepDefaultDisplay; mRequestedOrSleepingDefaultDisplay = false; - mDefaultDisplayPolicy.screenTurnedOff(); + mDefaultDisplayPolicy.screenTurnedOff(acquireSleepToken); synchronized (mLock) { if (mKeyguardDelegate != null) { mKeyguardDelegate.onScreenTurnedOff(); @@ -5753,7 +5740,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (displayId == DEFAULT_DISPLAY) { Trace.asyncTraceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "screenTurningOn", 0 /* cookie */); - updateScreenOffSleepToken(false /* acquire */); mDefaultDisplayPolicy.screenTurningOn(screenOnListener); mBootAnimationDismissable = false; @@ -6260,15 +6246,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } - // TODO (multidisplay): Support multiple displays in WindowManagerPolicy. - private void updateScreenOffSleepToken(boolean acquire) { - if (acquire) { - mScreenOffSleepTokenAcquirer.acquire(DEFAULT_DISPLAY); - } else { - mScreenOffSleepTokenAcquirer.release(DEFAULT_DISPLAY); - } - } - /** {@inheritDoc} */ @Override public void enableScreenAfterBoot() { diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java index 26a6b00254d3..554b6c15c5f8 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java @@ -129,35 +129,6 @@ public abstract class ActivityTaskManagerInternal { void onKeyguardStateChanged(boolean isShowing); } - /** - * Sleep tokens cause the activity manager to put the top activity to sleep. - * They are used by components such as dreams that may hide and block interaction - * with underlying activities. - * The Acquirer provides an interface that encapsulates the underlying work, so the user does - * not need to handle the token by him/herself. - */ - public interface SleepTokenAcquirer { - - /** - * Acquires a sleep token. - * @param displayId The display to apply to. - */ - void acquire(int displayId); - - /** - * Releases the sleep token. - * @param displayId The display to apply to. - */ - void release(int displayId); - } - - /** - * Creates a sleep token acquirer for the specified display with the specified tag. - * - * @param tag A string identifying the purpose (eg. "Dream"). - */ - public abstract SleepTokenAcquirer createSleepTokenAcquirer(@NonNull String tag); - /** * Returns home activity for the specified user. * diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index f5476f29849a..cc3719f539e3 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -4349,6 +4349,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { mTaskOrganizerController.dump(pw, " "); mVisibleActivityProcessTracker.dump(pw, " "); mActiveUids.dump(pw, " "); + pw.println(" SleepTokens=" + mRootWindowContainer.mSleepTokens); if (mDemoteTopAppReasons != 0) { pw.println(" mDemoteTopAppReasons=" + mDemoteTopAppReasons); } @@ -5064,17 +5065,16 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { EventLogTags.writeWmSetResumedActivity(r.mUserId, r.shortComponentName, reason); } - final class SleepTokenAcquirerImpl implements ActivityTaskManagerInternal.SleepTokenAcquirer { + final class SleepTokenAcquirer { private final String mTag; private final SparseArray mSleepTokens = new SparseArray<>(); - SleepTokenAcquirerImpl(@NonNull String tag) { + SleepTokenAcquirer(@NonNull String tag) { mTag = tag; } - @Override - public void acquire(int displayId) { + void acquire(int displayId) { synchronized (mGlobalLock) { if (!mSleepTokens.contains(displayId)) { mSleepTokens.append(displayId, @@ -5084,8 +5084,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } - @Override - public void release(int displayId) { + void release(int displayId) { synchronized (mGlobalLock) { final RootWindowContainer.SleepToken token = mSleepTokens.get(displayId); if (token != null) { @@ -5948,11 +5947,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } final class LocalService extends ActivityTaskManagerInternal { - @Override - public SleepTokenAcquirer createSleepTokenAcquirer(@NonNull String tag) { - Objects.requireNonNull(tag); - return new SleepTokenAcquirerImpl(tag); - } @Override public ComponentName getHomeActivityForUser(int userId) { diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 34bbe6ad8e21..eb197541ea49 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -738,8 +738,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp /** All tokens used to put activities on this root task to sleep (including mOffToken) */ final ArrayList mAllSleepTokens = new ArrayList<>(); - /** The token acquirer to put root tasks on the display to sleep */ - private final ActivityTaskManagerInternal.SleepTokenAcquirer mOffTokenAcquirer; private boolean mSleeping; @@ -1134,7 +1132,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mDisplay = display; mDisplayId = display.getDisplayId(); mCurrentUniqueDisplayId = display.getUniqueId(); - mOffTokenAcquirer = mRootWindowContainer.mDisplayOffTokenAcquirer; mWallpaperController = new WallpaperController(mWmService, this); mWallpaperController.resetLargestDisplay(display); display.getDisplayInfo(mDisplayInfo); @@ -6167,9 +6164,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp final int displayState = mDisplayInfo.state; if (displayId != DEFAULT_DISPLAY) { if (displayState == Display.STATE_OFF) { - mOffTokenAcquirer.acquire(mDisplayId); + mRootWindowContainer.mDisplayOffTokenAcquirer.acquire(mDisplayId); } else if (displayState == Display.STATE_ON) { - mOffTokenAcquirer.release(mDisplayId); + mRootWindowContainer.mDisplayOffTokenAcquirer.release(mDisplayId); } ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, "Content Recording: Display %d state was (%d), is now (%d), so update " diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 745b79209546..c4f521131958 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -804,6 +804,14 @@ public class DisplayPolicy { mAwake /* waiting */); if (!awake) { onDisplaySwitchFinished(); + // In case PhoneWindowManager's startedGoingToSleep is called after screenTurnedOff + // (the source caller is in order but the methods run on different threads) and + // updateScreenOffSleepToken was skipped by mIsGoingToSleepDefaultDisplay. Then + // acquire sleep token if screen is off. + if (!mScreenOnEarly && !mScreenOnFully && !mDisplayContent.isSleeping()) { + Slog.w(TAG, "Late acquire sleep token for " + mDisplayContent); + mService.mRoot.mDisplayOffTokenAcquirer.acquire(mDisplayContent.mDisplayId); + } } } } @@ -851,6 +859,7 @@ public class DisplayPolicy { public void screenTurningOn(ScreenOnListener screenOnListener) { WindowProcessController visibleDozeUiProcess = null; synchronized (mLock) { + mService.mRoot.mDisplayOffTokenAcquirer.release(mDisplayContent.mDisplayId); mScreenOnEarly = true; mScreenOnFully = false; mKeyguardDrawComplete = false; @@ -875,8 +884,12 @@ public class DisplayPolicy { onDisplaySwitchFinished(); } - public void screenTurnedOff() { + /** It is called after {@link #screenTurningOn}. This runs on PowerManager's thread. */ + public void screenTurnedOff(boolean acquireSleepToken) { synchronized (mLock) { + if (acquireSleepToken) { + mService.mRoot.mDisplayOffTokenAcquirer.acquire(mDisplayContent.mDisplayId); + } mScreenOnEarly = false; mScreenOnFully = false; mKeyguardDrawComplete = false; diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java index 5d8a96c530ef..0c489d6207e9 100644 --- a/services/core/java/com/android/server/wm/KeyguardController.java +++ b/services/core/java/com/android/server/wm/KeyguardController.java @@ -87,7 +87,7 @@ class KeyguardController { private final SparseArray mDisplayStates = new SparseArray<>(); private final ActivityTaskManagerService mService; private RootWindowContainer mRootWindowContainer; - private final ActivityTaskManagerInternal.SleepTokenAcquirer mSleepTokenAcquirer; + private final ActivityTaskManagerService.SleepTokenAcquirer mSleepTokenAcquirer; private boolean mWaitingForWakeTransition; private Transition.ReadyCondition mWaitAodHide = null; @@ -95,7 +95,7 @@ class KeyguardController { ActivityTaskSupervisor taskSupervisor) { mService = service; mTaskSupervisor = taskSupervisor; - mSleepTokenAcquirer = mService.new SleepTokenAcquirerImpl(KEYGUARD_SLEEP_TOKEN_TAG); + mSleepTokenAcquirer = mService.new SleepTokenAcquirer(KEYGUARD_SLEEP_TOKEN_TAG); } void setWindowManager(WindowManagerService windowManager) { @@ -658,10 +658,10 @@ class KeyguardController { private boolean mRequestDismissKeyguard; private final ActivityTaskManagerService mService; - private final ActivityTaskManagerInternal.SleepTokenAcquirer mSleepTokenAcquirer; + private final ActivityTaskManagerService.SleepTokenAcquirer mSleepTokenAcquirer; KeyguardDisplayState(ActivityTaskManagerService service, int displayId, - ActivityTaskManagerInternal.SleepTokenAcquirer acquirer) { + ActivityTaskManagerService.SleepTokenAcquirer acquirer) { mService = service; mDisplayId = displayId; mSleepTokenAcquirer = acquirer; diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 866dcd56ea91..8f5612c61e1c 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -215,7 +215,7 @@ class RootWindowContainer extends WindowContainer private static final String DISPLAY_OFF_SLEEP_TOKEN_TAG = "Display-off"; /** The token acquirer to put root tasks on the displays to sleep */ - final ActivityTaskManagerInternal.SleepTokenAcquirer mDisplayOffTokenAcquirer; + final ActivityTaskManagerService.SleepTokenAcquirer mDisplayOffTokenAcquirer; /** * The modes which affect which tasks are returned when calling @@ -450,7 +450,7 @@ class RootWindowContainer extends WindowContainer mService = service.mAtmService; mTaskSupervisor = mService.mTaskSupervisor; mTaskSupervisor.mRootWindowContainer = this; - mDisplayOffTokenAcquirer = mService.new SleepTokenAcquirerImpl(DISPLAY_OFF_SLEEP_TOKEN_TAG); + mDisplayOffTokenAcquirer = mService.new SleepTokenAcquirer(DISPLAY_OFF_SLEEP_TOKEN_TAG); mDeviceStateController = new DeviceStateController(service.mContext, service.mGlobalLock); mDisplayRotationCoordinator = new DisplayRotationCoordinator(); } diff --git a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerTests.java b/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerTests.java index 07934ea90b7e..aa776a3de427 100644 --- a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerTests.java +++ b/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerTests.java @@ -42,7 +42,6 @@ import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.clearInvocations; import android.app.ActivityManager; import android.app.AppOpsManager; @@ -135,15 +134,13 @@ public class PhoneWindowManagerTests { doNothing().when(mPhoneWindowManager).initializeHdmiState(); final boolean[] isScreenTurnedOff = { false }; final DisplayPolicy displayPolicy = mock(DisplayPolicy.class); - doAnswer(invocation -> isScreenTurnedOff[0] = true).when(displayPolicy).screenTurnedOff(); + doAnswer(invocation -> isScreenTurnedOff[0] = true).when(displayPolicy).screenTurnedOff( + anyBoolean()); doAnswer(invocation -> !isScreenTurnedOff[0]).when(displayPolicy).isScreenOnEarly(); doAnswer(invocation -> !isScreenTurnedOff[0]).when(displayPolicy).isScreenOnFully(); mPhoneWindowManager.mDefaultDisplayPolicy = displayPolicy; mPhoneWindowManager.mDefaultDisplayRotation = mock(DisplayRotation.class); - final ActivityTaskManagerInternal.SleepTokenAcquirer tokenAcquirer = - mock(ActivityTaskManagerInternal.SleepTokenAcquirer.class); - doReturn(tokenAcquirer).when(mAtmInternal).createSleepTokenAcquirer(anyString()); final PowerManager pm = mock(PowerManager.class); doReturn(true).when(pm).isInteractive(); doReturn(pm).when(mContext).getSystemService(eq(Context.POWER_SERVICE)); @@ -155,9 +152,8 @@ public class PhoneWindowManagerTests { assertThat(mPhoneWindowManager.mIsGoingToSleepDefaultDisplay).isFalse(); // Skip sleep-token for non-sleep-screen-off. - clearInvocations(tokenAcquirer); mPhoneWindowManager.screenTurnedOff(DEFAULT_DISPLAY, true /* isSwappingDisplay */); - verify(tokenAcquirer, never()).acquire(anyInt()); + verify(displayPolicy).screenTurnedOff(false /* acquireSleepToken */); assertThat(isScreenTurnedOff[0]).isTrue(); // Apply sleep-token for sleep-screen-off. @@ -165,21 +161,10 @@ public class PhoneWindowManagerTests { mPhoneWindowManager.startedGoingToSleep(DEFAULT_DISPLAY, 0 /* reason */); assertThat(mPhoneWindowManager.mIsGoingToSleepDefaultDisplay).isTrue(); mPhoneWindowManager.screenTurnedOff(DEFAULT_DISPLAY, true /* isSwappingDisplay */); - verify(tokenAcquirer).acquire(eq(DEFAULT_DISPLAY)); + verify(displayPolicy).screenTurnedOff(true /* acquireSleepToken */); mPhoneWindowManager.finishedGoingToSleep(DEFAULT_DISPLAY, 0 /* reason */); assertThat(mPhoneWindowManager.mIsGoingToSleepDefaultDisplay).isFalse(); - - // Simulate unexpected reversed order: screenTurnedOff -> startedGoingToSleep. The sleep - // token can still be acquired. - isScreenTurnedOff[0] = false; - clearInvocations(tokenAcquirer); - mPhoneWindowManager.screenTurnedOff(DEFAULT_DISPLAY, true /* isSwappingDisplay */); - verify(tokenAcquirer, never()).acquire(anyInt()); - assertThat(displayPolicy.isScreenOnEarly()).isFalse(); - assertThat(displayPolicy.isScreenOnFully()).isFalse(); - mPhoneWindowManager.startedGoingToSleep(DEFAULT_DISPLAY, 0 /* reason */); - verify(tokenAcquirer).acquire(eq(DEFAULT_DISPLAY)); } @Test diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java index 1e035dab3c5e..e2e76d6ef4e5 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java @@ -3231,7 +3231,7 @@ public class ActivityRecordTests extends WindowTestsBase { mDisplayContent.mOpeningApps.remove(activity); mDisplayContent.mClosingApps.remove(activity); activity.commitVisibility(false /* visible */, false /* performLayout */); - mDisplayContent.getDisplayPolicy().screenTurnedOff(); + mDisplayContent.getDisplayPolicy().screenTurnedOff(false /* acquireSleepToken */); final KeyguardController controller = mSupervisor.getKeyguardController(); doReturn(true).when(controller).isKeyguardGoingAway(anyInt()); activity.setVisibility(true); diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java index caeb41c78967..f32a234f3e40 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java @@ -284,11 +284,11 @@ public class DisplayPolicyTests extends WindowTestsBase { final DisplayPolicy policy = mDisplayContent.getDisplayPolicy(); policy.addWindowLw(mNotificationShadeWindow, mNotificationShadeWindow.mAttrs); - policy.screenTurnedOff(); + policy.screenTurnedOff(false /* acquireSleepToken */); policy.setAwake(false); policy.screenTurningOn(null /* screenOnListener */); assertTrue(wpc.isShowingUiWhileDozing()); - policy.screenTurnedOff(); + policy.screenTurnedOff(false /* acquireSleepToken */); assertFalse(wpc.isShowingUiWhileDozing()); policy.screenTurningOn(null /* screenOnListener */); @@ -393,7 +393,7 @@ public class DisplayPolicyTests extends WindowTestsBase { info.logicalWidth, info.logicalHeight).mConfigFrame); // If screen is not fully turned on, then the cache should be preserved. - displayPolicy.screenTurnedOff(); + displayPolicy.screenTurnedOff(false /* acquireSleepToken */); final TransitionController transitionController = mDisplayContent.mTransitionController; spyOn(transitionController); doReturn(true).when(transitionController).isCollecting(); diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java index cc1805aa933c..fd959b950e16 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java @@ -242,7 +242,7 @@ public class TaskFragmentTest extends WindowTestsBase { final Rect relStartBounds = new Rect(mTaskFragment.getRelativeEmbeddedBounds()); final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy(); - displayPolicy.screenTurnedOff(); + displayPolicy.screenTurnedOff(false /* acquireSleepToken */); assertFalse(mTaskFragment.okToAnimate()); -- GitLab From 959e0337a6def3e63738cfee0f158e53dc1de132 Mon Sep 17 00:00:00 2001 From: Louis Chang Date: Mon, 26 Aug 2024 04:16:29 +0000 Subject: [PATCH 052/492] Reconstruct the containers from the saved state This needs to be done after the embedding rules are set, because the SplitContainers are unable to be completely restored before knowing the SplitRule. Also gets and updates the latest TFInfo and TFParentInfo from the system. Bug: 289875940 Test: wm presubmit Flag: com.android.window.flags.ae_back_stack_restore Change-Id: Iaac580e0512939b0131dfa39c2588723360651ae --- .../android/window/TaskFragmentOrganizer.java | 17 +++ .../extensions/embedding/BackupHelper.java | 121 ++++++++++++++++-- .../ParcelableSplitContainerData.java | 4 +- .../ParcelableTaskContainerData.java | 9 ++ .../extensions/embedding/SplitContainer.java | 19 +++ .../extensions/embedding/SplitController.java | 26 ++++ .../extensions/embedding/SplitPresenter.java | 14 +- .../extensions/embedding/TaskContainer.java | 18 ++- .../wm/TaskFragmentOrganizerController.java | 33 ++++- 9 files changed, 240 insertions(+), 21 deletions(-) diff --git a/core/java/android/window/TaskFragmentOrganizer.java b/core/java/android/window/TaskFragmentOrganizer.java index 4cc0d8a77a2b..c316800108bd 100644 --- a/core/java/android/window/TaskFragmentOrganizer.java +++ b/core/java/android/window/TaskFragmentOrganizer.java @@ -68,6 +68,23 @@ public class TaskFragmentOrganizer extends WindowOrganizer { */ public static final String KEY_ERROR_CALLBACK_OP_TYPE = "operation_type"; + /** + * Key to bundle {@link TaskFragmentInfo}s from the system in + * {@link #registerOrganizer(boolean, Bundle)} + * + * @hide + */ + public static final String KEY_RESTORE_TASK_FRAGMENTS_INFO = "key_restore_task_fragments_info"; + + /** + * Key to bundle {@link TaskFragmentParentInfo} from the system in + * {@link #registerOrganizer(boolean, Bundle)} + * + * @hide + */ + public static final String KEY_RESTORE_TASK_FRAGMENT_PARENT_INFO = + "key_restore_task_fragment_parent_info"; + /** * No change set. */ diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/BackupHelper.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/BackupHelper.java index 4ce294213526..bfccb29bc952 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/BackupHelper.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/BackupHelper.java @@ -16,16 +16,26 @@ package androidx.window.extensions.embedding; +import static android.window.TaskFragmentOrganizer.KEY_RESTORE_TASK_FRAGMENTS_INFO; +import static android.window.TaskFragmentOrganizer.KEY_RESTORE_TASK_FRAGMENT_PARENT_INFO; + import android.os.Build; import android.os.Bundle; +import android.os.IBinder; import android.os.Looper; import android.os.MessageQueue; +import android.util.ArrayMap; import android.util.Log; +import android.util.SparseArray; +import android.window.TaskFragmentInfo; +import android.window.TaskFragmentParentInfo; +import android.window.WindowContainerTransaction; import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.List; +import java.util.Set; /** * Helper class to back up and restore the TaskFragmentOrganizer state, in order to resume @@ -40,11 +50,21 @@ class BackupHelper { @NonNull private final SplitController mController; @NonNull + private final SplitPresenter mPresenter; + @NonNull private final BackupIdler mBackupIdler = new BackupIdler(); private boolean mBackupIdlerScheduled; - BackupHelper(@NonNull SplitController splitController, @NonNull Bundle savedState) { + private final List mParcelableTaskContainerDataList = + new ArrayList<>(); + private final ArrayMap mTaskFragmentInfos = new ArrayMap<>(); + private final SparseArray mTaskFragmentParentInfos = + new SparseArray<>(); + + BackupHelper(@NonNull SplitController splitController, @NonNull SplitPresenter splitPresenter, + @NonNull Bundle savedState) { mController = splitController; + mPresenter = splitPresenter; if (!savedState.isEmpty()) { restoreState(savedState); @@ -67,13 +87,13 @@ class BackupHelper { public boolean queueIdle() { synchronized (mController.mLock) { mBackupIdlerScheduled = false; - startBackup(); + saveState(); } return false; } } - private void startBackup() { + private void saveState() { final List taskContainers = mController.getTaskContainers(); if (taskContainers.isEmpty()) { Log.w(TAG, "No task-container to back up"); @@ -97,13 +117,92 @@ class BackupHelper { return; } - final List parcelableTaskContainerDataList = - savedState.getParcelableArrayList(KEY_TASK_CONTAINERS, - ParcelableTaskContainerData.class); - for (ParcelableTaskContainerData data : parcelableTaskContainerDataList) { - final TaskContainer taskContainer = new TaskContainer(data, mController); - if (DEBUG) Log.d(TAG, "Restoring task " + taskContainer.getTaskId()); - // TODO(b/289875940): implement the TaskContainer restoration. + if (DEBUG) Log.d(TAG, "Start restoring saved-state"); + mParcelableTaskContainerDataList.addAll(savedState.getParcelableArrayList( + KEY_TASK_CONTAINERS, ParcelableTaskContainerData.class)); + if (DEBUG) Log.d(TAG, "Retrieved tasks : " + mParcelableTaskContainerDataList.size()); + if (mParcelableTaskContainerDataList.isEmpty()) { + return; + } + + final List infos = savedState.getParcelableArrayList( + KEY_RESTORE_TASK_FRAGMENTS_INFO, TaskFragmentInfo.class); + for (TaskFragmentInfo info : infos) { + if (DEBUG) Log.d(TAG, "Retrieved: " + info); + mTaskFragmentInfos.put(info.getFragmentToken(), info); + mPresenter.updateTaskFragmentInfo(info); + } + + final List parentInfos = savedState.getParcelableArrayList( + KEY_RESTORE_TASK_FRAGMENT_PARENT_INFO, + TaskFragmentParentInfo.class); + for (TaskFragmentParentInfo info : parentInfos) { + if (DEBUG) Log.d(TAG, "Retrieved: " + info); + mTaskFragmentParentInfos.put(info.getTaskId(), info); + } + } + + boolean hasPendingStateToRestore() { + return !mParcelableTaskContainerDataList.isEmpty(); + } + + /** + * Returns {@code true} if any of the {@link TaskContainer} is restored. + * Otherwise, returns {@code false}. + */ + boolean rebuildTaskContainers(@NonNull WindowContainerTransaction wct, + @NonNull Set rules) { + if (mParcelableTaskContainerDataList.isEmpty()) { + return false; + } + + if (DEBUG) Log.d(TAG, "Rebuilding TaskContainers."); + final ArrayMap embeddingRuleMap = new ArrayMap<>(); + for (EmbeddingRule rule : rules) { + embeddingRuleMap.put(rule.getTag(), rule); + } + + boolean restoredAny = false; + for (int i = mParcelableTaskContainerDataList.size() - 1; i >= 0; i--) { + final ParcelableTaskContainerData parcelableTaskContainerData = + mParcelableTaskContainerDataList.get(i); + final List tags = parcelableTaskContainerData.getSplitRuleTags(); + if (!embeddingRuleMap.containsAll(tags)) { + // has unknown tag, unable to restore. + if (DEBUG) { + Log.d(TAG, "Rebuilding TaskContainer abort! Unknown Tag. Task#" + + parcelableTaskContainerData.mTaskId); + } + continue; + } + + mParcelableTaskContainerDataList.remove(parcelableTaskContainerData); + final TaskContainer taskContainer = new TaskContainer(parcelableTaskContainerData, + mController, mTaskFragmentInfos); + if (DEBUG) Log.d(TAG, "Created TaskContainer " + taskContainer); + mController.addTaskContainer(taskContainer.getTaskId(), taskContainer); + + for (ParcelableSplitContainerData splitData : + parcelableTaskContainerData.getParcelableSplitContainerDataList()) { + final SplitRule rule = (SplitRule) embeddingRuleMap.get(splitData.mSplitRuleTag); + assert rule != null; + if (mController.getContainer(splitData.getPrimaryContainerToken()) != null + && mController.getContainer(splitData.getSecondaryContainerToken()) + != null) { + taskContainer.addSplitContainer( + new SplitContainer(splitData, mController, rule)); + } + } + + mController.onTaskFragmentParentRestored(wct, taskContainer.getTaskId(), + mTaskFragmentParentInfos.get(taskContainer.getTaskId())); + restoredAny = true; + } + + if (mParcelableTaskContainerDataList.isEmpty()) { + mTaskFragmentParentInfos.clear(); + mTaskFragmentInfos.clear(); } + return restoredAny; } -} +} \ No newline at end of file diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableSplitContainerData.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableSplitContainerData.java index 817cfce69b2e..cb280c530c1b 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableSplitContainerData.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableSplitContainerData.java @@ -89,13 +89,13 @@ class ParcelableSplitContainerData implements Parcelable { }; @NonNull - private IBinder getPrimaryContainerToken() { + IBinder getPrimaryContainerToken() { return mSplitContainer != null ? mSplitContainer.getPrimaryContainer().getToken() : mPrimaryContainerToken; } @NonNull - private IBinder getSecondaryContainerToken() { + IBinder getSecondaryContainerToken() { return mSplitContainer != null ? mSplitContainer.getSecondaryContainer().getToken() : mSecondaryContainerToken; } diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableTaskContainerData.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableTaskContainerData.java index 7377d005cda4..97aa69985907 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableTaskContainerData.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableTaskContainerData.java @@ -108,6 +108,15 @@ class ParcelableTaskContainerData implements Parcelable { : mParcelableSplitContainerDataList; } + @NonNull + List getSplitRuleTags() { + final List tags = new ArrayList<>(); + for (ParcelableSplitContainerData data : getParcelableSplitContainerDataList()) { + tags.add(data.mSplitRuleTag); + } + return tags; + } + @Override public int describeContents() { return 0; diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitContainer.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitContainer.java index 6d436ec01d98..faf73c24073f 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitContainer.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitContainer.java @@ -86,6 +86,25 @@ class SplitContainer { } } + /** This is only used when restoring it from a {@link ParcelableSplitContainerData}. */ + SplitContainer(@NonNull ParcelableSplitContainerData parcelableData, + @NonNull SplitController splitController, @NonNull SplitRule splitRule) { + mParcelableData = parcelableData; + mPrimaryContainer = splitController.getContainer(parcelableData.getPrimaryContainerToken()); + mSecondaryContainer = splitController.getContainer( + parcelableData.getSecondaryContainerToken()); + mSplitRule = splitRule; + mDefaultSplitAttributes = splitRule.getDefaultSplitAttributes(); + mCurrentSplitAttributes = mDefaultSplitAttributes; + + if (shouldFinishPrimaryWithSecondary(splitRule)) { + mSecondaryContainer.addContainerToFinishOnExit(mPrimaryContainer); + } + if (shouldFinishSecondaryWithPrimary(splitRule)) { + mPrimaryContainer.addContainerToFinishOnExit(mSecondaryContainer); + } + } + void setPrimaryContainer(@NonNull TaskFragmentContainer primaryContainer) { if (!mParcelableData.mIsPrimaryContainerMutable) { throw new IllegalStateException("Cannot update primary TaskFragmentContainer"); diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java index f2f2b7ea7174..db4bb0e5e75e 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java @@ -279,6 +279,26 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen Log.i(TAG, "Setting embedding rules. Size: " + rules.size()); mSplitRules.clear(); mSplitRules.addAll(rules); + + if (!Flags.aeBackStackRestore() || !mPresenter.isRebuildTaskContainersNeeded()) { + return; + } + + try { + final TransactionRecord transactionRecord = + mTransactionManager.startNewTransaction(); + final WindowContainerTransaction wct = transactionRecord.getTransaction(); + if (mPresenter.rebuildTaskContainers(wct, rules)) { + transactionRecord.apply(false /* shouldApplyIndependently */); + updateCallbackIfNecessary(); + } else { + transactionRecord.abort(); + } + } catch (IllegalStateException ex) { + Log.e(TAG, "Having an existing transaction while running restoration with" + + "new rules!! It is likely too late to perform the restoration " + + "already!?", ex); + } } } @@ -902,6 +922,12 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen updateContainersInTask(wct, taskContainer); } + @GuardedBy("mLock") + void onTaskFragmentParentRestored(@NonNull WindowContainerTransaction wct, int taskId, + @NonNull TaskFragmentParentInfo parentInfo) { + onTaskFragmentParentInfoChanged(wct, taskId, parentInfo); + } + @GuardedBy("mLock") void updateContainersInTaskIfVisible(@NonNull WindowContainerTransaction wct, int taskId) { final TaskContainer taskContainer = getTaskContainer(taskId); diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitPresenter.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitPresenter.java index abc7b291fc32..0c0ded9bad74 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitPresenter.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitPresenter.java @@ -24,6 +24,7 @@ import static androidx.window.extensions.embedding.SplitController.TAG; import static androidx.window.extensions.embedding.WindowAttributes.DIM_AREA_ON_TASK; import android.annotation.AnimRes; +import android.annotation.NonNull; import android.app.Activity; import android.app.ActivityThread; import android.app.WindowConfiguration; @@ -47,7 +48,6 @@ import android.window.TaskFragmentCreationParams; import android.window.WindowContainerTransaction; import androidx.annotation.IntDef; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.window.extensions.core.util.function.Function; import androidx.window.extensions.embedding.SplitAttributes.SplitType; @@ -67,6 +67,7 @@ import com.android.window.flags.Flags; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Set; import java.util.concurrent.Executor; /** @@ -174,7 +175,7 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer { } else { registerOrganizer(); } - mBackupHelper = new BackupHelper(controller, outSavedState); + mBackupHelper = new BackupHelper(controller, this, outSavedState); if (!SplitController.ENABLE_SHELL_TRANSITIONS) { // TODO(b/207070762): cleanup with legacy app transition // Animation will be handled by WM Shell when Shell transition is enabled. @@ -186,6 +187,15 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer { mBackupHelper.scheduleBackup(); } + boolean isRebuildTaskContainersNeeded() { + return mBackupHelper.hasPendingStateToRestore(); + } + + boolean rebuildTaskContainers(@NonNull WindowContainerTransaction wct, + @NonNull Set rules) { + return mBackupHelper.rebuildTaskContainers(wct, rules); + } + /** * Deletes the specified container and all other associated and dependent containers in the same * transaction. diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java index 608a3bee7509..74cce68f270b 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java @@ -31,6 +31,7 @@ import android.app.WindowConfiguration.WindowingMode; import android.content.res.Configuration; import android.graphics.Rect; import android.os.IBinder; +import android.util.ArrayMap; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.Log; @@ -147,14 +148,23 @@ class TaskContainer { /** This is only used when restoring it from a {@link ParcelableTaskContainerData}. */ TaskContainer(@NonNull ParcelableTaskContainerData data, - @NonNull SplitController splitController) { + @NonNull SplitController splitController, + @NonNull ArrayMap taskFragmentInfoMap) { mParcelableTaskContainerData = new ParcelableTaskContainerData(data, this); + mInfo = new TaskFragmentParentInfo(new Configuration(), 0 /* displayId */, -1 /* taskId */, + false /* visible */, false /* hasDirectActivity */, null /* decorSurface */); mSplitController = splitController; for (ParcelableTaskFragmentContainerData tfData : data.getParcelableTaskFragmentContainerDataList()) { - final TaskFragmentContainer container = - new TaskFragmentContainer(tfData, splitController, this); - mContainers.add(container); + final TaskFragmentInfo info = taskFragmentInfoMap.get(tfData.mToken); + if (info != null && !info.isEmpty()) { + final TaskFragmentContainer container = + new TaskFragmentContainer(tfData, splitController, this); + container.setInfo(new WindowContainerTransaction(), info); + mContainers.add(container); + } else { + Log.d(TAG, "Drop " + tfData + " while restoring Task " + data.mTaskId); + } } } diff --git a/services/core/java/com/android/server/wm/TaskFragmentOrganizerController.java b/services/core/java/com/android/server/wm/TaskFragmentOrganizerController.java index 5aa34d22f00f..92953e5a5041 100644 --- a/services/core/java/com/android/server/wm/TaskFragmentOrganizerController.java +++ b/services/core/java/com/android/server/wm/TaskFragmentOrganizerController.java @@ -17,6 +17,8 @@ package com.android.server.wm; import static android.app.ActivityTaskManager.INVALID_TASK_ID; +import static android.window.TaskFragmentOrganizer.KEY_RESTORE_TASK_FRAGMENTS_INFO; +import static android.window.TaskFragmentOrganizer.KEY_RESTORE_TASK_FRAGMENT_PARENT_INFO; import static android.window.TaskFragmentOrganizer.putErrorInfoInBundle; import static android.window.TaskFragmentTransaction.TYPE_ACTIVITY_REPARENTED_TO_TASK; import static android.window.TaskFragmentTransaction.TYPE_TASK_FRAGMENT_APPEARED; @@ -206,7 +208,13 @@ public class TaskFragmentOrganizerController extends ITaskFragmentOrganizerContr mOrganizerPid = pid; mAppThread = getAppThread(pid, mOrganizerUid); for (int i = mOrganizedTaskFragments.size() - 1; i >= 0; i--) { - mOrganizedTaskFragments.get(i).onTaskFragmentOrganizerRestarted(organizer); + final TaskFragment taskFragment = mOrganizedTaskFragments.get(i); + if (taskFragment.isAttached() + && taskFragment.getTopNonFinishingActivity() != null) { + taskFragment.onTaskFragmentOrganizerRestarted(organizer); + } else { + mOrganizedTaskFragments.remove(taskFragment); + } } try { mOrganizer.asBinder().linkToDeath(this, 0 /*flags*/); @@ -575,8 +583,29 @@ public class TaskFragmentOrganizerController extends ITaskFragmentOrganizerContr } mCachedTaskFragmentOrganizerStates.remove(cachedState); - outSavedState.putAll(cachedState.mSavedState); cachedState.restore(organizer, pid); + outSavedState.putAll(cachedState.mSavedState); + + // Collect the organized TfInfo and TfParentInfo in the system. + final ArrayList infos = new ArrayList<>(); + final ArrayMap tasks = new ArrayMap<>(); + final int fragmentCount = cachedState.mOrganizedTaskFragments.size(); + for (int j = 0; j < fragmentCount; j++) { + final TaskFragment tf = cachedState.mOrganizedTaskFragments.get(j); + infos.add(tf.getTaskFragmentInfo()); + if (!tasks.containsKey(tf.getTask().mTaskId)) { + tasks.put(tf.getTask().mTaskId, tf.getTask()); + } + } + outSavedState.putParcelableArrayList(KEY_RESTORE_TASK_FRAGMENTS_INFO, infos); + + final ArrayList parentInfos = new ArrayList<>(); + for (int j = tasks.size() - 1; j >= 0; j--) { + parentInfos.add(tasks.valueAt(j).getTaskFragmentParentInfo()); + } + outSavedState.putParcelableArrayList(KEY_RESTORE_TASK_FRAGMENT_PARENT_INFO, + parentInfos); + mTaskFragmentOrganizerState.put(organizer.asBinder(), cachedState); mPendingTaskFragmentEvents.put(organizer.asBinder(), new ArrayList<>()); return true; -- GitLab From 60c4ffb1dcce3a76de9d58ca9f8b6e3bc3e3dd94 Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Fri, 6 Sep 2024 06:53:46 +0000 Subject: [PATCH 053/492] Give AppZygote process shared app GID. So AppZygote can access profiles belonging to the app. Bug: 254422654 Flag: EXEMPT bugfix Test: inspect /proc/pid/maps to verify profiles are loaded Change-Id: Ibf0f43accff687bfe172796086124f77eeca574d --- core/java/android/os/AppZygote.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/os/AppZygote.java b/core/java/android/os/AppZygote.java index 07fbe4a04ff1..0541a96e990e 100644 --- a/core/java/android/os/AppZygote.java +++ b/core/java/android/os/AppZygote.java @@ -111,12 +111,15 @@ public class AppZygote { try { int runtimeFlags = Zygote.getMemorySafetyRuntimeFlagsForSecondaryZygote( mAppInfo, mProcessInfo); + + final int[] sharedAppGid = { + UserHandle.getSharedAppGid(UserHandle.getAppId(mAppInfo.uid)) }; mZygote = Process.ZYGOTE_PROCESS.startChildZygote( "com.android.internal.os.AppZygoteInit", mAppInfo.processName + "_zygote", mZygoteUid, mZygoteUid, - null, // gids + sharedAppGid, // Zygote gets access to shared app GID for profiles runtimeFlags, "app_zygote", // seInfo abi, // abi -- GitLab From 348c82a91614e161b39849c7fb4632c315da56df Mon Sep 17 00:00:00 2001 From: Ankita Vyas Date: Thu, 22 Aug 2024 08:48:54 +0000 Subject: [PATCH 054/492] Add new framework-photopicker inside MediaProvider module Bug: 359548801 Test: presubmit and m framework-photopicker Change-Id: I0429bb576f6cfc80c45debcc6ba4fe1851e9b99e Merged-In: I0429bb576f6cfc80c45debcc6ba4fe1851e9b99e --- api/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/api/Android.bp b/api/Android.bp index d9966fd87ac3..e5fd5e452fdc 100644 --- a/api/Android.bp +++ b/api/Android.bp @@ -87,6 +87,7 @@ combined_apis { "framework-permission", "framework-permission-s", "framework-profiling", + "framework-photopicker", "framework-scheduling", "framework-sdkextensions", "framework-statsd", -- GitLab From 18375b1bdf1e0bdd6ba54f1710486d90c44ea619 Mon Sep 17 00:00:00 2001 From: Anton Potapov Date: Tue, 3 Sep 2024 20:21:42 +0100 Subject: [PATCH 055/492] Refactor CaptioningRepository to take current UserHandle into account. CaptioningRepository now uses `createContextAsUser` to get a CaptioningManager for current user. Flag: EXEMPT BUGFIX Fixes: 361042246 Test: atest VolumePanelScreenshotTest Test: atest CaptioningViewModelTest Change-Id: I32cec55231db16bc3b7401716326b8b8f2a631d7 --- .../repository/CaptioningRepositoryTest.kt | 52 ++++---- .../data/model/CaptioningModel.kt | 22 +++ .../data/repository/CaptioningRepository.kt | 126 ++++++++---------- .../domain/interactor/CaptioningInteractor.kt | 20 ++- .../dagger/FrameworkServicesModule.java | 7 + .../volume/dagger/CaptioningModule.kt | 27 +--- .../domain/CaptioningAvailabilityCriteria.kt | 4 +- .../repository/FakeCaptioningRepository.kt | 26 ++-- .../user/utils/FakeUserScopedService.kt | 33 +++++ 9 files changed, 183 insertions(+), 134 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/accessibility/data/model/CaptioningModel.kt create mode 100644 packages/SystemUI/tests/utils/src/com/android/systemui/user/utils/FakeUserScopedService.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/CaptioningRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/CaptioningRepositoryTest.kt index dd85d9bd2d7c..fc57757c9a8c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/CaptioningRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/CaptioningRepositoryTest.kt @@ -20,11 +20,15 @@ import android.view.accessibility.CaptioningManager import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase +import com.android.systemui.coroutines.collectValues +import com.android.systemui.kosmos.applicationCoroutineScope +import com.android.systemui.kosmos.testScope +import com.android.systemui.testKosmos +import com.android.systemui.user.data.repository.userRepository +import com.android.systemui.user.utils.FakeUserScopedService import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.flow.launchIn -import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -39,10 +43,11 @@ import org.mockito.MockitoAnnotations @OptIn(ExperimentalCoroutinesApi::class) @SmallTest -@Suppress("UnspecifiedRegisterReceiverFlag") @RunWith(AndroidJUnit4::class) class CaptioningRepositoryTest : SysuiTestCase() { + private val kosmos = testKosmos() + @Captor private lateinit var listenerCaptor: ArgumentCaptor @@ -50,34 +55,33 @@ class CaptioningRepositoryTest : SysuiTestCase() { private lateinit var underTest: CaptioningRepository - private val testScope = TestScope() - @Before fun setup() { MockitoAnnotations.initMocks(this) underTest = - CaptioningRepositoryImpl( - captioningManager, - testScope.testScheduler, - testScope.backgroundScope - ) + with(kosmos) { + CaptioningRepositoryImpl( + FakeUserScopedService(captioningManager), + userRepository, + testScope.testScheduler, + applicationCoroutineScope, + ) + } } @Test fun isSystemAudioCaptioningEnabled_change_repositoryEmits() { - testScope.runTest { - `when`(captioningManager.isEnabled).thenReturn(false) - val isSystemAudioCaptioningEnabled = mutableListOf() - underTest.isSystemAudioCaptioningEnabled - .onEach { isSystemAudioCaptioningEnabled.add(it) } - .launchIn(backgroundScope) + kosmos.testScope.runTest { + `when`(captioningManager.isSystemAudioCaptioningEnabled).thenReturn(false) + val models by collectValues(underTest.captioningModel.filterNotNull()) runCurrent() + `when`(captioningManager.isSystemAudioCaptioningEnabled).thenReturn(true) triggerOnSystemAudioCaptioningChange() runCurrent() - assertThat(isSystemAudioCaptioningEnabled) + assertThat(models.map { it.isSystemAudioCaptioningEnabled }) .containsExactlyElementsIn(listOf(false, true)) .inOrder() } @@ -85,18 +89,16 @@ class CaptioningRepositoryTest : SysuiTestCase() { @Test fun isSystemAudioCaptioningUiEnabled_change_repositoryEmits() { - testScope.runTest { - `when`(captioningManager.isSystemAudioCaptioningUiEnabled).thenReturn(false) - val isSystemAudioCaptioningUiEnabled = mutableListOf() - underTest.isSystemAudioCaptioningUiEnabled - .onEach { isSystemAudioCaptioningUiEnabled.add(it) } - .launchIn(backgroundScope) + kosmos.testScope.runTest { + `when`(captioningManager.isEnabled).thenReturn(false) + val models by collectValues(underTest.captioningModel.filterNotNull()) runCurrent() + `when`(captioningManager.isSystemAudioCaptioningUiEnabled).thenReturn(true) triggerSystemAudioCaptioningUiChange() runCurrent() - assertThat(isSystemAudioCaptioningUiEnabled) + assertThat(models.map { it.isSystemAudioCaptioningUiEnabled }) .containsExactlyElementsIn(listOf(false, true)) .inOrder() } diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/data/model/CaptioningModel.kt b/packages/SystemUI/src/com/android/systemui/accessibility/data/model/CaptioningModel.kt new file mode 100644 index 000000000000..4eb2274cf129 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/accessibility/data/model/CaptioningModel.kt @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.accessibility.data.model + +data class CaptioningModel( + val isSystemAudioCaptioningUiEnabled: Boolean, + val isSystemAudioCaptioningEnabled: Boolean, +) diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/data/repository/CaptioningRepository.kt b/packages/SystemUI/src/com/android/systemui/accessibility/data/repository/CaptioningRepository.kt index bf749d4cfc35..5414b623ff97 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/data/repository/CaptioningRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/accessibility/data/repository/CaptioningRepository.kt @@ -16,98 +16,90 @@ package com.android.systemui.accessibility.data.repository +import android.annotation.SuppressLint import android.view.accessibility.CaptioningManager +import com.android.systemui.accessibility.data.model.CaptioningModel +import com.android.systemui.dagger.qualifiers.Application +import com.android.systemui.dagger.qualifiers.Background +import com.android.systemui.user.data.repository.UserRepository +import com.android.systemui.user.utils.UserScopedService +import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow +import javax.inject.Inject import kotlin.coroutines.CoroutineContext import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.channels.ProducerScope +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.awaitClose -import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.callbackFlow -import kotlinx.coroutines.flow.filterIsInstance +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.flatMapLatest +import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart -import kotlinx.coroutines.flow.shareIn import kotlinx.coroutines.flow.stateIn -import kotlinx.coroutines.launch import kotlinx.coroutines.withContext interface CaptioningRepository { - /** The system audio caption enabled state. */ - val isSystemAudioCaptioningEnabled: StateFlow + /** Current state of Live Captions. */ + val captioningModel: StateFlow - /** The system audio caption UI enabled state. */ - val isSystemAudioCaptioningUiEnabled: StateFlow - - /** Sets [isSystemAudioCaptioningEnabled]. */ + /** Sets [CaptioningModel.isSystemAudioCaptioningEnabled]. */ suspend fun setIsSystemAudioCaptioningEnabled(isEnabled: Boolean) } -class CaptioningRepositoryImpl( - private val captioningManager: CaptioningManager, - private val backgroundCoroutineContext: CoroutineContext, - coroutineScope: CoroutineScope, +@OptIn(ExperimentalCoroutinesApi::class) +class CaptioningRepositoryImpl +@Inject +constructor( + private val userScopedCaptioningManagerProvider: UserScopedService, + userRepository: UserRepository, + @Background private val backgroundCoroutineContext: CoroutineContext, + @Application coroutineScope: CoroutineScope, ) : CaptioningRepository { - private val captioningChanges: SharedFlow = - callbackFlow { - val listener = CaptioningChangeProducingListener(this) - captioningManager.addCaptioningChangeListener(listener) - awaitClose { captioningManager.removeCaptioningChangeListener(listener) } - } - .shareIn(coroutineScope, SharingStarted.WhileSubscribed(), replay = 0) - - override val isSystemAudioCaptioningEnabled: StateFlow = - captioningChanges - .filterIsInstance(CaptioningChange.IsSystemAudioCaptioningEnabled::class) - .map { it.isEnabled } - .onStart { emit(captioningManager.isSystemAudioCaptioningEnabled) } - .stateIn( - coroutineScope, - SharingStarted.WhileSubscribed(), - captioningManager.isSystemAudioCaptioningEnabled, - ) + @SuppressLint("NonInjectedService") // this uses user-aware context + private val captioningManager: StateFlow = + userRepository.selectedUser + .map { userScopedCaptioningManagerProvider.forUser(it.userInfo.userHandle) } + .stateIn(coroutineScope, SharingStarted.WhileSubscribed(), null) - override val isSystemAudioCaptioningUiEnabled: StateFlow = - captioningChanges - .filterIsInstance(CaptioningChange.IsSystemUICaptioningEnabled::class) - .map { it.isEnabled } - .onStart { emit(captioningManager.isSystemAudioCaptioningUiEnabled) } - .stateIn( - coroutineScope, - SharingStarted.WhileSubscribed(), - captioningManager.isSystemAudioCaptioningUiEnabled, - ) + override val captioningModel: StateFlow = + captioningManager + .filterNotNull() + .flatMapLatest { it.captioningModel() } + .stateIn(coroutineScope, SharingStarted.WhileSubscribed(), null) override suspend fun setIsSystemAudioCaptioningEnabled(isEnabled: Boolean) { withContext(backgroundCoroutineContext) { - captioningManager.isSystemAudioCaptioningEnabled = isEnabled + captioningManager.value?.isSystemAudioCaptioningEnabled = isEnabled } } - private sealed interface CaptioningChange { - - data class IsSystemAudioCaptioningEnabled(val isEnabled: Boolean) : CaptioningChange - - data class IsSystemUICaptioningEnabled(val isEnabled: Boolean) : CaptioningChange - } - - private class CaptioningChangeProducingListener( - private val scope: ProducerScope - ) : CaptioningManager.CaptioningChangeListener() { - - override fun onSystemAudioCaptioningChanged(enabled: Boolean) { - emitChange(CaptioningChange.IsSystemAudioCaptioningEnabled(enabled)) - } - - override fun onSystemAudioCaptioningUiChanged(enabled: Boolean) { - emitChange(CaptioningChange.IsSystemUICaptioningEnabled(enabled)) - } - - private fun emitChange(change: CaptioningChange) { - scope.launch { scope.send(change) } - } + private fun CaptioningManager.captioningModel(): Flow { + return conflatedCallbackFlow { + val listener = + object : CaptioningManager.CaptioningChangeListener() { + + override fun onSystemAudioCaptioningChanged(enabled: Boolean) { + trySend(Unit) + } + + override fun onSystemAudioCaptioningUiChanged(enabled: Boolean) { + trySend(Unit) + } + } + addCaptioningChangeListener(listener) + awaitClose { removeCaptioningChangeListener(listener) } + } + .onStart { emit(Unit) } + .map { + CaptioningModel( + isSystemAudioCaptioningEnabled = isSystemAudioCaptioningEnabled, + isSystemAudioCaptioningUiEnabled = isSystemAudioCaptioningUiEnabled, + ) + } + .flowOn(backgroundCoroutineContext) } } diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/domain/interactor/CaptioningInteractor.kt b/packages/SystemUI/src/com/android/systemui/accessibility/domain/interactor/CaptioningInteractor.kt index 1d493c697652..840edf44ecf5 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/domain/interactor/CaptioningInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/accessibility/domain/interactor/CaptioningInteractor.kt @@ -17,16 +17,22 @@ package com.android.systemui.accessibility.domain.interactor import com.android.systemui.accessibility.data.repository.CaptioningRepository -import kotlinx.coroutines.flow.StateFlow +import com.android.systemui.dagger.SysUISingleton +import javax.inject.Inject +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map -class CaptioningInteractor(private val repository: CaptioningRepository) { +@SysUISingleton +class CaptioningInteractor @Inject constructor(private val repository: CaptioningRepository) { - val isSystemAudioCaptioningEnabled: StateFlow - get() = repository.isSystemAudioCaptioningEnabled + val isSystemAudioCaptioningEnabled: Flow = + repository.captioningModel.filterNotNull().map { it.isSystemAudioCaptioningEnabled } - val isSystemAudioCaptioningUiEnabled: StateFlow - get() = repository.isSystemAudioCaptioningUiEnabled + val isSystemAudioCaptioningUiEnabled: Flow = + repository.captioningModel.filterNotNull().map { it.isSystemAudioCaptioningUiEnabled } - suspend fun setIsSystemAudioCaptioningEnabled(enabled: Boolean) = + suspend fun setIsSystemAudioCaptioningEnabled(enabled: Boolean) { repository.setIsSystemAudioCaptioningEnabled(enabled) + } } diff --git a/packages/SystemUI/src/com/android/systemui/dagger/FrameworkServicesModule.java b/packages/SystemUI/src/com/android/systemui/dagger/FrameworkServicesModule.java index 21a704df074e..8818c3af4916 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/FrameworkServicesModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/FrameworkServicesModule.java @@ -202,6 +202,13 @@ public class FrameworkServicesModule { return context.getSystemService(CaptioningManager.class); } + @Provides + @Singleton + static UserScopedService provideUserScopedCaptioningManager( + Context context) { + return new UserScopedServiceImpl<>(context, CaptioningManager.class); + } + /** */ @Provides @Singleton diff --git a/packages/SystemUI/src/com/android/systemui/volume/dagger/CaptioningModule.kt b/packages/SystemUI/src/com/android/systemui/volume/dagger/CaptioningModule.kt index 9715772f089f..28a43df2bfb3 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dagger/CaptioningModule.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/dagger/CaptioningModule.kt @@ -16,35 +16,16 @@ package com.android.systemui.volume.dagger -import android.view.accessibility.CaptioningManager import com.android.systemui.accessibility.data.repository.CaptioningRepository import com.android.systemui.accessibility.data.repository.CaptioningRepositoryImpl -import com.android.systemui.accessibility.domain.interactor.CaptioningInteractor import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.dagger.qualifiers.Application -import com.android.systemui.dagger.qualifiers.Background +import dagger.Binds import dagger.Module -import dagger.Provides -import kotlin.coroutines.CoroutineContext -import kotlinx.coroutines.CoroutineScope @Module interface CaptioningModule { - companion object { - - @Provides - @SysUISingleton - fun provideCaptioningRepository( - captioningManager: CaptioningManager, - @Background coroutineContext: CoroutineContext, - @Application coroutineScope: CoroutineScope, - ): CaptioningRepository = - CaptioningRepositoryImpl(captioningManager, coroutineContext, coroutineScope) - - @Provides - @SysUISingleton - fun provideCaptioningInteractor(repository: CaptioningRepository): CaptioningInteractor = - CaptioningInteractor(repository) - } + @Binds + @SysUISingleton + fun bindCaptioningRepository(impl: CaptioningRepositoryImpl): CaptioningRepository } diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/component/captioning/domain/CaptioningAvailabilityCriteria.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/component/captioning/domain/CaptioningAvailabilityCriteria.kt index 52f2ce63ba21..2e5e389eba9c 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/component/captioning/domain/CaptioningAvailabilityCriteria.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/panel/component/captioning/domain/CaptioningAvailabilityCriteria.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.flow.shareIn +import kotlinx.coroutines.flow.stateIn @VolumePanelScope class CaptioningAvailabilityCriteria @@ -45,7 +45,7 @@ constructor( else VolumePanelUiEvent.VOLUME_PANEL_LIVE_CAPTION_TOGGLE_GONE ) } - .shareIn(scope, SharingStarted.WhileSubscribed(), replay = 1) + .stateIn(scope, SharingStarted.WhileSubscribed(), false) override fun isAvailable(): Flow = availability } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/accessibility/data/repository/FakeCaptioningRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/accessibility/data/repository/FakeCaptioningRepository.kt index 2a0e764279d6..a6394631d236 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/accessibility/data/repository/FakeCaptioningRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/accessibility/data/repository/FakeCaptioningRepository.kt @@ -16,25 +16,31 @@ package com.android.systemui.accessibility.data.repository +import com.android.systemui.accessibility.data.model.CaptioningModel import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow class FakeCaptioningRepository : CaptioningRepository { - private val mutableIsSystemAudioCaptioningEnabled = MutableStateFlow(false) - override val isSystemAudioCaptioningEnabled: StateFlow - get() = mutableIsSystemAudioCaptioningEnabled.asStateFlow() - - private val mutableIsSystemAudioCaptioningUiEnabled = MutableStateFlow(false) - override val isSystemAudioCaptioningUiEnabled: StateFlow - get() = mutableIsSystemAudioCaptioningUiEnabled.asStateFlow() + private val mutableCaptioningModel = MutableStateFlow(null) + override val captioningModel: StateFlow = mutableCaptioningModel.asStateFlow() override suspend fun setIsSystemAudioCaptioningEnabled(isEnabled: Boolean) { - mutableIsSystemAudioCaptioningEnabled.value = isEnabled + mutableCaptioningModel.value = + CaptioningModel( + isSystemAudioCaptioningEnabled = isEnabled, + isSystemAudioCaptioningUiEnabled = + mutableCaptioningModel.value?.isSystemAudioCaptioningUiEnabled == true, + ) } - fun setIsSystemAudioCaptioningUiEnabled(isSystemAudioCaptioningUiEnabled: Boolean) { - mutableIsSystemAudioCaptioningUiEnabled.value = isSystemAudioCaptioningUiEnabled + fun setIsSystemAudioCaptioningUiEnabled(isEnabled: Boolean) { + mutableCaptioningModel.value = + CaptioningModel( + isSystemAudioCaptioningEnabled = + mutableCaptioningModel.value?.isSystemAudioCaptioningEnabled == true, + isSystemAudioCaptioningUiEnabled = isEnabled, + ) } } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/user/utils/FakeUserScopedService.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/user/utils/FakeUserScopedService.kt new file mode 100644 index 000000000000..78763f97adc3 --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/user/utils/FakeUserScopedService.kt @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.user.utils + +import android.os.UserHandle + +class FakeUserScopedService(private val defaultImplementation: T) : UserScopedService { + + private val implementations = mutableMapOf() + + fun addImplementation(user: UserHandle, implementation: T) { + implementations[user] = implementation + } + + fun removeImplementation(user: UserHandle): T? = implementations.remove(user) + + override fun forUser(user: UserHandle): T = + implementations.getOrDefault(user, defaultImplementation) +} -- GitLab From 8b08ad09c014ea9ec162b857712f56144f57995c Mon Sep 17 00:00:00 2001 From: omarmt Date: Fri, 6 Sep 2024 11:52:31 +0000 Subject: [PATCH 056/492] SwipeAnimation.animateOffset() returns the consumed velocity It allows us to consume, even partially, the velocity during scrolling. Allowing other components to consume the remaining velocity. Before and after: b/336710600#comment24 Test: atest DraggableHandlerTest Bug: 336710600 Flag: com.android.systemui.scene_container Change-Id: If6b055f567ba308078227db92f36b17216b7f293 --- .../compose/animation/scene/DraggableHandler.kt | 16 ++++------------ .../compose/animation/scene/SwipeAnimation.kt | 12 ++++++++++-- .../animation/scene/DraggableHandlerTest.kt | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt index 24fef711d397..eed1a2e366ac 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt @@ -397,14 +397,8 @@ private class DragControllerImpl( return 0f } - fun animateTo(targetContent: T) { - swipeAnimation.animateOffset( - initialVelocity = velocity, - targetContent = targetContent, - ) - } - val fromContent = swipeAnimation.fromContent + val consumedVelocity: Float if (canChangeContent) { // If we are halfway between two contents, we check what the target will be based on the // velocity and offset of the transition, then we launch the animation. @@ -429,18 +423,16 @@ private class DragControllerImpl( } else { fromContent } - - animateTo(targetContent = targetContent) + consumedVelocity = swipeAnimation.animateOffset(velocity, targetContent = targetContent) } else { // We are doing an overscroll preview animation between scenes. check(fromContent == swipeAnimation.currentContent) { "canChangeContent is false but currentContent != fromContent" } - animateTo(targetContent = fromContent) + consumedVelocity = swipeAnimation.animateOffset(velocity, targetContent = fromContent) } - // The onStop animation consumes any remaining velocity. - return velocity + return consumedVelocity } /** diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt index 2a09a77788e7..966bda410231 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt @@ -312,11 +312,16 @@ internal class SwipeAnimation( fun isAnimatingOffset(): Boolean = offsetAnimation != null + /** + * Animate the offset to a [targetContent], using the [initialVelocity] and an optional [spec] + * + * @return the velocity consumed + */ fun animateOffset( initialVelocity: Float, targetContent: T, spec: AnimationSpec? = null, - ) { + ): Float { check(!isAnimatingOffset()) { "SwipeAnimation.animateOffset() can only be called once" } val initialProgress = progress @@ -374,7 +379,7 @@ internal class SwipeAnimation( if (skipAnimation) { // Unblock the job. offsetAnimationRunnable.complete(null) - return + return 0f } val isTargetGreater = targetOffset > animatable.value @@ -424,6 +429,9 @@ internal class SwipeAnimation( /* Ignore. */ } } + + // This animation always consumes the whole available velocity + return initialVelocity } /** An exception thrown during the animation to stop it immediately. */ diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt index 79f82c948541..5b5935633166 100644 --- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt +++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt @@ -1111,7 +1111,7 @@ class DraggableHandlerTest { assertTransition(fromScene = SceneA, toScene = SceneB, progress = 1f) // Release the finger. - dragController.onDragStopped(velocity = -velocityThreshold) + dragController.onDragStopped(velocity = -velocityThreshold, expectedConsumed = false) // Exhaust all coroutines *without advancing the clock*. Given that we are at progress >= // 100% and that the overscroll on scene B is doing nothing, we are already idle. -- GitLab From 5cc576d924c9be69f52b46a73bd911d78beef91d Mon Sep 17 00:00:00 2001 From: helencheuk Date: Fri, 6 Sep 2024 14:36:34 +0100 Subject: [PATCH 057/492] [Contextual Edu] Check if target device is connected before incrementing signal count Only increment signal count when the target device is connected. e.g. As we will provide touchpad education for BACK gesture, only increment signal count when touchpad is connected. Bug: 362495235 Test: KeyboardTouchpadStatsInteractorTest Flag: com.android.systemui.keyboard_touchpad_contextual_education Change-Id: Ibe57a2497714c8d880a7df581d5802ea011842b5 --- .../KeyboardTouchpadStatsInteractorTest.kt | 55 +++++++++++++++++-- .../KeyboardTouchpadEduStatsInteractor.kt | 39 +++++++++++-- .../KeyboardTouchpadEduInteractorKosmos.kt | 9 ++- 3 files changed, 92 insertions(+), 11 deletions(-) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt index cd0c58feebed..c4fc13227eef 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt @@ -19,12 +19,15 @@ package com.android.systemui.education.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase -import com.android.systemui.coroutines.collectLastValue +import com.android.systemui.contextualeducation.GestureType.ALL_APPS import com.android.systemui.contextualeducation.GestureType.BACK +import com.android.systemui.coroutines.collectLastValue import com.android.systemui.education.data.repository.contextualEducationRepository import com.android.systemui.education.data.repository.fakeEduClock +import com.android.systemui.keyboard.data.repository.keyboardRepository import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos +import com.android.systemui.touchpad.data.repository.touchpadRepository import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest import org.junit.Test @@ -36,22 +39,62 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope private val underTest = kosmos.keyboardTouchpadEduStatsInteractor + private val keyboardRepository = kosmos.keyboardRepository + private val touchpadRepository = kosmos.touchpadRepository + private val repository = kosmos.contextualEducationRepository @Test - fun dataUpdatedOnIncrementSignalCount() = + fun dataUpdatedOnIncrementSignalCountWhenTouchpadConnected() = testScope.runTest { - val model by - collectLastValue(kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK)) + touchpadRepository.setIsAnyTouchpadConnected(true) + + val model by collectLastValue(repository.readGestureEduModelFlow(BACK)) val originalValue = model!!.signalCount underTest.incrementSignalCount(BACK) + assertThat(model?.signalCount).isEqualTo(originalValue + 1) } + @Test + fun dataUnchangedOnIncrementSignalCountWhenTouchpadDisconnected() = + testScope.runTest { + touchpadRepository.setIsAnyTouchpadConnected(false) + + val model by collectLastValue(repository.readGestureEduModelFlow(BACK)) + val originalValue = model!!.signalCount + underTest.incrementSignalCount(BACK) + + assertThat(model?.signalCount).isEqualTo(originalValue) + } + + @Test + fun dataUpdatedOnIncrementSignalCountWhenKeyboardConnected() = + testScope.runTest { + keyboardRepository.setIsAnyKeyboardConnected(true) + + val model by collectLastValue(repository.readGestureEduModelFlow(ALL_APPS)) + val originalValue = model!!.signalCount + underTest.incrementSignalCount(ALL_APPS) + + assertThat(model?.signalCount).isEqualTo(originalValue + 1) + } + + @Test + fun dataUnchangedOnIncrementSignalCountWhenKeyboardDisconnected() = + testScope.runTest { + keyboardRepository.setIsAnyKeyboardConnected(false) + + val model by collectLastValue(repository.readGestureEduModelFlow(ALL_APPS)) + val originalValue = model!!.signalCount + underTest.incrementSignalCount(ALL_APPS) + + assertThat(model?.signalCount).isEqualTo(originalValue) + } + @Test fun dataAddedOnUpdateShortcutTriggerTime() = testScope.runTest { - val model by - collectLastValue(kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK)) + val model by collectLastValue(repository.readGestureEduModelFlow(BACK)) assertThat(model?.lastShortcutTriggeredTime).isNull() underTest.updateShortcutTriggerTime(BACK) assertThat(model?.lastShortcutTriggeredTime).isEqualTo(kosmos.fakeEduClock.instant()) diff --git a/packages/SystemUI/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduStatsInteractor.kt b/packages/SystemUI/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduStatsInteractor.kt index 3223433568b9..eb4eee204834 100644 --- a/packages/SystemUI/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduStatsInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduStatsInteractor.kt @@ -16,11 +16,17 @@ package com.android.systemui.education.domain.interactor +import com.android.systemui.contextualeducation.GestureType +import com.android.systemui.contextualeducation.GestureType.ALL_APPS import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background -import com.android.systemui.contextualeducation.GestureType +import com.android.systemui.inputdevice.data.repository.UserInputDeviceRepository +import com.android.systemui.inputdevice.tutorial.data.repository.DeviceType +import com.android.systemui.inputdevice.tutorial.data.repository.DeviceType.KEYBOARD +import com.android.systemui.inputdevice.tutorial.data.repository.DeviceType.TOUCHPAD import javax.inject.Inject import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch /** @@ -39,12 +45,17 @@ class KeyboardTouchpadEduStatsInteractorImpl @Inject constructor( @Background private val backgroundScope: CoroutineScope, - private val contextualEducationInteractor: ContextualEducationInteractor + private val contextualEducationInteractor: ContextualEducationInteractor, + private val inputDeviceRepository: UserInputDeviceRepository, ) : KeyboardTouchpadEduStatsInteractor { override fun incrementSignalCount(gestureType: GestureType) { - // Todo: check if keyboard/touchpad is connected before update - backgroundScope.launch { contextualEducationInteractor.incrementSignalCount(gestureType) } + backgroundScope.launch { + val targetDevice = getTargetDevice(gestureType) + if (isTargetDeviceConnected(targetDevice)) { + contextualEducationInteractor.incrementSignalCount(gestureType) + } + } } override fun updateShortcutTriggerTime(gestureType: GestureType) { @@ -52,4 +63,24 @@ constructor( contextualEducationInteractor.updateShortcutTriggerTime(gestureType) } } + + private suspend fun isTargetDeviceConnected(deviceType: DeviceType): Boolean { + if (deviceType == KEYBOARD) { + return inputDeviceRepository.isAnyKeyboardConnectedForUser.first().isConnected + } else if (deviceType == TOUCHPAD) { + return inputDeviceRepository.isAnyTouchpadConnectedForUser.first().isConnected + } + return false + } + + /** + * Keyboard shortcut education would be provided for All Apps. Touchpad gesture education would + * be provided for the rest of the gesture types (i.e. Home, Overview, Back). This method maps + * gesture to its target education device. + */ + private fun getTargetDevice(gestureType: GestureType) = + when (gestureType) { + ALL_APPS -> KEYBOARD + else -> TOUCHPAD + } } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorKosmos.kt index 811c6533c656..251a6b10a0da 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorKosmos.kt @@ -50,6 +50,13 @@ var Kosmos.keyboardTouchpadEduStatsInteractor by Kosmos.Fixture { KeyboardTouchpadEduStatsInteractorImpl( backgroundScope = testScope.backgroundScope, - contextualEducationInteractor = contextualEducationInteractor + contextualEducationInteractor = contextualEducationInteractor, + inputDeviceRepository = + UserInputDeviceRepository( + testDispatcher, + keyboardRepository, + touchpadRepository, + userRepository + ) ) } -- GitLab From 9f5ec6218a11fcd9bc40e94c431338a9870a9e60 Mon Sep 17 00:00:00 2001 From: Tudor Magirescu Date: Fri, 30 Aug 2024 10:45:40 +0000 Subject: [PATCH 058/492] Add ExemptAidlInterfacesGenerator for PermissionAnnotationDetector This CL is a prerequisite for migrating PermissionAnnotationDetector to a global lint check. This will enforce newly added system services to use @EnforcePermission annotations. To determine the newly added system services, the global lint check will use a pre-computed set of existing, i.e. exempt, AIDL interfaces in AOSP. To compute the set, the CL introduces the following: * ExemptAidlInterfacesGenerator, the Android Lint check that creates a set of AIDL Interfaces for a build target. * generate-exempt-aidl-interfaces.sh, a Bash script that runs the lint check on the entire source tree and aggregates the results. Bug: 363248121 Test: ExemptAidlInterfacesGeneratorTest Flag: EXEMPT lint check Change-Id: Id700fb74485e63c76bbdb163079dd90b08c100dc --- .../lint/aidl/EnforcePermissionUtils.kt | 27 +- .../android/lint/aidl/ExemptAidlInterfaces.kt | 774 ++++++++++++++++++ tools/lint/utils/README.md | 11 + .../android/lint/AndroidUtilsIssueRegistry.kt | 4 +- .../aidl/ExemptAidlInterfacesGenerator.kt | 96 +++ .../aidl/ExemptAidlInterfacesGeneratorTest.kt | 191 +++++ .../utils/generate-exempt-aidl-interfaces.sh | 59 ++ 7 files changed, 1153 insertions(+), 9 deletions(-) create mode 100644 tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt create mode 100644 tools/lint/utils/README.md create mode 100644 tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt create mode 100644 tools/lint/utils/checks/src/test/java/com/google/android/lint/aidl/ExemptAidlInterfacesGeneratorTest.kt create mode 100755 tools/lint/utils/generate-exempt-aidl-interfaces.sh diff --git a/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt b/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt index 24d203fd1116..f5af99ec39ac 100644 --- a/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt +++ b/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt @@ -24,20 +24,31 @@ import com.intellij.psi.PsiReferenceList import org.jetbrains.uast.UMethod /** - * Given a UMethod, determine if this method is the entrypoint to an interface - * generated by AIDL, returning the interface name if so, otherwise returning - * null + * Given a UMethod, determine if this method is the entrypoint to an interface generated by AIDL, + * returning the interface name if so, otherwise returning null. */ fun getContainingAidlInterface(context: JavaContext, node: UMethod): String? { + return containingAidlInterfacePsiClass(context, node)?.name +} + +/** + * Given a UMethod, determine if this method is the entrypoint to an interface generated by AIDL, + * returning the fully qualified interface name if so, otherwise returning null. + */ +fun getContainingAidlInterfaceQualified(context: JavaContext, node: UMethod): String? { + return containingAidlInterfacePsiClass(context, node)?.qualifiedName +} + +private fun containingAidlInterfacePsiClass(context: JavaContext, node: UMethod): PsiClass? { val containingStub = containingStub(context, node) ?: return null val superMethod = node.findSuperMethods(containingStub) if (superMethod.isEmpty()) return null - return containingStub.containingClass?.name + return containingStub.containingClass } -/* Returns the containing Stub class if any. This is not sufficient to infer - * that the method itself extends an AIDL generated method. See - * getContainingAidlInterface for that purpose. +/** + * Returns the containing Stub class if any. This is not sufficient to infer that the method itself + * extends an AIDL generated method. See getContainingAidlInterface for that purpose. */ fun containingStub(context: JavaContext, node: UMethod?): PsiClass? { var superClass = node?.containingClass?.superClass @@ -48,7 +59,7 @@ fun containingStub(context: JavaContext, node: UMethod?): PsiClass? { return null } -private fun isStub(context: JavaContext, psiClass: PsiClass?): Boolean { +fun isStub(context: JavaContext, psiClass: PsiClass?): Boolean { if (psiClass == null) return false if (psiClass.name != "Stub") return false if (!context.evaluator.isStatic(psiClass)) return false diff --git a/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt new file mode 100644 index 000000000000..8777712b0f04 --- /dev/null +++ b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt @@ -0,0 +1,774 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.lint.aidl + +/** + * The exemptAidlInterfaces set was generated by running ExemptAidlInterfacesGenerator on the + * entire source tree. To reproduce the results, run generate-exempt-aidl-interfaces.sh + * located in tools/lint/utils. + * + * TODO: b/363248121 - Use the exemptAidlInterfaces set inside PermissionAnnotationDetector when it + * gets migrated to a global lint check. + */ +val exemptAidlInterfaces = setOf( + "android.accessibilityservice.IAccessibilityServiceConnection", + "android.accessibilityservice.IBrailleDisplayConnection", + "android.accounts.IAccountAuthenticatorResponse", + "android.accounts.IAccountManager", + "android.accounts.IAccountManagerResponse", + "android.adservices.adid.IAdIdProviderService", + "android.adservices.adid.IAdIdService", + "android.adservices.adid.IGetAdIdCallback", + "android.adservices.adid.IGetAdIdProviderCallback", + "android.adservices.adselection.AdSelectionCallback", + "android.adservices.adselection.AdSelectionOverrideCallback", + "android.adservices.adselection.AdSelectionService", + "android.adservices.adselection.GetAdSelectionDataCallback", + "android.adservices.adselection.PersistAdSelectionResultCallback", + "android.adservices.adselection.ReportImpressionCallback", + "android.adservices.adselection.ReportInteractionCallback", + "android.adservices.adselection.SetAppInstallAdvertisersCallback", + "android.adservices.adselection.UpdateAdCounterHistogramCallback", + "android.adservices.appsetid.IAppSetIdProviderService", + "android.adservices.appsetid.IAppSetIdService", + "android.adservices.appsetid.IGetAppSetIdCallback", + "android.adservices.appsetid.IGetAppSetIdProviderCallback", + "android.adservices.cobalt.IAdServicesCobaltUploadService", + "android.adservices.common.IAdServicesCommonCallback", + "android.adservices.common.IAdServicesCommonService", + "android.adservices.common.IAdServicesCommonStatesCallback", + "android.adservices.common.IEnableAdServicesCallback", + "android.adservices.common.IUpdateAdIdCallback", + "android.adservices.customaudience.CustomAudienceOverrideCallback", + "android.adservices.customaudience.FetchAndJoinCustomAudienceCallback", + "android.adservices.customaudience.ICustomAudienceCallback", + "android.adservices.customaudience.ICustomAudienceService", + "android.adservices.customaudience.ScheduleCustomAudienceUpdateCallback", + "android.adservices.extdata.IAdServicesExtDataStorageService", + "android.adservices.extdata.IGetAdServicesExtDataCallback", + "android.adservices.measurement.IMeasurementApiStatusCallback", + "android.adservices.measurement.IMeasurementCallback", + "android.adservices.measurement.IMeasurementService", + "android.adservices.ondevicepersonalization.aidl.IDataAccessService", + "android.adservices.ondevicepersonalization.aidl.IDataAccessServiceCallback", + "android.adservices.ondevicepersonalization.aidl.IExecuteCallback", + "android.adservices.ondevicepersonalization.aidl.IFederatedComputeCallback", + "android.adservices.ondevicepersonalization.aidl.IFederatedComputeService", + "android.adservices.ondevicepersonalization.aidl.IIsolatedModelService", + "android.adservices.ondevicepersonalization.aidl.IIsolatedModelServiceCallback", + "android.adservices.ondevicepersonalization.aidl.IIsolatedService", + "android.adservices.ondevicepersonalization.aidl.IIsolatedServiceCallback", + "android.adservices.ondevicepersonalization.aidl.IOnDevicePersonalizationConfigService", + "android.adservices.ondevicepersonalization.aidl.IOnDevicePersonalizationConfigServiceCallback", + "android.adservices.ondevicepersonalization.aidl.IOnDevicePersonalizationDebugService", + "android.adservices.ondevicepersonalization.aidl.IOnDevicePersonalizationManagingService", + "android.adservices.ondevicepersonalization.aidl.IRegisterMeasurementEventCallback", + "android.adservices.ondevicepersonalization.aidl.IRequestSurfacePackageCallback", + "android.adservices.shell.IShellCommand", + "android.adservices.shell.IShellCommandCallback", + "android.adservices.signals.IProtectedSignalsService", + "android.adservices.signals.UpdateSignalsCallback", + "android.adservices.topics.IGetTopicsCallback", + "android.adservices.topics.ITopicsService", + "android.app.admin.IDevicePolicyManager", + "android.app.adservices.IAdServicesManager", + "android.app.ambientcontext.IAmbientContextManager", + "android.app.ambientcontext.IAmbientContextObserver", + "android.app.appsearch.aidl.IAppFunctionService", + "android.app.appsearch.aidl.IAppSearchBatchResultCallback", + "android.app.appsearch.aidl.IAppSearchManager", + "android.app.appsearch.aidl.IAppSearchObserverProxy", + "android.app.appsearch.aidl.IAppSearchResultCallback", + "android.app.backup.IBackupCallback", + "android.app.backup.IBackupManager", + "android.app.backup.IRestoreSession", + "android.app.blob.IBlobCommitCallback", + "android.app.blob.IBlobStoreManager", + "android.app.blob.IBlobStoreSession", + "android.app.contentsuggestions.IContentSuggestionsManager", + "android.app.contextualsearch.IContextualSearchManager", + "android.app.ecm.IEnhancedConfirmationManager", + "android.apphibernation.IAppHibernationService", + "android.app.IActivityClientController", + "android.app.IActivityController", + "android.app.IActivityTaskManager", + "android.app.IAlarmCompleteListener", + "android.app.IAlarmListener", + "android.app.IAlarmManager", + "android.app.IApplicationThread", + "android.app.IAppTask", + "android.app.IAppTraceRetriever", + "android.app.IAssistDataReceiver", + "android.app.IForegroundServiceObserver", + "android.app.IGameManagerService", + "android.app.IGrammaticalInflectionManager", + "android.app.ILocaleManager", + "android.app.INotificationManager", + "android.app.IParcelFileDescriptorRetriever", + "android.app.IProcessObserver", + "android.app.ISearchManager", + "android.app.IStopUserCallback", + "android.app.ITaskStackListener", + "android.app.IUiModeManager", + "android.app.IUriGrantsManager", + "android.app.IUserSwitchObserver", + "android.app.IWallpaperManager", + "android.app.job.IJobCallback", + "android.app.job.IJobScheduler", + "android.app.job.IJobService", + "android.app.ondeviceintelligence.IDownloadCallback", + "android.app.ondeviceintelligence.IFeatureCallback", + "android.app.ondeviceintelligence.IFeatureDetailsCallback", + "android.app.ondeviceintelligence.IListFeaturesCallback", + "android.app.ondeviceintelligence.IOnDeviceIntelligenceManager", + "android.app.ondeviceintelligence.IProcessingSignal", + "android.app.ondeviceintelligence.IResponseCallback", + "android.app.ondeviceintelligence.IStreamingResponseCallback", + "android.app.ondeviceintelligence.ITokenInfoCallback", + "android.app.people.IPeopleManager", + "android.app.pinner.IPinnerService", + "android.app.prediction.IPredictionManager", + "android.app.role.IOnRoleHoldersChangedListener", + "android.app.role.IRoleController", + "android.app.role.IRoleManager", + "android.app.sdksandbox.ILoadSdkCallback", + "android.app.sdksandbox.IRequestSurfacePackageCallback", + "android.app.sdksandbox.ISdkSandboxManager", + "android.app.sdksandbox.ISdkSandboxProcessDeathCallback", + "android.app.sdksandbox.ISdkToServiceCallback", + "android.app.sdksandbox.ISharedPreferencesSyncCallback", + "android.app.sdksandbox.IUnloadSdkCallback", + "android.app.sdksandbox.testutils.testscenario.ISdkSandboxTestExecutor", + "android.app.search.ISearchUiManager", + "android.app.slice.ISliceManager", + "android.app.smartspace.ISmartspaceManager", + "android.app.timedetector.ITimeDetectorService", + "android.app.timezonedetector.ITimeZoneDetectorService", + "android.app.trust.ITrustManager", + "android.app.usage.IStorageStatsManager", + "android.app.usage.IUsageStatsManager", + "android.app.wallpapereffectsgeneration.IWallpaperEffectsGenerationManager", + "android.app.wearable.IWearableSensingCallback", + "android.app.wearable.IWearableSensingManager", + "android.bluetooth.IBluetooth", + "android.bluetooth.IBluetoothA2dp", + "android.bluetooth.IBluetoothA2dpSink", + "android.bluetooth.IBluetoothActivityEnergyInfoListener", + "android.bluetooth.IBluetoothAvrcpController", + "android.bluetooth.IBluetoothCallback", + "android.bluetooth.IBluetoothConnectionCallback", + "android.bluetooth.IBluetoothCsipSetCoordinator", + "android.bluetooth.IBluetoothCsipSetCoordinatorLockCallback", + "android.bluetooth.IBluetoothGatt", + "android.bluetooth.IBluetoothGattCallback", + "android.bluetooth.IBluetoothGattServerCallback", + "android.bluetooth.IBluetoothHapClient", + "android.bluetooth.IBluetoothHapClientCallback", + "android.bluetooth.IBluetoothHeadset", + "android.bluetooth.IBluetoothHeadsetClient", + "android.bluetooth.IBluetoothHearingAid", + "android.bluetooth.IBluetoothHidDevice", + "android.bluetooth.IBluetoothHidDeviceCallback", + "android.bluetooth.IBluetoothHidHost", + "android.bluetooth.IBluetoothLeAudio", + "android.bluetooth.IBluetoothLeAudioCallback", + "android.bluetooth.IBluetoothLeBroadcastAssistant", + "android.bluetooth.IBluetoothLeBroadcastAssistantCallback", + "android.bluetooth.IBluetoothLeBroadcastCallback", + "android.bluetooth.IBluetoothLeCallControl", + "android.bluetooth.IBluetoothLeCallControlCallback", + "android.bluetooth.IBluetoothManager", + "android.bluetooth.IBluetoothManagerCallback", + "android.bluetooth.IBluetoothMap", + "android.bluetooth.IBluetoothMapClient", + "android.bluetooth.IBluetoothMcpServiceManager", + "android.bluetooth.IBluetoothMetadataListener", + "android.bluetooth.IBluetoothOobDataCallback", + "android.bluetooth.IBluetoothPan", + "android.bluetooth.IBluetoothPanCallback", + "android.bluetooth.IBluetoothPbap", + "android.bluetooth.IBluetoothPbapClient", + "android.bluetooth.IBluetoothPreferredAudioProfilesCallback", + "android.bluetooth.IBluetoothQualityReportReadyCallback", + "android.bluetooth.IBluetoothSap", + "android.bluetooth.IBluetoothScan", + "android.bluetooth.IBluetoothSocketManager", + "android.bluetooth.IBluetoothVolumeControl", + "android.bluetooth.IBluetoothVolumeControlCallback", + "android.bluetooth.le.IAdvertisingSetCallback", + "android.bluetooth.le.IDistanceMeasurementCallback", + "android.bluetooth.le.IPeriodicAdvertisingCallback", + "android.bluetooth.le.IScannerCallback", + "android.companion.ICompanionDeviceManager", + "android.companion.IOnMessageReceivedListener", + "android.companion.IOnTransportsChangedListener", + "android.companion.virtualcamera.IVirtualCameraCallback", + "android.companion.virtual.IVirtualDevice", + "android.companion.virtual.IVirtualDeviceManager", + "android.companion.virtualnative.IVirtualDeviceManagerNative", + "android.content.IClipboard", + "android.content.IContentService", + "android.content.IIntentReceiver", + "android.content.IIntentSender", + "android.content.integrity.IAppIntegrityManager", + "android.content.IRestrictionsManager", + "android.content.ISyncAdapterUnsyncableAccountCallback", + "android.content.ISyncContext", + "android.content.om.IOverlayManager", + "android.content.pm.dex.IArtManager", + "android.content.pm.dex.ISnapshotRuntimeProfileCallback", + "android.content.pm.IBackgroundInstallControlService", + "android.content.pm.ICrossProfileApps", + "android.content.pm.IDataLoaderManager", + "android.content.pm.IDataLoaderStatusListener", + "android.content.pm.ILauncherApps", + "android.content.pm.IOnChecksumsReadyListener", + "android.content.pm.IOtaDexopt", + "android.content.pm.IPackageDataObserver", + "android.content.pm.IPackageDeleteObserver", + "android.content.pm.IPackageInstaller", + "android.content.pm.IPackageInstallerSession", + "android.content.pm.IPackageInstallerSessionFileSystemConnector", + "android.content.pm.IPackageInstallObserver2", + "android.content.pm.IPackageLoadingProgressCallback", + "android.content.pm.IPackageManager", + "android.content.pm.IPackageManagerNative", + "android.content.pm.IPackageMoveObserver", + "android.content.pm.IPinItemRequest", + "android.content.pm.IShortcutService", + "android.content.pm.IStagedApexObserver", + "android.content.pm.verify.domain.IDomainVerificationManager", + "android.content.res.IResourcesManager", + "android.content.rollback.IRollbackManager", + "android.credentials.ICredentialManager", + "android.debug.IAdbTransport", + "android.devicelock.IDeviceLockService", + "android.devicelock.IGetDeviceIdCallback", + "android.devicelock.IGetKioskAppsCallback", + "android.devicelock.IIsDeviceLockedCallback", + "android.devicelock.IVoidResultCallback", + "android.federatedcompute.aidl.IExampleStoreCallback", + "android.federatedcompute.aidl.IExampleStoreIterator", + "android.federatedcompute.aidl.IExampleStoreIteratorCallback", + "android.federatedcompute.aidl.IExampleStoreService", + "android.federatedcompute.aidl.IFederatedComputeCallback", + "android.federatedcompute.aidl.IFederatedComputeService", + "android.federatedcompute.aidl.IResultHandlingService", + "android.flags.IFeatureFlags", + "android.frameworks.location.altitude.IAltitudeService", + "android.frameworks.vibrator.IVibratorController", + "android.frameworks.vibrator.IVibratorControlService", + "android.gsi.IGsiServiceCallback", + "android.hardware.biometrics.AuthenticationStateListener", + "android.hardware.biometrics.common.ICancellationSignal", + "android.hardware.biometrics.face.IFace", + "android.hardware.biometrics.face.ISession", + "android.hardware.biometrics.face.ISessionCallback", + "android.hardware.biometrics.fingerprint.IFingerprint", + "android.hardware.biometrics.fingerprint.ISession", + "android.hardware.biometrics.fingerprint.ISessionCallback", + "android.hardware.biometrics.IAuthService", + "android.hardware.biometrics.IBiometricAuthenticator", + "android.hardware.biometrics.IBiometricContextListener", + "android.hardware.biometrics.IBiometricSensorReceiver", + "android.hardware.biometrics.IBiometricService", + "android.hardware.biometrics.IBiometricStateListener", + "android.hardware.biometrics.IBiometricSysuiReceiver", + "android.hardware.biometrics.IInvalidationCallback", + "android.hardware.biometrics.ITestSession", + "android.hardware.broadcastradio.IAnnouncementListener", + "android.hardware.broadcastradio.ITunerCallback", + "android.hardware.contexthub.IContextHubCallback", + "android.hardware.devicestate.IDeviceStateManager", + "android.hardware.display.IColorDisplayManager", + "android.hardware.display.IDisplayManager", + "android.hardware.face.IFaceAuthenticatorsRegisteredCallback", + "android.hardware.face.IFaceService", + "android.hardware.face.IFaceServiceReceiver", + "android.hardware.fingerprint.IFingerprintAuthenticatorsRegisteredCallback", + "android.hardware.fingerprint.IFingerprintClientActiveCallback", + "android.hardware.fingerprint.IFingerprintService", + "android.hardware.fingerprint.IFingerprintServiceReceiver", + "android.hardware.fingerprint.IUdfpsOverlayControllerCallback", + "android.hardware.fingerprint.IUdfpsRefreshRateRequestCallback", + "android.hardware.hdmi.IHdmiControlCallback", + "android.hardware.hdmi.IHdmiControlService", + "android.hardware.hdmi.IHdmiDeviceEventListener", + "android.hardware.hdmi.IHdmiHotplugEventListener", + "android.hardware.hdmi.IHdmiSystemAudioModeChangeListener", + "android.hardware.health.IHealthInfoCallback", + "android.hardware.ICameraServiceProxy", + "android.hardware.IConsumerIrService", + "android.hardware.input.IInputManager", + "android.hardware.iris.IIrisService", + "android.hardware.ISensorPrivacyManager", + "android.hardware.ISerialManager", + "android.hardware.lights.ILightsManager", + "android.hardware.location.IContextHubClient", + "android.hardware.location.IContextHubClientCallback", + "android.hardware.location.IContextHubService", + "android.hardware.location.IContextHubTransactionCallback", + "android.hardware.location.ISignificantPlaceProviderManager", + "android.hardware.radio.IAnnouncementListener", + "android.hardware.radio.ICloseHandle", + "android.hardware.radio.ims.media.IImsMedia", + "android.hardware.radio.ims.media.IImsMediaListener", + "android.hardware.radio.ims.media.IImsMediaSession", + "android.hardware.radio.ims.media.IImsMediaSessionListener", + "android.hardware.radio.IRadioService", + "android.hardware.radio.ITuner", + "android.hardware.radio.sap.ISapCallback", + "android.hardware.soundtrigger3.ISoundTriggerHw", + "android.hardware.soundtrigger3.ISoundTriggerHwCallback", + "android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback", + "android.hardware.soundtrigger.IRecognitionStatusCallback", + "android.hardware.tetheroffload.ITetheringOffloadCallback", + "android.hardware.thermal.IThermalChangedCallback", + "android.hardware.tv.hdmi.cec.IHdmiCecCallback", + "android.hardware.tv.hdmi.connection.IHdmiConnectionCallback", + "android.hardware.tv.hdmi.earc.IEArcCallback", + "android.hardware.usb.gadget.IUsbGadgetCallback", + "android.hardware.usb.IUsbCallback", + "android.hardware.usb.IUsbManager", + "android.hardware.usb.IUsbSerialReader", + "android.hardware.wifi.hostapd.IHostapdCallback", + "android.hardware.wifi.IWifiChipEventCallback", + "android.hardware.wifi.IWifiEventCallback", + "android.hardware.wifi.IWifiNanIfaceEventCallback", + "android.hardware.wifi.IWifiRttControllerEventCallback", + "android.hardware.wifi.IWifiStaIfaceEventCallback", + "android.hardware.wifi.supplicant.INonStandardCertCallback", + "android.hardware.wifi.supplicant.ISupplicantP2pIfaceCallback", + "android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback", + "android.hardware.wifi.supplicant.ISupplicantStaNetworkCallback", + "android.health.connect.aidl.IAccessLogsResponseCallback", + "android.health.connect.aidl.IActivityDatesResponseCallback", + "android.health.connect.aidl.IAggregateRecordsResponseCallback", + "android.health.connect.aidl.IApplicationInfoResponseCallback", + "android.health.connect.aidl.IChangeLogsResponseCallback", + "android.health.connect.aidl.IDataStagingFinishedCallback", + "android.health.connect.aidl.IEmptyResponseCallback", + "android.health.connect.aidl.IGetChangeLogTokenCallback", + "android.health.connect.aidl.IGetHealthConnectDataStateCallback", + "android.health.connect.aidl.IGetHealthConnectMigrationUiStateCallback", + "android.health.connect.aidl.IGetPriorityResponseCallback", + "android.health.connect.aidl.IHealthConnectService", + "android.health.connect.aidl.IInsertRecordsResponseCallback", + "android.health.connect.aidl.IMedicalDataSourceResponseCallback", + "android.health.connect.aidl.IMedicalResourcesResponseCallback", + "android.health.connect.aidl.IMigrationCallback", + "android.health.connect.aidl.IReadMedicalResourcesResponseCallback", + "android.health.connect.aidl.IReadRecordsResponseCallback", + "android.health.connect.aidl.IRecordTypeInfoResponseCallback", + "android.health.connect.exportimport.IImportStatusCallback", + "android.health.connect.exportimport.IQueryDocumentProvidersCallback", + "android.health.connect.exportimport.IScheduledExportStatusCallback", + "android.location.ICountryDetector", + "android.location.IGpsGeofenceHardware", + "android.location.ILocationManager", + "android.location.provider.ILocationProviderManager", + "android.media.IAudioRoutesObserver", + "android.media.IMediaCommunicationService", + "android.media.IMediaCommunicationServiceCallback", + "android.media.IMediaController2", + "android.media.IMediaRoute2ProviderServiceCallback", + "android.media.IMediaRouterService", + "android.media.IMediaSession2", + "android.media.IMediaSession2Service", + "android.media.INativeSpatializerCallback", + "android.media.IPlaybackConfigDispatcher", + "android.media.IRecordingConfigDispatcher", + "android.media.IRemoteDisplayCallback", + "android.media.ISoundDoseCallback", + "android.media.ISpatializerHeadTrackingCallback", + "android.media.ITranscodingClientCallback", + "android.media.metrics.IMediaMetricsManager", + "android.media.midi.IMidiManager", + "android.media.musicrecognition.IMusicRecognitionAttributionTagCallback", + "android.media.musicrecognition.IMusicRecognitionManager", + "android.media.musicrecognition.IMusicRecognitionServiceCallback", + "android.media.projection.IMediaProjection", + "android.media.projection.IMediaProjectionCallback", + "android.media.projection.IMediaProjectionManager", + "android.media.projection.IMediaProjectionWatcherCallback", + "android.media.session.ISession", + "android.media.session.ISessionController", + "android.media.session.ISessionManager", + "android.media.soundtrigger.ISoundTriggerDetectionServiceClient", + "android.media.soundtrigger_middleware.IInjectGlobalEvent", + "android.media.soundtrigger_middleware.IInjectModelEvent", + "android.media.soundtrigger_middleware.IInjectRecognitionEvent", + "android.media.soundtrigger_middleware.ISoundTriggerMiddlewareService", + "android.media.soundtrigger_middleware.ISoundTriggerModule", + "android.media.tv.ad.ITvAdManager", + "android.media.tv.ad.ITvAdSessionCallback", + "android.media.tv.interactive.ITvInteractiveAppManager", + "android.media.tv.interactive.ITvInteractiveAppServiceCallback", + "android.media.tv.interactive.ITvInteractiveAppSessionCallback", + "android.media.tv.ITvInputHardware", + "android.media.tv.ITvInputManager", + "android.media.tv.ITvInputServiceCallback", + "android.media.tv.ITvInputSessionCallback", + "android.media.tv.ITvRemoteServiceInput", + "android.nearby.aidl.IOffloadCallback", + "android.nearby.IBroadcastListener", + "android.nearby.INearbyManager", + "android.nearby.IScanListener", + "android.net.connectivity.aidl.ConnectivityNative", + "android.net.dhcp.IDhcpEventCallbacks", + "android.net.dhcp.IDhcpServer", + "android.net.dhcp.IDhcpServerCallbacks", + "android.net.ICaptivePortal", + "android.net.IConnectivityDiagnosticsCallback", + "android.net.IConnectivityManager", + "android.net.IEthernetManager", + "android.net.IEthernetServiceListener", + "android.net.IIntResultListener", + "android.net.IIpConnectivityMetrics", + "android.net.IIpMemoryStore", + "android.net.IIpMemoryStoreCallbacks", + "android.net.IIpSecService", + "android.net.INetdEventCallback", + "android.net.INetdUnsolicitedEventListener", + "android.net.INetworkActivityListener", + "android.net.INetworkAgent", + "android.net.INetworkAgentRegistry", + "android.net.INetworkInterfaceOutcomeReceiver", + "android.net.INetworkManagementEventObserver", + "android.net.INetworkMonitor", + "android.net.INetworkMonitorCallbacks", + "android.net.INetworkOfferCallback", + "android.net.INetworkPolicyListener", + "android.net.INetworkPolicyManager", + "android.net.INetworkScoreService", + "android.net.INetworkStackConnector", + "android.net.INetworkStackStatusCallback", + "android.net.INetworkStatsService", + "android.net.INetworkStatsSession", + "android.net.IOnCompleteListener", + "android.net.IPacProxyManager", + "android.net.ip.IIpClient", + "android.net.ip.IIpClientCallbacks", + "android.net.ipmemorystore.IOnBlobRetrievedListener", + "android.net.ipmemorystore.IOnL2KeyResponseListener", + "android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener", + "android.net.ipmemorystore.IOnSameL3NetworkResponseListener", + "android.net.ipmemorystore.IOnStatusAndCountListener", + "android.net.ipmemorystore.IOnStatusListener", + "android.net.IQosCallback", + "android.net.ISocketKeepaliveCallback", + "android.net.ITestNetworkManager", + "android.net.ITetheredInterfaceCallback", + "android.net.ITetheringConnector", + "android.net.ITetheringEventCallback", + "android.net.IVpnManager", + "android.net.mdns.aidl.IMDnsEventListener", + "android.net.metrics.INetdEventListener", + "android.net.netstats.IUsageCallback", + "android.net.netstats.provider.INetworkStatsProvider", + "android.net.netstats.provider.INetworkStatsProviderCallback", + "android.net.nsd.INsdManager", + "android.net.nsd.INsdManagerCallback", + "android.net.nsd.INsdServiceConnector", + "android.net.nsd.IOffloadEngine", + "android.net.resolv.aidl.IDnsResolverUnsolicitedEventListener", + "android.net.thread.IActiveOperationalDatasetReceiver", + "android.net.thread.IConfigurationReceiver", + "android.net.thread.IOperationalDatasetCallback", + "android.net.thread.IOperationReceiver", + "android.net.thread.IStateCallback", + "android.net.thread.IThreadNetworkController", + "android.net.thread.IThreadNetworkManager", + "android.net.vcn.IVcnManagementService", + "android.net.wear.ICompanionDeviceManagerProxy", + "android.net.wifi.aware.IWifiAwareDiscoverySessionCallback", + "android.net.wifi.aware.IWifiAwareEventCallback", + "android.net.wifi.aware.IWifiAwareMacAddressProvider", + "android.net.wifi.aware.IWifiAwareManager", + "android.net.wifi.hotspot2.IProvisioningCallback", + "android.net.wifi.IActionListener", + "android.net.wifi.IBooleanListener", + "android.net.wifi.IByteArrayListener", + "android.net.wifi.ICoexCallback", + "android.net.wifi.IDppCallback", + "android.net.wifi.IIntegerListener", + "android.net.wifi.IInterfaceCreationInfoCallback", + "android.net.wifi.ILastCallerListener", + "android.net.wifi.IListListener", + "android.net.wifi.ILocalOnlyConnectionStatusListener", + "android.net.wifi.ILocalOnlyHotspotCallback", + "android.net.wifi.IMacAddressListListener", + "android.net.wifi.IMapListener", + "android.net.wifi.INetworkRequestMatchCallback", + "android.net.wifi.INetworkRequestUserSelectionCallback", + "android.net.wifi.IOnWifiActivityEnergyInfoListener", + "android.net.wifi.IOnWifiDriverCountryCodeChangedListener", + "android.net.wifi.IOnWifiUsabilityStatsListener", + "android.net.wifi.IPnoScanResultsCallback", + "android.net.wifi.IScanDataListener", + "android.net.wifi.IScanResultsCallback", + "android.net.wifi.IScoreUpdateObserver", + "android.net.wifi.ISoftApCallback", + "android.net.wifi.IStringListener", + "android.net.wifi.ISubsystemRestartCallback", + "android.net.wifi.ISuggestionConnectionStatusListener", + "android.net.wifi.ISuggestionUserApprovalStatusListener", + "android.net.wifi.ITrafficStateCallback", + "android.net.wifi.ITwtCallback", + "android.net.wifi.ITwtCapabilitiesListener", + "android.net.wifi.ITwtStatsListener", + "android.net.wifi.IWifiBandsListener", + "android.net.wifi.IWifiConnectedNetworkScorer", + "android.net.wifi.IWifiLowLatencyLockListener", + "android.net.wifi.IWifiManager", + "android.net.wifi.IWifiNetworkSelectionConfigListener", + "android.net.wifi.IWifiNetworkStateChangedListener", + "android.net.wifi.IWifiScanner", + "android.net.wifi.IWifiScannerListener", + "android.net.wifi.IWifiVerboseLoggingStatusChangedListener", + "android.net.wifi.p2p.IWifiP2pListener", + "android.net.wifi.p2p.IWifiP2pManager", + "android.net.wifi.rtt.IRttCallback", + "android.net.wifi.rtt.IWifiRttManager", + "android.ondevicepersonalization.IOnDevicePersonalizationSystemService", + "android.ondevicepersonalization.IOnDevicePersonalizationSystemServiceCallback", + "android.os.IBatteryPropertiesRegistrar", + "android.os.ICancellationSignal", + "android.os.IDeviceIdentifiersPolicyService", + "android.os.IDeviceIdleController", + "android.os.IDumpstate", + "android.os.IDumpstateListener", + "android.os.IExternalVibratorService", + "android.os.IHardwarePropertiesManager", + "android.os.IHintManager", + "android.os.IHintSession", + "android.os.IIncidentCompanion", + "android.os.image.IDynamicSystemService", + "android.os.incremental.IStorageHealthListener", + "android.os.INetworkManagementService", + "android.os.IPendingIntentRef", + "android.os.IPowerStatsService", + "android.os.IProfilingResultCallback", + "android.os.IProfilingService", + "android.os.IProgressListener", + "android.os.IPullAtomCallback", + "android.os.IRecoverySystem", + "android.os.IRemoteCallback", + "android.os.ISecurityStateManager", + "android.os.IServiceCallback", + "android.os.IStatsCompanionService", + "android.os.IStatsManagerService", + "android.os.IStatsQueryCallback", + "android.os.ISystemConfig", + "android.os.ISystemUpdateManager", + "android.os.IThermalEventListener", + "android.os.IUpdateLock", + "android.os.IUserManager", + "android.os.IUserRestrictionsListener", + "android.os.IVibratorManagerService", + "android.os.IVoldListener", + "android.os.IVoldMountCallback", + "android.os.IVoldTaskListener", + "android.os.logcat.ILogcatManagerService", + "android.permission.ILegacyPermissionManager", + "android.permission.IPermissionChecker", + "android.permission.IPermissionManager", + "android.print.IPrintManager", + "android.print.IPrintSpoolerCallbacks", + "android.print.IPrintSpoolerClient", + "android.printservice.IPrintServiceClient", + "android.printservice.recommendation.IRecommendationServiceCallbacks", + "android.provider.aidl.IDeviceConfigManager", + "android.remoteauth.IDeviceDiscoveryListener", + "android.safetycenter.IOnSafetyCenterDataChangedListener", + "android.safetycenter.ISafetyCenterManager", + "android.scheduling.IRebootReadinessManager", + "android.scheduling.IRequestRebootReadinessStatusListener", + "android.security.attestationverification.IAttestationVerificationManagerService", + "android.security.IFileIntegrityService", + "android.security.keystore.IKeyAttestationApplicationIdProvider", + "android.security.rkp.IRegistration", + "android.security.rkp.IRemoteProvisioning", + "android.service.appprediction.IPredictionService", + "android.service.assist.classification.IFieldClassificationCallback", + "android.service.attention.IAttentionCallback", + "android.service.attention.IProximityUpdateCallback", + "android.service.autofill.augmented.IFillCallback", + "android.service.autofill.IConvertCredentialCallback", + "android.service.autofill.IFillCallback", + "android.service.autofill.IInlineSuggestionUiCallback", + "android.service.autofill.ISaveCallback", + "android.service.autofill.ISurfacePackageResultCallback", + "android.service.contentcapture.IContentCaptureServiceCallback", + "android.service.contentcapture.IContentProtectionAllowlistCallback", + "android.service.contentcapture.IDataShareCallback", + "android.service.credentials.IBeginCreateCredentialCallback", + "android.service.credentials.IBeginGetCredentialCallback", + "android.service.credentials.IClearCredentialStateCallback", + "android.service.dreams.IDreamManager", + "android.service.games.IGameServiceController", + "android.service.games.IGameSessionController", + "android.service.notification.IStatusBarNotificationHolder", + "android.service.oemlock.IOemLockService", + "android.service.ondeviceintelligence.IProcessingUpdateStatusCallback", + "android.service.ondeviceintelligence.IRemoteProcessingService", + "android.service.ondeviceintelligence.IRemoteStorageService", + "android.service.persistentdata.IPersistentDataBlockService", + "android.service.resolver.IResolverRankerResult", + "android.service.rotationresolver.IRotationResolverCallback", + "android.service.textclassifier.ITextClassifierCallback", + "android.service.textclassifier.ITextClassifierService", + "android.service.timezone.ITimeZoneProviderManager", + "android.service.trust.ITrustAgentServiceCallback", + "android.service.voice.IDetectorSessionStorageService", + "android.service.voice.IDetectorSessionVisualQueryDetectionCallback", + "android.service.voice.IDspHotwordDetectionCallback", + "android.service.wallpaper.IWallpaperConnection", + "android.speech.IRecognitionListener", + "android.speech.IRecognitionService", + "android.speech.IRecognitionServiceManager", + "android.speech.tts.ITextToSpeechManager", + "android.speech.tts.ITextToSpeechSession", + "android.system.composd.ICompilationTaskCallback", + "android.system.virtualizationmaintenance.IVirtualizationReconciliationCallback", + "android.system.virtualizationservice.IVirtualMachineCallback", + "android.system.vmtethering.IVmTethering", + "android.telephony.imsmedia.IImsAudioSession", + "android.telephony.imsmedia.IImsAudioSessionCallback", + "android.telephony.imsmedia.IImsMedia", + "android.telephony.imsmedia.IImsMediaCallback", + "android.telephony.imsmedia.IImsTextSession", + "android.telephony.imsmedia.IImsTextSessionCallback", + "android.telephony.imsmedia.IImsVideoSession", + "android.telephony.imsmedia.IImsVideoSessionCallback", + "android.tracing.ITracingServiceProxy", + "android.uwb.IOnUwbActivityEnergyInfoListener", + "android.uwb.IUwbAdapter", + "android.uwb.IUwbAdapterStateCallbacks", + "android.uwb.IUwbAdfProvisionStateCallbacks", + "android.uwb.IUwbOemExtensionCallback", + "android.uwb.IUwbRangingCallbacks", + "android.uwb.IUwbVendorUciCallback", + "android.view.accessibility.IAccessibilityInteractionConnectionCallback", + "android.view.accessibility.IAccessibilityManager", + "android.view.accessibility.IMagnificationConnectionCallback", + "android.view.accessibility.IRemoteMagnificationAnimationCallback", + "android.view.autofill.IAutoFillManager", + "android.view.autofill.IAutofillWindowPresenter", + "android.view.contentcapture.IContentCaptureManager", + "android.view.IDisplayChangeWindowCallback", + "android.view.IDisplayWindowListener", + "android.view.IInputFilter", + "android.view.IInputFilterHost", + "android.view.IInputMonitorHost", + "android.view.IRecentsAnimationController", + "android.view.IRemoteAnimationFinishedCallback", + "android.view.ISensitiveContentProtectionManager", + "android.view.IWindowId", + "android.view.IWindowManager", + "android.view.IWindowSession", + "android.view.translation.ITranslationManager", + "android.view.translation.ITranslationServiceCallback", + "android.webkit.IWebViewUpdateService", + "android.window.IBackAnimationFinishedCallback", + "android.window.IDisplayAreaOrganizerController", + "android.window.ITaskFragmentOrganizerController", + "android.window.ITaskOrganizerController", + "android.window.ITransitionMetricsReporter", + "android.window.IUnhandledDragCallback", + "android.window.IWindowContainerToken", + "android.window.IWindowlessStartingSurfaceCallback", + "android.window.IWindowOrganizerController", + "androidx.core.uwb.backend.IUwb", + "androidx.core.uwb.backend.IUwbClient", + "com.android.clockwork.modes.IModeManager", + "com.android.clockwork.modes.IStateChangeListener", + "com.android.clockwork.power.IWearPowerService", + "com.android.devicelockcontroller.IDeviceLockControllerService", + "com.android.devicelockcontroller.storage.IGlobalParametersService", + "com.android.devicelockcontroller.storage.ISetupParametersService", + "com.android.federatedcompute.services.training.aidl.IIsolatedTrainingService", + "com.android.federatedcompute.services.training.aidl.ITrainingResultCallback", + "com.android.internal.app.IAppOpsActiveCallback", + "com.android.internal.app.ILogAccessDialogCallback", + "com.android.internal.app.ISoundTriggerService", + "com.android.internal.app.ISoundTriggerSession", + "com.android.internal.app.IVoiceInteractionAccessibilitySettingsListener", + "com.android.internal.app.IVoiceInteractionManagerService", + "com.android.internal.app.IVoiceInteractionSessionListener", + "com.android.internal.app.IVoiceInteractionSessionShowCallback", + "com.android.internal.app.IVoiceInteractionSoundTriggerSession", + "com.android.internal.app.procstats.IProcessStats", + "com.android.internal.appwidget.IAppWidgetService", + "com.android.internal.backup.ITransportStatusCallback", + "com.android.internal.compat.IOverrideValidator", + "com.android.internal.compat.IPlatformCompat", + "com.android.internal.compat.IPlatformCompatNative", + "com.android.internal.graphics.fonts.IFontManager", + "com.android.internal.inputmethod.IAccessibilityInputMethodSessionCallback", + "com.android.internal.inputmethod.IConnectionlessHandwritingCallback", + "com.android.internal.inputmethod.IImeTracker", + "com.android.internal.inputmethod.IInlineSuggestionsRequestCallback", + "com.android.internal.inputmethod.IInputContentUriToken", + "com.android.internal.inputmethod.IInputMethodPrivilegedOperations", + "com.android.internal.inputmethod.IInputMethodSessionCallback", + "com.android.internal.net.INetworkWatchlistManager", + "com.android.internal.os.IBinaryTransparencyService", + "com.android.internal.os.IDropBoxManagerService", + "com.android.internal.policy.IKeyguardDismissCallback", + "com.android.internal.policy.IKeyguardDrawnCallback", + "com.android.internal.policy.IKeyguardExitCallback", + "com.android.internal.policy.IKeyguardStateCallback", + "com.android.internal.statusbar.IAddTileResultCallback", + "com.android.internal.statusbar.ISessionListener", + "com.android.internal.statusbar.IStatusBarService", + "com.android.internal.telecom.IDeviceIdleControllerAdapter", + "com.android.internal.telecom.IInternalServiceRetriever", + "com.android.internal.telephony.IMms", + "com.android.internal.telephony.ITelephonyRegistry", + "com.android.internal.textservice.ISpellCheckerServiceCallback", + "com.android.internal.textservice.ITextServicesManager", + "com.android.internal.view.IDragAndDropPermissions", + "com.android.internal.view.IInputMethodManager", + "com.android.internal.view.inline.IInlineContentProvider", + "com.android.internal.widget.ILockSettings", + "com.android.net.IProxyPortListener", + "com.android.net.module.util.IRoutingCoordinator", + "com.android.ondevicepersonalization.libraries.plugin.internal.IPluginCallback", + "com.android.ondevicepersonalization.libraries.plugin.internal.IPluginExecutorService", + "com.android.ondevicepersonalization.libraries.plugin.internal.IPluginStateCallback", + "com.android.rkpdapp.IGetKeyCallback", + "com.android.rkpdapp.IGetRegistrationCallback", + "com.android.rkpdapp.IRegistration", + "com.android.rkpdapp.IRemoteProvisioning", + "com.android.rkpdapp.IStoreUpgradedKeyCallback", + "com.android.sdksandbox.IComputeSdkStorageCallback", + "com.android.sdksandbox.ILoadSdkInSandboxCallback", + "com.android.sdksandbox.IRequestSurfacePackageFromSdkCallback", + "com.android.sdksandbox.ISdkSandboxManagerToSdkSandboxCallback", + "com.android.sdksandbox.ISdkSandboxService", + "com.android.sdksandbox.IUnloadSdkInSandboxCallback", + "com.android.server.profcollect.IProviderStatusCallback", + "com.android.server.thread.openthread.IChannelMasksReceiver", + "com.android.server.thread.openthread.INsdPublisher", + "com.android.server.thread.openthread.IOtDaemonCallback", + "com.android.server.thread.openthread.IOtStatusReceiver", + "com.google.android.clockwork.ambient.offload.IDisplayOffloadService", + "com.google.android.clockwork.ambient.offload.IDisplayOffloadTransitionFinishedCallbacks", + "com.google.android.clockwork.healthservices.IHealthService", + "vendor.google_clockwork.healthservices.IHealthServicesCallback", +) diff --git a/tools/lint/utils/README.md b/tools/lint/utils/README.md new file mode 100644 index 000000000000..b5583c54b25c --- /dev/null +++ b/tools/lint/utils/README.md @@ -0,0 +1,11 @@ +# Utility Android Lint Checks for AOSP + +This directory contains scripts that execute utility Android Lint Checks for AOSP, specifically: +* `enforce_permission_counter.py`: Provides statistics regarding the percentage of annotated/not + annotated `AIDL` methods with `@EnforcePermission` annotations. +* `generate-exempt-aidl-interfaces.sh`: Provides a list of all `AIDL` interfaces in the entire + source tree. + +When adding a new utility Android Lint check to this directory, consider adding any utility or +data processing tool you might require. Make sure that your contribution is documented in this +README file. diff --git a/tools/lint/utils/checks/src/main/java/com/google/android/lint/AndroidUtilsIssueRegistry.kt b/tools/lint/utils/checks/src/main/java/com/google/android/lint/AndroidUtilsIssueRegistry.kt index fa61c42ef8e6..98428810c0fc 100644 --- a/tools/lint/utils/checks/src/main/java/com/google/android/lint/AndroidUtilsIssueRegistry.kt +++ b/tools/lint/utils/checks/src/main/java/com/google/android/lint/AndroidUtilsIssueRegistry.kt @@ -19,6 +19,7 @@ package com.google.android.lint import com.android.tools.lint.client.api.IssueRegistry import com.android.tools.lint.client.api.Vendor import com.android.tools.lint.detector.api.CURRENT_API +import com.google.android.lint.aidl.ExemptAidlInterfacesGenerator import com.google.android.lint.aidl.AnnotatedAidlCounter import com.google.auto.service.AutoService @@ -27,6 +28,7 @@ import com.google.auto.service.AutoService class AndroidUtilsIssueRegistry : IssueRegistry() { override val issues = listOf( AnnotatedAidlCounter.ISSUE_ANNOTATED_AIDL_COUNTER, + ExemptAidlInterfacesGenerator.ISSUE_PERMISSION_ANNOTATION_EXEMPT_AIDL_INTERFACES, ) override val api: Int @@ -38,6 +40,6 @@ class AndroidUtilsIssueRegistry : IssueRegistry() { override val vendor: Vendor = Vendor( vendorName = "Android", feedbackUrl = "http://b/issues/new?component=315013", - contact = "tweek@google.com" + contact = "android-platform-abuse-prevention-withfriends@google.com" ) } diff --git a/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt b/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt new file mode 100644 index 000000000000..6ad223c87a29 --- /dev/null +++ b/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.lint.aidl + +import com.android.tools.lint.detector.api.Category +import com.android.tools.lint.detector.api.Context +import com.android.tools.lint.detector.api.Implementation +import com.android.tools.lint.detector.api.Issue +import com.android.tools.lint.detector.api.JavaContext +import com.android.tools.lint.detector.api.Scope +import com.android.tools.lint.detector.api.Severity +import org.jetbrains.uast.UBlockExpression +import org.jetbrains.uast.UMethod + +/** + * Generates a set of fully qualified AIDL Interface names present in the entire source tree with + * the following requirement: their implementations have to be inside directories whose path + * prefixes match `systemServicePathPrefixes`. + */ +class ExemptAidlInterfacesGenerator : AidlImplementationDetector() { + private val targetExemptAidlInterfaceNames = mutableSetOf() + private val systemServicePathPrefixes = setOf( + "frameworks/base/services", + "frameworks/base/apex", + "frameworks/opt/wear", + "packages/modules" + ) + + // We could've improved performance by visiting classes rather than methods, however, this lint + // check won't be run regularly, hence we've decided not to add extra overrides to + // AidlImplementationDetector. + override fun visitAidlMethod( + context: JavaContext, + node: UMethod, + interfaceName: String, + body: UBlockExpression + ) { + val filePath = context.file.path + + // We perform `filePath.contains` instead of `filePath.startsWith` since getting the + // relative path of a source file is non-trivial. That is because `context.file.path` + // returns the path to where soong builds the file (i.e. /out/soong/...). Moreover, the + // logic to extract the relative path would need to consider several /out/soong/... + // locations patterns. + if (systemServicePathPrefixes.none { filePath.contains(it) }) return + + val fullyQualifiedInterfaceName = + getContainingAidlInterfaceQualified(context, node) ?: return + + targetExemptAidlInterfaceNames.add("\"$fullyQualifiedInterfaceName\",") + } + + override fun afterCheckEachProject(context: Context) { + if (targetExemptAidlInterfaceNames.isEmpty()) return + + val message = targetExemptAidlInterfaceNames.joinToString("\n") + + context.report( + ISSUE_PERMISSION_ANNOTATION_EXEMPT_AIDL_INTERFACES, + context.getLocation(context.project.dir), + "\n" + message + "\n", + ) + } + + companion object { + @JvmField + val ISSUE_PERMISSION_ANNOTATION_EXEMPT_AIDL_INTERFACES = Issue.create( + id = "PermissionAnnotationExemptAidlInterfaces", + briefDescription = "Returns a set of all AIDL interfaces", + explanation = """ + Produces the exemptAidlInterfaces set used by PermissionAnnotationDetector + """.trimIndent(), + category = Category.SECURITY, + priority = 5, + severity = Severity.INFORMATIONAL, + implementation = Implementation( + ExemptAidlInterfacesGenerator::class.java, + Scope.JAVA_FILE_SCOPE + ) + ) + } +} diff --git a/tools/lint/utils/checks/src/test/java/com/google/android/lint/aidl/ExemptAidlInterfacesGeneratorTest.kt b/tools/lint/utils/checks/src/test/java/com/google/android/lint/aidl/ExemptAidlInterfacesGeneratorTest.kt new file mode 100644 index 000000000000..9a17bb4c8d3e --- /dev/null +++ b/tools/lint/utils/checks/src/test/java/com/google/android/lint/aidl/ExemptAidlInterfacesGeneratorTest.kt @@ -0,0 +1,191 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.lint.aidl + +import com.android.tools.lint.checks.infrastructure.LintDetectorTest +import com.android.tools.lint.checks.infrastructure.TestFile +import com.android.tools.lint.checks.infrastructure.TestLintTask +import com.android.tools.lint.detector.api.Detector +import com.android.tools.lint.detector.api.Issue + +class ExemptAidlInterfacesGeneratorTest : LintDetectorTest() { + override fun getDetector(): Detector = ExemptAidlInterfacesGenerator() + + override fun getIssues(): List = listOf( + ExemptAidlInterfacesGenerator.ISSUE_PERMISSION_ANNOTATION_EXEMPT_AIDL_INTERFACES, + ) + + override fun lint(): TestLintTask = super.lint().allowMissingSdk(true) + + fun testMultipleAidlInterfacesImplemented() { + lint() + .files( + java( + createVisitedPath("TestClass1.java"), + """ + package com.android.server; + public class TestClass1 extends IFoo.Stub { + public void testMethod() {} + } + """ + ) + .indented(), + java( + createVisitedPath("TestClass2.java"), + """ + package com.android.server; + public class TestClass2 extends IBar.Stub { + public void testMethod() {} + } + """ + ) + .indented(), + *stubs, + ) + .run() + .expect( + """ + app: Information: "IFoo", + "IBar", [PermissionAnnotationExemptAidlInterfaces] + 0 errors, 0 warnings + """ + ) + } + + fun testSingleAidlInterfaceRepeated() { + lint() + .files( + java( + createVisitedPath("TestClass1.java"), + """ + package com.android.server; + public class TestClass1 extends IFoo.Stub { + public void testMethod() {} + } + """ + ) + .indented(), + java( + createVisitedPath("TestClass2.java"), + """ + package com.android.server; + public class TestClass2 extends IFoo.Stub { + public void testMethod() {} + } + """ + ) + .indented(), + *stubs, + ) + .run() + .expect( + """ + app: Information: "IFoo", [PermissionAnnotationExemptAidlInterfaces] + 0 errors, 0 warnings + """ + ) + } + + fun testAnonymousClassExtendsAidlStub() { + lint() + .files( + java( + createVisitedPath("TestClass.java"), + """ + package com.android.server; + public class TestClass { + private IBinder aidlImpl = new IFoo.Stub() { + public void testMethod() {} + }; + } + """ + ) + .indented(), + *stubs, + ) + .run() + .expect( + """ + app: Information: "IFoo", [PermissionAnnotationExemptAidlInterfaces] + 0 errors, 0 warnings + """ + ) + } + + fun testNoAidlInterfacesImplemented() { + lint() + .files( + java( + createVisitedPath("TestClass.java"), + """ + package com.android.server; + public class TestClass { + public void testMethod() {} + } + """ + ) + .indented(), + *stubs + ) + .run() + .expectClean() + } + + fun testAidlInterfaceImplementedInIgnoredDirectory() { + lint() + .files( + java( + ignoredPath, + """ + package com.android.server; + public class TestClass1 extends IFoo.Stub { + public void testMethod() {} + } + """ + ) + .indented(), + *stubs, + ) + .run() + .expectClean() + } + + private val interfaceIFoo: TestFile = java( + """ + public interface IFoo extends android.os.IInterface { + public static abstract class Stub extends android.os.Binder implements IFoo {} + public void testMethod(); + } + """ + ).indented() + + private val interfaceIBar: TestFile = java( + """ + public interface IBar extends android.os.IInterface { + public static abstract class Stub extends android.os.Binder implements IBar {} + public void testMethod(); + } + """ + ).indented() + + private val stubs = arrayOf(interfaceIFoo, interfaceIBar) + + private fun createVisitedPath(filename: String) = + "src/frameworks/base/services/java/com/android/server/$filename" + + private val ignoredPath = "src/test/pkg/TestClass.java" +} diff --git a/tools/lint/utils/generate-exempt-aidl-interfaces.sh b/tools/lint/utils/generate-exempt-aidl-interfaces.sh new file mode 100755 index 000000000000..44dcdd74fe06 --- /dev/null +++ b/tools/lint/utils/generate-exempt-aidl-interfaces.sh @@ -0,0 +1,59 @@ +# +# Copyright (C) 2024 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Create a directory for the results and a nested temporary directory. +mkdir -p $ANDROID_BUILD_TOP/out/soong/exempt_aidl_interfaces_generator_output/tmp + +# Create a copy of `AndroidGlobalLintChecker.jar` to restore it afterwards. +cp $ANDROID_BUILD_TOP/prebuilts/cmdline-tools/AndroidGlobalLintChecker.jar \ + $ANDROID_BUILD_TOP/out/soong/exempt_aidl_interfaces_generator_output/AndroidGlobalLintChecker.jar + +# Configure the environment variable required for running the lint check on the entire source tree. +export ANDROID_LINT_CHECK=PermissionAnnotationExemptAidlInterfaces + +# Build the target corresponding to the lint checks present in the `utils` directory. +m AndroidUtilsLintChecker + +# Replace `AndroidGlobalLintChecker.jar` with the newly built `jar` file. +cp $ANDROID_BUILD_TOP/out/host/linux-x86/framework/AndroidUtilsLintChecker.jar \ + $ANDROID_BUILD_TOP/prebuilts/cmdline-tools/AndroidGlobalLintChecker.jar; + +# Run the lint check on the entire source tree. +m lint-check + +# Copy the archive containing the results of `lint-check` into the temporary directory. +cp $ANDROID_BUILD_TOP/out/soong/lint-report-text.zip \ + $ANDROID_BUILD_TOP/out/soong/exempt_aidl_interfaces_generator_output/tmp + +cd $ANDROID_BUILD_TOP/out/soong/exempt_aidl_interfaces_generator_output/tmp + +# Unzip the archive containing the results of `lint-check`. +unzip lint-report-text.zip + +# Concatenate the results of `lint-check` into a single string. +concatenated_reports=$(find . -type f | xargs cat) + +# Extract the fully qualified names of the AIDL Interfaces from the concatenated results. Output +# this list into `out/soong/exempt_aidl_interfaces_generator_output/exempt_aidl_interfaces`. +echo $concatenated_reports | grep -Eo '\"([a-zA-Z0-9_]*\.)+[a-zA-Z0-9_]*\",' | sort | uniq > ../exempt_aidl_interfaces + +# Remove the temporary directory. +rm -rf $ANDROID_BUILD_TOP/out/soong/exempt_aidl_interfaces_generator_output/tmp + +# Restore the original copy of `AndroidGlobalLintChecker.jar` and delete the copy. +cp $ANDROID_BUILD_TOP/out/soong/exempt_aidl_interfaces_generator_output/AndroidGlobalLintChecker.jar \ + $ANDROID_BUILD_TOP/prebuilts/cmdline-tools/AndroidGlobalLintChecker.jar +rm $ANDROID_BUILD_TOP/out/soong/exempt_aidl_interfaces_generator_output/AndroidGlobalLintChecker.jar -- GitLab From c72a1f652c4c6dd082c40d0ea8fb814e85ea26be Mon Sep 17 00:00:00 2001 From: Roshan Date: Fri, 6 Sep 2024 09:46:03 -0700 Subject: [PATCH 059/492] nfc(api): Move isEuiccSupported() from @SystemApi to public There was a misunderstanding in the initial requirement. Changing to public API per feedback from OEM. Bug: 321314635 Test: atest CtsNfcTestCases Change-Id: I3cd89ce4d3eb260e96b752a2655f09e516404dde --- nfc/api/current.txt | 1 + nfc/api/system-current.txt | 1 - nfc/java/android/nfc/cardemulation/CardEmulation.java | 2 -- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nfc/api/current.txt b/nfc/api/current.txt index 5b6b6c0b192e..e7cb76c370fd 100644 --- a/nfc/api/current.txt +++ b/nfc/api/current.txt @@ -205,6 +205,7 @@ package android.nfc.cardemulation { method public int getSelectionModeForCategory(String); method public boolean isDefaultServiceForAid(android.content.ComponentName, String); method public boolean isDefaultServiceForCategory(android.content.ComponentName, String); + method @FlaggedApi("android.nfc.enable_card_emulation_euicc") public boolean isEuiccSupported(); method public boolean registerAidsForService(android.content.ComponentName, String, java.util.List); method @FlaggedApi("android.nfc.nfc_read_polling_loop") public boolean registerPollingLoopFilterForService(@NonNull android.content.ComponentName, @NonNull String, boolean); method @FlaggedApi("android.nfc.nfc_read_polling_loop") public boolean registerPollingLoopPatternFilterForService(@NonNull android.content.ComponentName, @NonNull String, boolean); diff --git a/nfc/api/system-current.txt b/nfc/api/system-current.txt index cc5ff8168567..bc8a7afd94e9 100644 --- a/nfc/api/system-current.txt +++ b/nfc/api/system-current.txt @@ -98,7 +98,6 @@ package android.nfc.cardemulation { public final class CardEmulation { method @FlaggedApi("android.permission.flags.wallet_role_enabled") @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public static android.content.ComponentName getPreferredPaymentService(@NonNull android.content.Context); method @FlaggedApi("android.nfc.enable_nfc_mainline") @NonNull public java.util.List getServices(@NonNull String, int); - method @FlaggedApi("android.nfc.enable_card_emulation_euicc") public boolean isEuiccSupported(); method @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public void overrideRoutingTable(@NonNull android.app.Activity, int, int); method @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public void recoverRoutingTable(@NonNull android.app.Activity); } diff --git a/nfc/java/android/nfc/cardemulation/CardEmulation.java b/nfc/java/android/nfc/cardemulation/CardEmulation.java index a72a8964203a..83ad32c98a03 100644 --- a/nfc/java/android/nfc/cardemulation/CardEmulation.java +++ b/nfc/java/android/nfc/cardemulation/CardEmulation.java @@ -992,9 +992,7 @@ public final class CardEmulation { * Is EUICC supported as a Secure Element EE which supports off host card emulation. * * @return true if the device supports EUICC for off host card emulation, false otherwise. - * @hide */ - @SystemApi @FlaggedApi(android.nfc.Flags.FLAG_ENABLE_CARD_EMULATION_EUICC) public boolean isEuiccSupported() { return callServiceReturn(() -> sService.isEuiccSupported(), false); -- GitLab From 14d9edbde22faa9f1f99c48a6fbcc9f1d3738a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Hern=C3=A1ndez?= Date: Fri, 6 Sep 2024 18:50:00 +0200 Subject: [PATCH 060/492] Apply "night mode" device effect immediately if the keyguard is showing We were delaying non-user-triggered night mode changes, except those that happened with the screen off. This is too conservative and it's also fine to do so if the keyguard is showing. This is especially useful to allow the mode switch in the "bedtime mode ends on morning alarm" case, when the alarm ringing turns on the screen (and displays its activity on top of the lockscreen). Fixes: 365088439 Test: atest DefaultDeviceEffectsApplierTest NotificationManagerZenTest Flag: android.app.modes_ui Change-Id: Icf732594dcd00adad55128a345d056ec4489e88a --- .../DefaultDeviceEffectsApplier.java | 9 +++++++-- .../DefaultDeviceEffectsApplierTest.java | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/notification/DefaultDeviceEffectsApplier.java b/services/core/java/com/android/server/notification/DefaultDeviceEffectsApplier.java index bad959af7aad..925ba1752fe2 100644 --- a/services/core/java/com/android/server/notification/DefaultDeviceEffectsApplier.java +++ b/services/core/java/com/android/server/notification/DefaultDeviceEffectsApplier.java @@ -22,6 +22,7 @@ import static android.app.UiModeManager.MODE_ATTENTION_THEME_OVERLAY_OFF; import static com.android.server.notification.ZenLog.traceApplyDeviceEffect; import static com.android.server.notification.ZenLog.traceScheduleApplyDeviceEffect; +import android.app.KeyguardManager; import android.app.UiModeManager; import android.app.WallpaperManager; import android.content.BroadcastReceiver; @@ -53,6 +54,7 @@ class DefaultDeviceEffectsApplier implements DeviceEffectsApplier { private final Context mContext; private final ColorDisplayManager mColorDisplayManager; + private final KeyguardManager mKeyguardManager; private final PowerManager mPowerManager; private final UiModeManager mUiModeManager; private final WallpaperManager mWallpaperManager; @@ -67,6 +69,7 @@ class DefaultDeviceEffectsApplier implements DeviceEffectsApplier { DefaultDeviceEffectsApplier(Context context) { mContext = context; mColorDisplayManager = context.getSystemService(ColorDisplayManager.class); + mKeyguardManager = context.getSystemService(KeyguardManager.class); mPowerManager = context.getSystemService(PowerManager.class); mUiModeManager = context.getSystemService(UiModeManager.class); WallpaperManager wallpaperManager = context.getSystemService(WallpaperManager.class); @@ -133,12 +136,14 @@ class DefaultDeviceEffectsApplier implements DeviceEffectsApplier { // Changing the theme can be disruptive for the user (Activities are likely recreated, may // lose some state). Therefore we only apply the change immediately if the rule was - // activated manually, or we are initializing, or the screen is currently off/dreaming. + // activated manually, or we are initializing, or the screen is currently off/dreaming, + // or if the device is locked. if (origin == ZenModeConfig.ORIGIN_INIT || origin == ZenModeConfig.ORIGIN_INIT_USER || origin == ZenModeConfig.ORIGIN_USER_IN_SYSTEMUI || origin == ZenModeConfig.ORIGIN_USER_IN_APP - || !mPowerManager.isInteractive()) { + || !mPowerManager.isInteractive() + || (android.app.Flags.modesUi() && mKeyguardManager.isKeyguardLocked())) { unregisterScreenOffReceiver(); updateNightModeImmediately(useNightMode); } else { diff --git a/services/tests/uiservicestests/src/com/android/server/notification/DefaultDeviceEffectsApplierTest.java b/services/tests/uiservicestests/src/com/android/server/notification/DefaultDeviceEffectsApplierTest.java index 4a199738cccd..1890879da69d 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/DefaultDeviceEffectsApplierTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/DefaultDeviceEffectsApplierTest.java @@ -39,6 +39,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; +import android.app.KeyguardManager; import android.app.UiModeManager; import android.app.WallpaperManager; import android.content.BroadcastReceiver; @@ -78,6 +79,7 @@ public class DefaultDeviceEffectsApplierTest { private DefaultDeviceEffectsApplier mApplier; @Mock PowerManager mPowerManager; @Mock ColorDisplayManager mColorDisplayManager; + @Mock KeyguardManager mKeyguardManager; @Mock UiModeManager mUiModeManager; @Mock WallpaperManager mWallpaperManager; @@ -87,6 +89,7 @@ public class DefaultDeviceEffectsApplierTest { mContext = spy(new TestableContext(InstrumentationRegistry.getContext(), null)); mContext.addMockSystemService(PowerManager.class, mPowerManager); mContext.addMockSystemService(ColorDisplayManager.class, mColorDisplayManager); + mContext.addMockSystemService(KeyguardManager.class, mKeyguardManager); mContext.addMockSystemService(UiModeManager.class, mUiModeManager); mContext.addMockSystemService(WallpaperManager.class, mWallpaperManager); when(mWallpaperManager.isWallpaperSupported()).thenReturn(true); @@ -310,6 +313,22 @@ public class DefaultDeviceEffectsApplierTest { verify(mContext, never()).registerReceiver(any(), any(), anyInt()); } + @Test + @EnableFlags({android.app.Flags.FLAG_MODES_API, android.app.Flags.FLAG_MODES_UI}) + public void apply_nightModeWithScreenOnAndKeyguardShowing_appliedImmediately( + @TestParameter ZenChangeOrigin origin) { + + when(mPowerManager.isInteractive()).thenReturn(true); + when(mKeyguardManager.isKeyguardLocked()).thenReturn(true); + + mApplier.apply(new ZenDeviceEffects.Builder().setShouldUseNightMode(true).build(), + origin.value()); + + // Effect was applied, and no broadcast receiver was registered. + verify(mUiModeManager).setAttentionModeThemeOverlay(eq(MODE_ATTENTION_THEME_OVERLAY_NIGHT)); + verify(mContext, never()).registerReceiver(any(), any(), anyInt()); + } + @Test @TestParameters({"{origin: ORIGIN_USER_IN_SYSTEMUI}", "{origin: ORIGIN_USER_IN_APP}", "{origin: ORIGIN_INIT}", "{origin: ORIGIN_INIT_USER}"}) -- GitLab From d7e7535cdf8ec9635b3d1c44f12b2c61a8dcc388 Mon Sep 17 00:00:00 2001 From: Beth Thibodeau Date: Fri, 6 Sep 2024 18:54:31 +0000 Subject: [PATCH 061/492] Revert^2 "Add LogBuffer for media device changes" This reverts commit 84f36038bb27a9c884da510c9a0d0ab083f3d36a. Reason for revert: re-landing, see b/363398124#comment8 Change-Id: I2aecff2620e7444b88b66140dbc1c84e59cd2ebf --- .../systemui/log/dagger/LogModule.java | 10 ++ .../systemui/log/dagger/MediaDeviceLog.kt | 26 ++++ .../domain/pipeline/MediaDeviceLogger.kt | 116 ++++++++++++++++++ .../domain/pipeline/MediaDeviceManager.kt | 60 +++------ .../domain/pipeline/MediaDeviceManagerTest.kt | 4 + .../pipeline/MediaDeviceLoggerKosmos.kt | 23 ++++ .../pipeline/MediaDeviceManagerKosmos.kt | 1 + 7 files changed, 200 insertions(+), 40 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/log/dagger/MediaDeviceLog.kt create mode 100644 packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceLogger.kt create mode 100644 packages/SystemUI/tests/utils/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceLoggerKosmos.kt diff --git a/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java b/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java index ba3c1d216099..ed766469094e 100644 --- a/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java +++ b/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java @@ -382,6 +382,16 @@ public class LogModule { return factory.create("MediaLog", 20); } + /** + * Provides a buffer for media device changes + */ + @Provides + @SysUISingleton + @MediaDeviceLog + public static LogBuffer providesMediaDeviceLogBuffer(LogBufferFactory factory) { + return factory.create("MediaDeviceLog", 50); + } + /** Allows logging buffers to be tweaked via adb on debug builds but not on prod builds. */ @Provides @SysUISingleton diff --git a/packages/SystemUI/src/com/android/systemui/log/dagger/MediaDeviceLog.kt b/packages/SystemUI/src/com/android/systemui/log/dagger/MediaDeviceLog.kt new file mode 100644 index 000000000000..06bd26971232 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/log/dagger/MediaDeviceLog.kt @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.log.dagger + +import com.android.systemui.log.LogBuffer +import javax.inject.Qualifier + +/** A [LogBuffer] for [com.android.systemui.media.controls.domain.pipeline.MediaDeviceLogger] */ +@Qualifier +@MustBeDocumented +@Retention(AnnotationRetention.RUNTIME) +annotation class MediaDeviceLog diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceLogger.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceLogger.kt new file mode 100644 index 000000000000..f886166b986b --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceLogger.kt @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.media.controls.domain.pipeline + +import android.media.session.MediaController +import com.android.settingslib.media.MediaDevice +import com.android.systemui.log.LogBuffer +import com.android.systemui.log.core.LogLevel +import com.android.systemui.log.dagger.MediaDeviceLog +import com.android.systemui.media.controls.shared.model.MediaDeviceData +import javax.inject.Inject + +/** A [LogBuffer] for media device changes */ +class MediaDeviceLogger @Inject constructor(@MediaDeviceLog private val buffer: LogBuffer) { + + fun logBroadcastEvent(event: String, reason: Int, broadcastId: Int) { + buffer.log( + TAG, + LogLevel.DEBUG, + { + str1 = event + int1 = reason + int2 = broadcastId + }, + { "$str1, reason = $int1, broadcastId = $int2" } + ) + } + + fun logBroadcastEvent(event: String, reason: Int) { + buffer.log( + TAG, + LogLevel.DEBUG, + { + str1 = event + int1 = reason + }, + { "$str1, reason = $int1" } + ) + } + + fun logBroadcastMetadataChanged(broadcastId: Int, metadata: String) { + buffer.log( + TAG, + LogLevel.DEBUG, + { + int1 = broadcastId + str1 = metadata + }, + { "onBroadcastMetadataChanged, broadcastId = $int1, metadata = $str1" } + ) + } + + fun logNewDeviceName(name: String?) { + buffer.log(TAG, LogLevel.DEBUG, { str1 = name }, { "New device name $str1" }) + } + + fun logLocalDevice(sassDevice: MediaDeviceData?, connectedDevice: MediaDeviceData?) { + buffer.log( + TAG, + LogLevel.DEBUG, + { + str1 = sassDevice?.name?.toString() + str2 = connectedDevice?.name?.toString() + }, + { "Local device: $str1 or $str2" } + ) + } + + fun logRemoteDevice(routingSessionName: CharSequence?, connectedDevice: MediaDeviceData?) { + buffer.log( + TAG, + LogLevel.DEBUG, + { + str1 = routingSessionName?.toString() + str2 = connectedDevice?.name?.toString() + }, + { "Remote device: $str1 or $str2 or unknown" } + ) + } + + fun logDeviceName( + device: MediaDevice?, + controller: MediaController?, + routingSessionName: CharSequence?, + selectedRouteName: CharSequence? + ) { + buffer.log( + TAG, + LogLevel.DEBUG, + { + str1 = "device $device, controller: $controller" + str2 = routingSessionName?.toString() + str3 = selectedRouteName?.toString() + }, + { "$str1, routingSession $str2 or selected route $str3" } + ) + } + + companion object { + private const val TAG = "MediaDeviceLog" + } +} diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManager.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManager.kt index a193f7f8f498..49b53c2d78ae 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManager.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManager.kt @@ -71,6 +71,7 @@ constructor( private val localBluetoothManager: Lazy, @Main private val fgExecutor: Executor, @Background private val bgExecutor: Executor, + private val logger: MediaDeviceLogger, ) : MediaDataManager.Listener { private val listeners: MutableSet = mutableSetOf() @@ -281,59 +282,38 @@ constructor( } override fun onBroadcastStarted(reason: Int, broadcastId: Int) { - if (DEBUG) { - Log.d(TAG, "onBroadcastStarted(), reason = $reason , broadcastId = $broadcastId") - } + logger.logBroadcastEvent("onBroadcastStarted", reason, broadcastId) updateCurrent() } override fun onBroadcastStartFailed(reason: Int) { - if (DEBUG) { - Log.d(TAG, "onBroadcastStartFailed(), reason = $reason") - } + logger.logBroadcastEvent("onBroadcastStartFailed", reason) } override fun onBroadcastMetadataChanged( broadcastId: Int, metadata: BluetoothLeBroadcastMetadata ) { - if (DEBUG) { - Log.d( - TAG, - "onBroadcastMetadataChanged(), broadcastId = $broadcastId , " + - "metadata = $metadata" - ) - } + logger.logBroadcastMetadataChanged(broadcastId, metadata.toString()) updateCurrent() } override fun onBroadcastStopped(reason: Int, broadcastId: Int) { - if (DEBUG) { - Log.d(TAG, "onBroadcastStopped(), reason = $reason , broadcastId = $broadcastId") - } + logger.logBroadcastEvent("onBroadcastStopped", reason, broadcastId) updateCurrent() } override fun onBroadcastStopFailed(reason: Int) { - if (DEBUG) { - Log.d(TAG, "onBroadcastStopFailed(), reason = $reason") - } + logger.logBroadcastEvent("onBroadcastStopFailed", reason) } override fun onBroadcastUpdated(reason: Int, broadcastId: Int) { - if (DEBUG) { - Log.d(TAG, "onBroadcastUpdated(), reason = $reason , broadcastId = $broadcastId") - } + logger.logBroadcastEvent("onBroadcastUpdated", reason, broadcastId) updateCurrent() } override fun onBroadcastUpdateFailed(reason: Int, broadcastId: Int) { - if (DEBUG) { - Log.d( - TAG, - "onBroadcastUpdateFailed(), reason = $reason , " + "broadcastId = $broadcastId" - ) - } + logger.logBroadcastEvent("onBroadcastUpdateFailed", reason, broadcastId) } override fun onPlaybackStarted(reason: Int, broadcastId: Int) {} @@ -381,12 +361,16 @@ constructor( name = context.getString(R.string.media_seamless_other_device), showBroadcastButton = false ) + logger.logRemoteDevice(routingSession?.name, connectedDevice) } else { // Prefer SASS if available when playback is local. - activeDevice = getSassDevice() ?: connectedDevice + val sassDevice = getSassDevice() + activeDevice = sassDevice ?: connectedDevice + logger.logLocalDevice(sassDevice, connectedDevice) } current = activeDevice ?: EMPTY_AND_DISABLED_MEDIA_DEVICE_DATA + logger.logNewDeviceName(current?.name?.toString()) } else { val aboutToConnect = aboutToConnectDeviceOverride if ( @@ -407,9 +391,7 @@ constructor( val enabled = device != null && (controller == null || routingSession != null) val name = getDeviceName(device, routingSession) - if (DEBUG) { - Log.d(TAG, "new device name $name") - } + logger.logNewDeviceName(name) current = MediaDeviceData( enabled, @@ -463,14 +445,12 @@ constructor( ): String? { val selectedRoutes = routingSession?.let { mr2manager.get().getSelectedRoutes(it) } - if (DEBUG) { - Log.d( - TAG, - "device is $device, controller $controller," + - " routingSession ${routingSession?.name}" + - " or ${selectedRoutes?.firstOrNull()?.name}" - ) - } + logger.logDeviceName( + device, + controller, + routingSession?.name, + selectedRoutes?.firstOrNull()?.name + ) if (controller == null) { // In resume state, we don't have a controller - just use the device name diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerTest.kt index 6a66c4087615..0c8d88065a73 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerTest.kt @@ -54,6 +54,7 @@ import com.android.systemui.media.muteawait.MediaMuteAwaitConnectionManager import com.android.systemui.media.muteawait.MediaMuteAwaitConnectionManagerFactory import com.android.systemui.res.R import com.android.systemui.statusbar.policy.ConfigurationController +import com.android.systemui.testKosmos import com.android.systemui.util.concurrency.FakeExecutor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat @@ -125,6 +126,8 @@ public class MediaDeviceManagerTest : SysuiTestCase() { private lateinit var mediaData: MediaData @JvmField @Rule val mockito = MockitoJUnit.rule() + private val kosmos = testKosmos() + @Before fun setUp() { fakeFgExecutor = FakeExecutor(FakeSystemClock()) @@ -141,6 +144,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { { localBluetoothManager }, fakeFgExecutor, fakeBgExecutor, + kosmos.mediaDeviceLogger, ) manager.addListener(listener) diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceLoggerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceLoggerKosmos.kt new file mode 100644 index 000000000000..76d71dd05edd --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceLoggerKosmos.kt @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.media.controls.domain.pipeline + +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.log.logcatLogBuffer + +var Kosmos.mediaDeviceLogger by + Kosmos.Fixture { MediaDeviceLogger(logcatLogBuffer("MediaDeviceLoggerKosmos")) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerKosmos.kt index c479ce676761..11408d8a4b90 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerKosmos.kt @@ -41,5 +41,6 @@ val Kosmos.mediaDeviceManager by }, fgExecutor = fakeExecutor, bgExecutor = fakeExecutor, + logger = mediaDeviceLogger, ) } -- GitLab From a17aac0b5508e8bb9f22317c48fc2ef02ec733ad Mon Sep 17 00:00:00 2001 From: Danny Burakov Date: Fri, 6 Sep 2024 18:40:34 +0000 Subject: [PATCH 062/492] Revert^2 "[bc25] Add Dual Shade invocation zone detection." This reverts commit ff11169df3763dd0428493110046f8c607894f7f. Reason for revert: Fixed issue with the original CL, ag/29186805. The culprit for the error was an API change made in ag/29139984, that somehow didn't fail presubmit. Bug: 338577208 Bug: 338033836 Bug: 356596436 Flag: com.android.systemui.scene_container Flag: com.android.systemui.dual_shade Test: Added unit tests. Test: Existing unit tests still pass. Change-Id: If2b3635ea8c7ae697942a54fc0d2810d60e7213c --- .../scene/ui/composable/SceneContainer.kt | 6 +- .../viewmodel/SceneContainerViewModelTest.kt | 54 ++++ .../ui/viewmodel/SplitEdgeDetectorTest.kt | 274 ++++++++++++++++++ .../interactor/ShadeInteractorImplTest.kt | 46 ++- .../NotificationsShadeUserActionsViewModel.kt | 8 +- .../QuickSettingsShadeUserActionsViewModel.kt | 11 + ...yguardlessSceneContainerFrameworkModule.kt | 13 + .../scene/SceneContainerFrameworkModule.kt | 13 + .../ui/viewmodel/SceneContainerViewModel.kt | 21 ++ .../scene/ui/viewmodel/SplitEdgeDetector.kt | 116 ++++++++ .../domain/interactor/ShadeInteractor.kt | 15 + .../interactor/ShadeInteractorEmptyImpl.kt | 2 + .../domain/interactor/ShadeInteractorImpl.kt | 11 + .../com/android/systemui/scene/SceneKosmos.kt | 4 + .../ui/viewmodel/SplitEdgeDetectorKosmos.kt | 29 ++ 15 files changed, 608 insertions(+), 15 deletions(-) create mode 100644 packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetectorTest.kt create mode 100644 packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetector.kt create mode 100644 packages/SystemUI/tests/utils/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetectorKosmos.kt diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainer.kt index 3cb0d8af1ba4..df101c558dff 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainer.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainer.kt @@ -128,7 +128,11 @@ fun SceneContainer( } }, ) { - SceneTransitionLayout(state = state, modifier = modifier.fillMaxSize()) { + SceneTransitionLayout( + state = state, + modifier = modifier.fillMaxSize(), + swipeSourceDetector = viewModel.edgeDetector, + ) { sceneByKey.forEach { (sceneKey, scene) -> scene( key = sceneKey, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneContainerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneContainerViewModelTest.kt index 4b132c4276ea..a0bb01797f2c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneContainerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneContainerViewModelTest.kt @@ -18,9 +18,12 @@ package com.android.systemui.scene.ui.viewmodel +import android.platform.test.annotations.DisableFlags +import android.platform.test.annotations.EnableFlags import android.view.MotionEvent import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest +import com.android.compose.animation.scene.DefaultEdgeDetector import com.android.systemui.SysuiTestCase import com.android.systemui.classifier.domain.interactor.falsingInteractor import com.android.systemui.classifier.fakeFalsingManager @@ -37,6 +40,10 @@ import com.android.systemui.scene.shared.logger.sceneLogger import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.shared.model.fakeSceneDataSource +import com.android.systemui.shade.data.repository.fakeShadeRepository +import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.shared.flag.DualShade +import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever @@ -60,6 +67,7 @@ class SceneContainerViewModelTest : SysuiTestCase() { private val testScope by lazy { kosmos.testScope } private val sceneInteractor by lazy { kosmos.sceneInteractor } private val fakeSceneDataSource by lazy { kosmos.fakeSceneDataSource } + private val fakeShadeRepository by lazy { kosmos.fakeShadeRepository } private val sceneContainerConfig by lazy { kosmos.sceneContainerConfig } private val falsingManager by lazy { kosmos.fakeFalsingManager } @@ -75,6 +83,8 @@ class SceneContainerViewModelTest : SysuiTestCase() { sceneInteractor = sceneInteractor, falsingInteractor = kosmos.falsingInteractor, powerInteractor = kosmos.powerInteractor, + shadeInteractor = kosmos.shadeInteractor, + splitEdgeDetector = kosmos.splitEdgeDetector, logger = kosmos.sceneLogger, motionEventHandlerReceiver = { motionEventHandler -> this@SceneContainerViewModelTest.motionEventHandler = motionEventHandler @@ -287,4 +297,48 @@ class SceneContainerViewModelTest : SysuiTestCase() { assertThat(actionableContentKey).isEqualTo(Overlays.QuickSettingsShade) } + + @Test + @DisableFlags(DualShade.FLAG_NAME) + fun edgeDetector_singleShade_usesDefaultEdgeDetector() = + testScope.runTest { + val shadeMode by collectLastValue(kosmos.shadeInteractor.shadeMode) + fakeShadeRepository.setShadeLayoutWide(false) + assertThat(shadeMode).isEqualTo(ShadeMode.Single) + + assertThat(underTest.edgeDetector).isEqualTo(DefaultEdgeDetector) + } + + @Test + @DisableFlags(DualShade.FLAG_NAME) + fun edgeDetector_splitShade_usesDefaultEdgeDetector() = + testScope.runTest { + val shadeMode by collectLastValue(kosmos.shadeInteractor.shadeMode) + fakeShadeRepository.setShadeLayoutWide(true) + assertThat(shadeMode).isEqualTo(ShadeMode.Split) + + assertThat(underTest.edgeDetector).isEqualTo(DefaultEdgeDetector) + } + + @Test + @EnableFlags(DualShade.FLAG_NAME) + fun edgeDetector_dualShade_narrowScreen_usesSplitEdgeDetector() = + testScope.runTest { + val shadeMode by collectLastValue(kosmos.shadeInteractor.shadeMode) + fakeShadeRepository.setShadeLayoutWide(false) + + assertThat(shadeMode).isEqualTo(ShadeMode.Dual) + assertThat(underTest.edgeDetector).isEqualTo(kosmos.splitEdgeDetector) + } + + @Test + @EnableFlags(DualShade.FLAG_NAME) + fun edgeDetector_dualShade_wideScreen_usesSplitEdgeDetector() = + testScope.runTest { + val shadeMode by collectLastValue(kosmos.shadeInteractor.shadeMode) + fakeShadeRepository.setShadeLayoutWide(true) + + assertThat(shadeMode).isEqualTo(ShadeMode.Dual) + assertThat(underTest.edgeDetector).isEqualTo(kosmos.splitEdgeDetector) + } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetectorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetectorTest.kt new file mode 100644 index 000000000000..3d76d280b2cc --- /dev/null +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetectorTest.kt @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.scene.ui.viewmodel + +import androidx.compose.foundation.gestures.Orientation +import androidx.compose.ui.unit.Density +import androidx.compose.ui.unit.IntOffset +import androidx.compose.ui.unit.IntSize +import androidx.compose.ui.unit.LayoutDirection +import androidx.compose.ui.unit.dp +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.systemui.SysuiTestCase +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.End +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.Resolved.Bottom +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.Resolved.Left +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.Resolved.Right +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.Resolved.TopLeft +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.Resolved.TopRight +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.Start +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.TopEnd +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge.TopStart +import com.google.common.truth.Truth.assertThat +import kotlin.test.assertFailsWith +import org.junit.Test +import org.junit.runner.RunWith + +@SmallTest +@RunWith(AndroidJUnit4::class) +class SplitEdgeDetectorTest : SysuiTestCase() { + + private val edgeSize = 40 + private val screenWidth = 800 + private val screenHeight = 600 + + private var edgeSplitFraction = 0.7f + + private val underTest = + SplitEdgeDetector( + topEdgeSplitFraction = { edgeSplitFraction }, + edgeSize = edgeSize.dp, + ) + + @Test + fun source_noEdge_detectsNothing() { + val detectedEdge = + swipeVerticallyFrom( + x = screenWidth / 2, + y = screenHeight / 2, + ) + assertThat(detectedEdge).isNull() + } + + @Test + fun source_swipeVerticallyOnTopLeft_detectsTopLeft() { + val detectedEdge = + swipeVerticallyFrom( + x = 1, + y = edgeSize - 1, + ) + assertThat(detectedEdge).isEqualTo(TopLeft) + } + + @Test + fun source_swipeHorizontallyOnTopLeft_detectsLeft() { + val detectedEdge = + swipeHorizontallyFrom( + x = 1, + y = edgeSize - 1, + ) + assertThat(detectedEdge).isEqualTo(Left) + } + + @Test + fun source_swipeVerticallyOnTopRight_detectsTopRight() { + val detectedEdge = + swipeVerticallyFrom( + x = screenWidth - 1, + y = edgeSize - 1, + ) + assertThat(detectedEdge).isEqualTo(TopRight) + } + + @Test + fun source_swipeHorizontallyOnTopRight_detectsRight() { + val detectedEdge = + swipeHorizontallyFrom( + x = screenWidth - 1, + y = edgeSize - 1, + ) + assertThat(detectedEdge).isEqualTo(Right) + } + + @Test + fun source_swipeVerticallyToLeftOfSplit_detectsTopLeft() { + val detectedEdge = + swipeVerticallyFrom( + x = (screenWidth * edgeSplitFraction).toInt() - 1, + y = edgeSize - 1, + ) + assertThat(detectedEdge).isEqualTo(TopLeft) + } + + @Test + fun source_swipeVerticallyToRightOfSplit_detectsTopRight() { + val detectedEdge = + swipeVerticallyFrom( + x = (screenWidth * edgeSplitFraction).toInt() + 1, + y = edgeSize - 1, + ) + assertThat(detectedEdge).isEqualTo(TopRight) + } + + @Test + fun source_edgeSplitFractionUpdatesDynamically() { + val middleX = (screenWidth * 0.5f).toInt() + val topY = 0 + + // Split closer to the right; middle of screen is considered "left". + edgeSplitFraction = 0.6f + assertThat(swipeVerticallyFrom(x = middleX, y = topY)).isEqualTo(TopLeft) + + // Split closer to the left; middle of screen is considered "right". + edgeSplitFraction = 0.4f + assertThat(swipeVerticallyFrom(x = middleX, y = topY)).isEqualTo(TopRight) + + // Illegal fraction. + edgeSplitFraction = 1.2f + assertFailsWith { swipeVerticallyFrom(x = middleX, y = topY) } + + // Illegal fraction. + edgeSplitFraction = -0.3f + assertFailsWith { swipeVerticallyFrom(x = middleX, y = topY) } + } + + @Test + fun source_swipeVerticallyOnBottom_detectsBottom() { + val detectedEdge = + swipeVerticallyFrom( + x = screenWidth / 3, + y = screenHeight - (edgeSize / 2), + ) + assertThat(detectedEdge).isEqualTo(Bottom) + } + + @Test + fun source_swipeHorizontallyOnBottom_detectsNothing() { + val detectedEdge = + swipeHorizontallyFrom( + x = screenWidth / 3, + y = screenHeight - (edgeSize - 1), + ) + assertThat(detectedEdge).isNull() + } + + @Test + fun source_swipeHorizontallyOnLeft_detectsLeft() { + val detectedEdge = + swipeHorizontallyFrom( + x = edgeSize - 1, + y = screenHeight / 2, + ) + assertThat(detectedEdge).isEqualTo(Left) + } + + @Test + fun source_swipeVerticallyOnLeft_detectsNothing() { + val detectedEdge = + swipeVerticallyFrom( + x = edgeSize - 1, + y = screenHeight / 2, + ) + assertThat(detectedEdge).isNull() + } + + @Test + fun source_swipeHorizontallyOnRight_detectsRight() { + val detectedEdge = + swipeHorizontallyFrom( + x = screenWidth - edgeSize + 1, + y = screenHeight / 2, + ) + assertThat(detectedEdge).isEqualTo(Right) + } + + @Test + fun source_swipeVerticallyOnRight_detectsNothing() { + val detectedEdge = + swipeVerticallyFrom( + x = screenWidth - edgeSize + 1, + y = screenHeight / 2, + ) + assertThat(detectedEdge).isNull() + } + + @Test + fun resolve_startInLtr_resolvesLeft() { + val resolvedEdge = Start.resolve(LayoutDirection.Ltr) + assertThat(resolvedEdge).isEqualTo(Left) + } + + @Test + fun resolve_startInRtl_resolvesRight() { + val resolvedEdge = Start.resolve(LayoutDirection.Rtl) + assertThat(resolvedEdge).isEqualTo(Right) + } + + @Test + fun resolve_endInLtr_resolvesRight() { + val resolvedEdge = End.resolve(LayoutDirection.Ltr) + assertThat(resolvedEdge).isEqualTo(Right) + } + + @Test + fun resolve_endInRtl_resolvesLeft() { + val resolvedEdge = End.resolve(LayoutDirection.Rtl) + assertThat(resolvedEdge).isEqualTo(Left) + } + + @Test + fun resolve_topStartInLtr_resolvesTopLeft() { + val resolvedEdge = TopStart.resolve(LayoutDirection.Ltr) + assertThat(resolvedEdge).isEqualTo(TopLeft) + } + + @Test + fun resolve_topStartInRtl_resolvesTopRight() { + val resolvedEdge = TopStart.resolve(LayoutDirection.Rtl) + assertThat(resolvedEdge).isEqualTo(TopRight) + } + + @Test + fun resolve_topEndInLtr_resolvesTopRight() { + val resolvedEdge = TopEnd.resolve(LayoutDirection.Ltr) + assertThat(resolvedEdge).isEqualTo(TopRight) + } + + @Test + fun resolve_topEndInRtl_resolvesTopLeft() { + val resolvedEdge = TopEnd.resolve(LayoutDirection.Rtl) + assertThat(resolvedEdge).isEqualTo(TopLeft) + } + + private fun swipeVerticallyFrom(x: Int, y: Int): SceneContainerEdge.Resolved? { + return swipeFrom(x, y, Orientation.Vertical) + } + + private fun swipeHorizontallyFrom(x: Int, y: Int): SceneContainerEdge.Resolved? { + return swipeFrom(x, y, Orientation.Horizontal) + } + + private fun swipeFrom(x: Int, y: Int, orientation: Orientation): SceneContainerEdge.Resolved? { + return underTest.source( + layoutSize = IntSize(width = screenWidth, height = screenHeight), + position = IntOffset(x, y), + density = Density(1f), + orientation = orientation, + ) + } +} diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt index 3283ea154b3f..9464c75eeb71 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt @@ -24,7 +24,6 @@ import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase -import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.parameterizeSceneContainerFlag import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository @@ -39,6 +38,7 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.power.data.repository.fakePowerRepository import com.android.systemui.power.shared.model.WakeSleepReason import com.android.systemui.power.shared.model.WakefulnessState +import com.android.systemui.shade.data.repository.fakeShadeRepository import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.shade.shadeTestUtil import com.android.systemui.shade.shared.flag.DualShade @@ -66,18 +66,18 @@ import platform.test.runner.parameterized.Parameters @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { - val kosmos = testKosmos() - val testScope = kosmos.testScope - val configurationRepository by lazy { kosmos.fakeConfigurationRepository } - val deviceProvisioningRepository by lazy { kosmos.fakeDeviceProvisioningRepository } - val disableFlagsRepository by lazy { kosmos.fakeDisableFlagsRepository } - val keyguardRepository by lazy { kosmos.fakeKeyguardRepository } - val keyguardTransitionRepository by lazy { kosmos.fakeKeyguardTransitionRepository } - val powerRepository by lazy { kosmos.fakePowerRepository } - val shadeTestUtil by lazy { kosmos.shadeTestUtil } - val userRepository by lazy { kosmos.fakeUserRepository } - val userSetupRepository by lazy { kosmos.fakeUserSetupRepository } - val dozeParameters by lazy { kosmos.dozeParameters } + private val kosmos = testKosmos() + private val testScope = kosmos.testScope + private val deviceProvisioningRepository by lazy { kosmos.fakeDeviceProvisioningRepository } + private val disableFlagsRepository by lazy { kosmos.fakeDisableFlagsRepository } + private val keyguardRepository by lazy { kosmos.fakeKeyguardRepository } + private val keyguardTransitionRepository by lazy { kosmos.fakeKeyguardTransitionRepository } + private val powerRepository by lazy { kosmos.fakePowerRepository } + private val shadeRepository by lazy { kosmos.fakeShadeRepository } + private val shadeTestUtil by lazy { kosmos.shadeTestUtil } + private val userRepository by lazy { kosmos.fakeUserRepository } + private val userSetupRepository by lazy { kosmos.fakeUserSetupRepository } + private val dozeParameters by lazy { kosmos.dozeParameters } lateinit var underTest: ShadeInteractorImpl @@ -497,4 +497,24 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { assertThat(shadeMode).isEqualTo(ShadeMode.Dual) } + + @Test + fun getTopEdgeSplitFraction_narrowScreen_splitInHalf() = + testScope.runTest { + // Ensure isShadeLayoutWide is collected. + val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) + shadeRepository.setShadeLayoutWide(false) + + assertThat(underTest.getTopEdgeSplitFraction()).isEqualTo(0.5f) + } + + @Test + fun getTopEdgeSplitFraction_wideScreen_leftSideLarger() = + testScope.runTest { + // Ensure isShadeLayoutWide is collected. + val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) + shadeRepository.setShadeLayoutWide(true) + + assertThat(underTest.getTopEdgeSplitFraction()).isGreaterThan(0.5f) + } } diff --git a/packages/SystemUI/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeUserActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeUserActionsViewModel.kt index a5c07bc2fdbf..11854d9317c9 100644 --- a/packages/SystemUI/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeUserActionsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeUserActionsViewModel.kt @@ -18,9 +18,13 @@ package com.android.systemui.notifications.ui.viewmodel import com.android.compose.animation.scene.Back import com.android.compose.animation.scene.Swipe +import com.android.compose.animation.scene.SwipeDirection import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult +import com.android.compose.animation.scene.UserActionResult.ReplaceByOverlay +import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.SceneFamilies +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge import com.android.systemui.scene.ui.viewmodel.UserActionsViewModel import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject @@ -34,8 +38,10 @@ class NotificationsShadeUserActionsViewModel @AssistedInject constructor() : override suspend fun hydrateActions(setActions: (Map) -> Unit) { setActions( mapOf( - Swipe.Up to SceneFamilies.Home, Back to SceneFamilies.Home, + Swipe.Up to SceneFamilies.Home, + Swipe(direction = SwipeDirection.Down, fromSource = SceneContainerEdge.TopRight) to + ReplaceByOverlay(Overlays.QuickSettingsShade), ) ) } diff --git a/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeUserActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeUserActionsViewModel.kt index d3dc302d44ca..bd1872d455d0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeUserActionsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeUserActionsViewModel.kt @@ -18,9 +18,13 @@ package com.android.systemui.qs.ui.viewmodel import com.android.compose.animation.scene.Back import com.android.compose.animation.scene.Swipe +import com.android.compose.animation.scene.SwipeDirection import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult +import com.android.compose.animation.scene.UserActionResult.ReplaceByOverlay +import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.SceneFamilies +import com.android.systemui.scene.ui.viewmodel.SceneContainerEdge import com.android.systemui.scene.ui.viewmodel.UserActionsViewModel import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject @@ -43,6 +47,13 @@ constructor( .map { editing -> buildMap { put(Swipe.Up, UserActionResult(SceneFamilies.Home)) + put( + Swipe( + direction = SwipeDirection.Down, + fromSource = SceneContainerEdge.TopLeft + ), + ReplaceByOverlay(Overlays.NotificationsShade) + ) if (!editing) { put(Back, UserActionResult(SceneFamilies.Home)) } diff --git a/packages/SystemUI/src/com/android/systemui/scene/KeyguardlessSceneContainerFrameworkModule.kt b/packages/SystemUI/src/com/android/systemui/scene/KeyguardlessSceneContainerFrameworkModule.kt index 00944b8d0849..834db98263f5 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/KeyguardlessSceneContainerFrameworkModule.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/KeyguardlessSceneContainerFrameworkModule.kt @@ -16,6 +16,7 @@ package com.android.systemui.scene +import androidx.compose.ui.unit.dp import com.android.systemui.CoreStartable import com.android.systemui.notifications.ui.composable.NotificationsShadeSessionModule import com.android.systemui.scene.domain.SceneDomainModule @@ -30,6 +31,8 @@ import com.android.systemui.scene.domain.startable.StatusBarStartable import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.SceneContainerConfig import com.android.systemui.scene.shared.model.Scenes +import com.android.systemui.scene.ui.viewmodel.SplitEdgeDetector +import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.shade.shared.flag.DualShade import dagger.Binds import dagger.Module @@ -119,5 +122,15 @@ interface KeyguardlessSceneContainerFrameworkModule { .mapValues { checkNotNull(it.value) } ) } + + @Provides + fun splitEdgeDetector(shadeInteractor: ShadeInteractor): SplitEdgeDetector { + return SplitEdgeDetector( + topEdgeSplitFraction = shadeInteractor::getTopEdgeSplitFraction, + // TODO(b/338577208): This should be 60dp at the top in the dual-shade UI. Better to + // replace this constant with dynamic window insets. + edgeSize = 40.dp + ) + } } } diff --git a/packages/SystemUI/src/com/android/systemui/scene/SceneContainerFrameworkModule.kt b/packages/SystemUI/src/com/android/systemui/scene/SceneContainerFrameworkModule.kt index 4061ad851f57..a4c7d00d0e80 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/SceneContainerFrameworkModule.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/SceneContainerFrameworkModule.kt @@ -16,6 +16,7 @@ package com.android.systemui.scene +import androidx.compose.ui.unit.dp import com.android.systemui.CoreStartable import com.android.systemui.notifications.ui.composable.NotificationsShadeSessionModule import com.android.systemui.scene.domain.SceneDomainModule @@ -30,6 +31,8 @@ import com.android.systemui.scene.domain.startable.StatusBarStartable import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.SceneContainerConfig import com.android.systemui.scene.shared.model.Scenes +import com.android.systemui.scene.ui.viewmodel.SplitEdgeDetector +import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.shade.shared.flag.DualShade import dagger.Binds import dagger.Module @@ -129,5 +132,15 @@ interface SceneContainerFrameworkModule { .mapValues { checkNotNull(it.value) } ) } + + @Provides + fun splitEdgeDetector(shadeInteractor: ShadeInteractor): SplitEdgeDetector { + return SplitEdgeDetector( + topEdgeSplitFraction = shadeInteractor::getTopEdgeSplitFraction, + // TODO(b/338577208): This should be 60dp at the top in the dual-shade UI. Better to + // replace this constant with dynamic window insets. + edgeSize = 40.dp + ) + } } } diff --git a/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/SceneContainerViewModel.kt b/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/SceneContainerViewModel.kt index 4c6341b672ad..54823945a827 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/SceneContainerViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/SceneContainerViewModel.kt @@ -19,9 +19,11 @@ package com.android.systemui.scene.ui.viewmodel import android.view.MotionEvent import androidx.compose.runtime.getValue import com.android.compose.animation.scene.ContentKey +import com.android.compose.animation.scene.DefaultEdgeDetector import com.android.compose.animation.scene.ObservableTransitionState import com.android.compose.animation.scene.OverlayKey import com.android.compose.animation.scene.SceneKey +import com.android.compose.animation.scene.SwipeSourceDetector import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.systemui.classifier.Classifier @@ -33,12 +35,15 @@ import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.logger.SceneLogger import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.ui.composable.Overlay +import com.android.systemui.shade.domain.interactor.ShadeInteractor +import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.map /** Models UI state for the scene container. */ class SceneContainerViewModel @@ -47,6 +52,8 @@ constructor( private val sceneInteractor: SceneInteractor, private val falsingInteractor: FalsingInteractor, private val powerInteractor: PowerInteractor, + private val shadeInteractor: ShadeInteractor, + private val splitEdgeDetector: SplitEdgeDetector, private val logger: SceneLogger, @Assisted private val motionEventHandlerReceiver: (MotionEventHandler?) -> Unit, ) : ExclusiveActivatable() { @@ -59,6 +66,20 @@ constructor( /** Whether the container is visible. */ val isVisible: Boolean by hydrator.hydratedStateOf("isVisible", sceneInteractor.isVisible) + /** + * The [SwipeSourceDetector] to use for defining which edges of the screen can be defined in the + * [UserAction]s for this container. + */ + val edgeDetector: SwipeSourceDetector by + hydrator.hydratedStateOf( + traceName = "edgeDetector", + initialValue = DefaultEdgeDetector, + source = + shadeInteractor.shadeMode.map { + if (it is ShadeMode.Dual) splitEdgeDetector else DefaultEdgeDetector + } + ) + override suspend fun onActivated(): Nothing { try { // Sends a MotionEventHandler to the owner of the view-model so they can report diff --git a/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetector.kt b/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetector.kt new file mode 100644 index 000000000000..f88bcb57a27d --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetector.kt @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.scene.ui.viewmodel + +import androidx.compose.foundation.gestures.Orientation +import androidx.compose.ui.unit.Density +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.IntOffset +import androidx.compose.ui.unit.IntSize +import androidx.compose.ui.unit.LayoutDirection +import com.android.compose.animation.scene.Edge +import com.android.compose.animation.scene.FixedSizeEdgeDetector +import com.android.compose.animation.scene.SwipeSource +import com.android.compose.animation.scene.SwipeSourceDetector + +/** + * The edge of a [SceneContainer]. It differs from a standard [Edge] by splitting the top edge into + * top-left and top-right. + */ +enum class SceneContainerEdge(private val resolveEdge: (LayoutDirection) -> Resolved) : + SwipeSource { + TopLeft(resolveEdge = { Resolved.TopLeft }), + TopRight(resolveEdge = { Resolved.TopRight }), + TopStart( + resolveEdge = { if (it == LayoutDirection.Ltr) Resolved.TopLeft else Resolved.TopRight } + ), + TopEnd( + resolveEdge = { if (it == LayoutDirection.Ltr) Resolved.TopRight else Resolved.TopLeft } + ), + Bottom(resolveEdge = { Resolved.Bottom }), + Left(resolveEdge = { Resolved.Left }), + Right(resolveEdge = { Resolved.Right }), + Start(resolveEdge = { if (it == LayoutDirection.Ltr) Resolved.Left else Resolved.Right }), + End(resolveEdge = { if (it == LayoutDirection.Ltr) Resolved.Right else Resolved.Left }); + + override fun resolve(layoutDirection: LayoutDirection): Resolved { + return resolveEdge(layoutDirection) + } + + enum class Resolved : SwipeSource.Resolved { + TopLeft, + TopRight, + Bottom, + Left, + Right, + } +} + +/** + * A [SwipeSourceDetector] that detects edges similarly to [FixedSizeEdgeDetector], except that the + * top edge is split in two: top-left and top-right. The split point between the two is dynamic and + * may change during runtime. + * + * Callers who need to detect the start and end edges based on the layout direction (LTR vs RTL) + * should subscribe to [SceneContainerEdge.TopStart] and [SceneContainerEdge.TopEnd] instead. These + * will be resolved at runtime to [SceneContainerEdge.Resolved.TopLeft] and + * [SceneContainerEdge.Resolved.TopRight] appropriately. Similarly, [SceneContainerEdge.Start] and + * [SceneContainerEdge.End] will be resolved appropriately to [SceneContainerEdge.Resolved.Left] and + * [SceneContainerEdge.Resolved.Right]. + * + * @param topEdgeSplitFraction A function which returns the fraction between [0..1] (i.e., + * percentage) of screen width to consider the split point between "top-left" and "top-right" + * edges. It is called on each source detection event. + * @param edgeSize The fixed size of each edge. + */ +class SplitEdgeDetector( + val topEdgeSplitFraction: () -> Float, + val edgeSize: Dp, +) : SwipeSourceDetector { + + private val fixedEdgeDetector = FixedSizeEdgeDetector(edgeSize) + + override fun source( + layoutSize: IntSize, + position: IntOffset, + density: Density, + orientation: Orientation, + ): SceneContainerEdge.Resolved? { + val fixedEdge = + fixedEdgeDetector.source( + layoutSize, + position, + density, + orientation, + ) + return when (fixedEdge) { + Edge.Resolved.Top -> { + val topEdgeSplitFraction = topEdgeSplitFraction() + require(topEdgeSplitFraction in 0f..1f) { + "topEdgeSplitFraction must return a value between 0.0 and 1.0" + } + val isLeftSide = position.x < layoutSize.width * topEdgeSplitFraction + if (isLeftSide) SceneContainerEdge.Resolved.TopLeft + else SceneContainerEdge.Resolved.TopRight + } + Edge.Resolved.Left -> SceneContainerEdge.Resolved.Left + Edge.Resolved.Bottom -> SceneContainerEdge.Resolved.Bottom + Edge.Resolved.Right -> SceneContainerEdge.Resolved.Right + null -> null + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt index 73e86a2be4aa..3cd91be469c1 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt @@ -16,6 +16,7 @@ package com.android.systemui.shade.domain.interactor +import androidx.annotation.FloatRange import com.android.systemui.shade.shared.model.ShadeMode import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow @@ -69,6 +70,20 @@ interface ShadeInteractor : BaseShadeInteractor { * wide as the entire screen. */ val isShadeLayoutWide: StateFlow + + /** + * The fraction between [0..1] (i.e., percentage) of screen width to consider the threshold + * between "top-left" and "top-right" for the purposes of dual-shade invocation. + * + * When the dual-shade is not wide, this always returns 0.5 (the top edge is evenly split). On + * wide layouts however, a larger fraction is returned because only the area of the system + * status icons is considered top-right. + * + * Note that this fraction only determines the split between the absolute left and right + * directions. In RTL layouts, the "top-start" edge will resolve to "top-right", and "top-end" + * will resolve to "top-left". + */ + @FloatRange(from = 0.0, to = 1.0) fun getTopEdgeSplitFraction(): Float } /** ShadeInteractor methods with implementations that differ between non-empty impls. */ diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorEmptyImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorEmptyImpl.kt index d51fd28d5458..6c0b55a5dd57 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorEmptyImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorEmptyImpl.kt @@ -47,4 +47,6 @@ class ShadeInteractorEmptyImpl @Inject constructor() : ShadeInteractor { override val isExpandToQsEnabled: Flow = inactiveFlowBoolean override val shadeMode: StateFlow = MutableStateFlow(ShadeMode.Single) override val isShadeLayoutWide: StateFlow = inactiveFlowBoolean + + override fun getTopEdgeSplitFraction(): Float = 0.5f } diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt index 3552092d24e7..b8d2dd2a764f 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt @@ -16,6 +16,7 @@ package com.android.systemui.shade.domain.interactor +import androidx.annotation.FloatRange import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.data.repository.KeyguardRepository @@ -104,6 +105,16 @@ constructor( override val isShadeLayoutWide: StateFlow = shadeRepository.isShadeLayoutWide + @FloatRange(from = 0.0, to = 1.0) + override fun getTopEdgeSplitFraction(): Float { + // Note: this implicitly relies on isShadeLayoutWide being hot (i.e. collected). This + // assumption allows us to query its value on demand (during swipe source detection) instead + // of running another infinite coroutine. + // TODO(b/338577208): Instead of being fixed at 0.8f, this should dynamically updated based + // on the position of system-status icons in the status bar. + return if (shadeRepository.isShadeLayoutWide.value) 0.8f else 0.5f + } + override val shadeMode: StateFlow = isShadeLayoutWide .map(this::determineShadeMode) diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneKosmos.kt index 55f3ed7062aa..874463819c73 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneKosmos.kt @@ -12,6 +12,8 @@ import com.android.systemui.scene.shared.model.SceneContainerConfig import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.ui.FakeOverlay import com.android.systemui.scene.ui.viewmodel.SceneContainerViewModel +import com.android.systemui.scene.ui.viewmodel.splitEdgeDetector +import com.android.systemui.shade.domain.interactor.shadeInteractor import kotlinx.coroutines.flow.MutableStateFlow var Kosmos.sceneKeys by Fixture { @@ -70,6 +72,8 @@ val Kosmos.sceneContainerViewModel by Fixture { sceneInteractor = sceneInteractor, falsingInteractor = falsingInteractor, powerInteractor = powerInteractor, + shadeInteractor = shadeInteractor, + splitEdgeDetector = splitEdgeDetector, motionEventHandlerReceiver = {}, logger = sceneLogger ) diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetectorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetectorKosmos.kt new file mode 100644 index 000000000000..e0b529261c4d --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/ui/viewmodel/SplitEdgeDetectorKosmos.kt @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.scene.ui.viewmodel + +import androidx.compose.ui.unit.dp +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.shade.domain.interactor.shadeInteractor + +var Kosmos.splitEdgeDetector: SplitEdgeDetector by + Kosmos.Fixture { + SplitEdgeDetector( + topEdgeSplitFraction = shadeInteractor::getTopEdgeSplitFraction, + edgeSize = 40.dp, + ) + } -- GitLab From f1c57db78e14714f8b969a170de1dec80e5454f8 Mon Sep 17 00:00:00 2001 From: Alex Stetson Date: Wed, 3 Jul 2024 09:40:43 -0700 Subject: [PATCH 063/492] Prevent calling StatusBarManagerInternal for visible background users The StatusBarManagerService is not currently configured to properly handle visible background users running concurrently with the primary user. To prevent interactions from these background users from affecting the primary user, it is necessary to guard calls via StatusBarManagerInternal until the StatusBarManagerService supports concurrent users properly. Bug: 350777850 Test: atest com.android.server.wm Flag: NONE bugfix Change-Id: Id560500ce96b0b776f4a2c9426da2b2fd9e58074 --- .../statusbar/StatusBarManagerInternal.java | 10 +- .../statusbar/StatusBarManagerService.java | 149 ++++++++++++++++-- .../com/android/server/wm/DisplayPolicy.java | 8 +- .../android/server/wm/DisplayRotation.java | 10 +- .../android/server/wm/LockTaskController.java | 2 +- .../com/android/server/wm/Transition.java | 18 ++- .../server/wm/DisplayRotationTests.java | 34 ++-- .../server/wm/LockTaskControllerTest.java | 4 +- 8 files changed, 176 insertions(+), 59 deletions(-) diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java index 09d2a0263f2e..83cb72e1df1f 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java @@ -35,7 +35,8 @@ import com.android.server.notification.NotificationDelegate; public interface StatusBarManagerInternal { void setNotificationDelegate(NotificationDelegate delegate); - void showScreenPinningRequest(int taskId); + /** Show a screen pinning request for a specific task. */ + void showScreenPinningRequest(int taskId, int userId); void showAssistDisclosure(); void preloadRecentApps(); @@ -136,7 +137,7 @@ public interface StatusBarManagerInternal { * * @param hidesStatusBar whether it is being hidden */ - void setTopAppHidesStatusBar(boolean hidesStatusBar); + void setTopAppHidesStatusBar(int displayId, boolean hidesStatusBar); boolean showShutdownUi(boolean isReboot, String requestString); @@ -149,17 +150,18 @@ public interface StatusBarManagerInternal { /** * Notify System UI that the system get into or exit immersive mode. + * @param displayId The changed display Id. * @param rootDisplayAreaId The changed display area Id. * @param isImmersiveMode {@code true} if the display area get into immersive mode. */ - void immersiveModeChanged(int rootDisplayAreaId, boolean isImmersiveMode); + void immersiveModeChanged(int displayId, int rootDisplayAreaId, boolean isImmersiveMode); /** * Show a rotation suggestion that a user may approve to rotate the screen. * * @param rotation rotation suggestion */ - void onProposedRotationChanged(int rotation, boolean isValid); + void onProposedRotationChanged(int displayId, int rotation, boolean isValid); /** * Notifies System UI that the display is ready to show system decorations. diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 0fd59670436e..908f51b9cba9 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -119,6 +119,7 @@ import com.android.server.LocalServices; import com.android.server.UiThread; import com.android.server.inputmethod.InputMethodManagerInternal; import com.android.server.notification.NotificationDelegate; +import com.android.server.pm.UserManagerInternal; import com.android.server.pm.UserManagerService; import com.android.server.policy.GlobalActionsProvider; import com.android.server.power.ShutdownCheckPoints; @@ -185,6 +186,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D private final ActivityManagerInternal mActivityManagerInternal; private final ActivityTaskManagerInternal mActivityTaskManager; private final PackageManagerInternal mPackageManagerInternal; + private final UserManagerInternal mUserManagerInternal; private final SessionMonitor mSessionMonitor; private int mCurrentUserId; private boolean mTracingEnabled; @@ -304,6 +306,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D mActivityTaskManager = LocalServices.getService(ActivityTaskManagerInternal.class); mPackageManagerInternal = LocalServices.getService(PackageManagerInternal.class); mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class); + mUserManagerInternal = LocalServices.getService(UserManagerInternal.class); mTileRequestTracker = new TileRequestTracker(mContext); mSessionMonitor = new SessionMonitor(mContext); @@ -360,7 +363,14 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D } @Override - public void showScreenPinningRequest(int taskId) { + public void showScreenPinningRequest(int taskId, int userId) { + if (isVisibleBackgroundUser(userId)) { + if (SPEW) { + Slog.d(TAG, "Skipping showScreenPinningRequest for visible background user " + + userId); + } + return; + } IStatusBar bar = mBar; if (bar != null) { try { @@ -439,6 +449,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void appTransitionFinished(int displayId) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping appTransitionFinished for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } enforceStatusBarService(); IStatusBar bar = mBar; if (bar != null) { @@ -588,6 +605,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void setWindowState(int displayId, int window, int state) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping setWindowState for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } IStatusBar bar = mBar; if (bar != null) { try { @@ -598,6 +622,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void appTransitionPending(int displayId) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping appTransitionPending for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } IStatusBar bar = mBar; if (bar != null) { try { @@ -608,6 +639,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void appTransitionCancelled(int displayId) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping appTransitionCancelled for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } IStatusBar bar = mBar; if (bar != null) { try { @@ -619,6 +657,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void appTransitionStarting(int displayId, long statusBarAnimationsStartTime, long statusBarAnimationsDuration) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping appTransitionStarting for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } IStatusBar bar = mBar; if (bar != null) { try { @@ -629,7 +674,14 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D } @Override - public void setTopAppHidesStatusBar(boolean hidesStatusBar) { + public void setTopAppHidesStatusBar(int displayId, boolean hidesStatusBar) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping setTopAppHidesStatusBar for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } IStatusBar bar = mBar; if (bar != null) { try { @@ -665,10 +717,18 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D } @Override - public void immersiveModeChanged(int rootDisplayAreaId, boolean isImmersiveMode) { + public void immersiveModeChanged(int displayId, int rootDisplayAreaId, + boolean isImmersiveMode) { if (mBar == null) { return; } + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping immersiveModeChanged for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } if (!CLIENT_TRANSIENT) { // Only call from here when the client transient is not enabled. try { @@ -680,7 +740,14 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D // TODO(b/118592525): support it per display if necessary. @Override - public void onProposedRotationChanged(int rotation, boolean isValid) { + public void onProposedRotationChanged(int displayId, int rotation, boolean isValid) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping onProposedRotationChanged for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } if (mBar != null){ try { mBar.onProposedRotationChanged(rotation, isValid); @@ -690,6 +757,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void onDisplayReady(int displayId) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping onDisplayReady for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } IStatusBar bar = mBar; if (bar != null) { try { @@ -703,6 +777,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme, @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName, LetterboxDetails[] letterboxDetails) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping onSystemBarAttributesChanged for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } getUiState(displayId).setBarAttributes(appearance, appearanceRegions, navbarColorManagedByIme, behavior, requestedVisibleTypes, packageName, letterboxDetails); @@ -719,6 +800,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void showTransient(int displayId, @InsetsType int types, boolean isGestureOnSystemBar) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping showTransient for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } getUiState(displayId).showTransient(types); IStatusBar bar = mBar; if (bar != null) { @@ -730,6 +818,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void abortTransient(int displayId, @InsetsType int types) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping abortTransient for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } getUiState(displayId).clearTransient(types); IStatusBar bar = mBar; if (bar != null) { @@ -776,6 +871,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, + "Skipping setNavigationBarLumaSamplingEnabled for visible background " + + "user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } IStatusBar bar = mBar; if (bar != null) { try { @@ -1416,6 +1520,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D } private void setDisableFlags(int displayId, int flags, String cause) { + if (isVisibleBackgroundUserOnDisplay(displayId)) { + if (SPEW) { + Slog.d(TAG, "Skipping setDisableFlags for visible background user " + + mUserManagerInternal.getUserAssignedToDisplay(displayId)); + } + return; + } // also allows calls from window manager which is in this process. enforceStatusBarService(); @@ -2713,16 +2824,30 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D if (callingUserId == USER_SYSTEM || callingUserId == mCurrentUserId) { return; } - final long ident = Binder.clearCallingIdentity(); - try { - if (mUserManager.isSameProfileGroup(callingUserId, mCurrentUserId)) { - return; - } - } finally { - Binder.restoreCallingIdentity(ident); + if (!isVisibleBackgroundUser(callingUserId)) { + return; } throw new SecurityException("User " + callingUserId + " is not permitted to use this method"); } -} + + private boolean isVisibleBackgroundUser(int userId) { + if (!mVisibleBackgroundUsersEnabled) { + return false; + } + // The main use case for visible background users is the Automotive multi-display + // configuration where a passenger can use a secondary display while the driver is + // using the main display. + // TODO(b/341604160) - Support visible background users properly and remove carve outs + return mUserManagerInternal.isVisibleBackgroundFullUser(userId); + } + + private boolean isVisibleBackgroundUserOnDisplay(int displayId) { + if (!mVisibleBackgroundUsersEnabled) { + return false; + } + int userId = mUserManagerInternal.getUserAssignedToDisplay(displayId); + return isVisibleBackgroundUser(userId); + } +} \ No newline at end of file diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 5c621208c4db..a83360998aaa 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -2504,7 +2504,7 @@ public class DisplayPolicy { if (getStatusBar() != null) { final StatusBarManagerInternal statusBar = getStatusBarManagerInternal(); if (statusBar != null) { - statusBar.setTopAppHidesStatusBar(topAppHidesStatusBar); + statusBar.setTopAppHidesStatusBar(getDisplayId(), topAppHidesStatusBar); } } @@ -2531,9 +2531,9 @@ public class DisplayPolicy { mService.mPolicy.isUserSetupComplete(), isNavBarEmpty(disableFlags)); } else { - // TODO (b/277290737): Move this to the client side, instead of using a proxy. - callStatusBarSafely(statusBar -> statusBar.immersiveModeChanged(rootDisplayAreaId, - isImmersiveMode)); + // TODO(b/277290737): Move this to the client side, instead of using a proxy. + callStatusBarSafely(statusBar -> statusBar.immersiveModeChanged(getDisplayId(), + rootDisplayAreaId, isImmersiveMode)); } } diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java index 5200e820fc02..8c06cfecdc40 100644 --- a/services/core/java/com/android/server/wm/DisplayRotation.java +++ b/services/core/java/com/android/server/wm/DisplayRotation.java @@ -81,7 +81,6 @@ import android.window.WindowContainerTransaction; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.protolog.ProtoLog; -import com.android.server.LocalServices; import com.android.server.UiThread; import com.android.server.policy.WindowManagerPolicy; import com.android.server.statusbar.StatusBarManagerInternal; @@ -136,7 +135,6 @@ public class DisplayRotation { private final RotationLockHistory mRotationLockHistory = new RotationLockHistory(); private OrientationListener mOrientationListener; - private StatusBarManagerInternal mStatusBarManagerInternal; private SettingsObserver mSettingsObserver; @NonNull private final DeviceStateController mDeviceStateController; @@ -1559,11 +1557,9 @@ public class DisplayRotation { /** Notify the StatusBar that system rotation suggestion has changed. */ private void sendProposedRotationChangeToStatusBarInternal(int rotation, boolean isValid) { - if (mStatusBarManagerInternal == null) { - mStatusBarManagerInternal = LocalServices.getService(StatusBarManagerInternal.class); - } - if (mStatusBarManagerInternal != null) { - mStatusBarManagerInternal.onProposedRotationChanged(rotation, isValid); + final StatusBarManagerInternal bar = mDisplayPolicy.getStatusBarManagerInternal(); + if (bar != null) { + bar.onProposedRotationChanged(mDisplayContent.getDisplayId(), rotation, isValid); } } diff --git a/services/core/java/com/android/server/wm/LockTaskController.java b/services/core/java/com/android/server/wm/LockTaskController.java index 0dadade38ddb..e65396e00b20 100644 --- a/services/core/java/com/android/server/wm/LockTaskController.java +++ b/services/core/java/com/android/server/wm/LockTaskController.java @@ -659,7 +659,7 @@ public class LockTaskController { StatusBarManagerInternal statusBarManager = LocalServices.getService( StatusBarManagerInternal.class); if (statusBarManager != null) { - statusBarManager.showScreenPinningRequest(task.mTaskId); + statusBarManager.showScreenPinningRequest(task.mTaskId, task.mUserId); } return; } else if (mLockTaskModeState == LOCK_TASK_MODE_PINNED) { diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 7f6dc8472813..d62d7b77639c 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -2336,10 +2336,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // Place the nav bar on top of anything else in the top activity. t.setLayer(navSurfaceControl, Integer.MAX_VALUE); } - final StatusBarManagerInternal bar = dc.getDisplayPolicy().getStatusBarManagerInternal(); - if (bar != null) { - bar.setNavigationBarLumaSamplingEnabled(mRecentsDisplayId, false); - } + sendLumaSamplingEnabledToStatusBarInternal(dc, false); } /** @see RecentsAnimationController#restoreNavigationBarFromApp */ @@ -2357,10 +2354,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { final DisplayContent dc = mController.mAtm.mRootWindowContainer.getDisplayContent(recentsDisplayId); - final StatusBarManagerInternal bar = dc.getDisplayPolicy().getStatusBarManagerInternal(); - if (bar != null) { - bar.setNavigationBarLumaSamplingEnabled(recentsDisplayId, true); - } + sendLumaSamplingEnabledToStatusBarInternal(dc, true); final WindowState navWindow = dc.getDisplayPolicy().getNavigationBar(); if (navWindow == null) return; navWindow.setSurfaceTranslationY(0); @@ -2394,6 +2388,14 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { dc.mWmService.scheduleAnimationLocked(); } + private void sendLumaSamplingEnabledToStatusBarInternal(@NonNull DisplayContent dc, + boolean enabled) { + final StatusBarManagerInternal bar = dc.getDisplayPolicy().getStatusBarManagerInternal(); + if (bar != null) { + bar.setNavigationBarLumaSamplingEnabled(dc.getDisplayId(), enabled); + } + } + private void reportStartReasonsToLogger() { // Record transition start in metrics logger. We just assume everything is "DRAWN" // at this point since splash-screen is a presentation (shell) detail. diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java index 2e488d8127bb..09fe75da18cb 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java @@ -22,6 +22,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; +import static android.view.Display.DEFAULT_DISPLAY; import static android.view.DisplayCutout.NO_CUTOUT; import static android.view.IWindowManager.FIXED_TO_USER_ROTATION_DEFAULT; import static android.view.IWindowManager.FIXED_TO_USER_ROTATION_DISABLED; @@ -78,7 +79,6 @@ import androidx.test.filters.SmallTest; import com.android.internal.R; import com.android.internal.util.test.FakeSettingsProvider; -import com.android.server.LocalServices; import com.android.server.UiThread; import com.android.server.policy.WindowManagerPolicy; import com.android.server.statusbar.StatusBarManagerInternal; @@ -86,7 +86,6 @@ import com.android.server.testutils.OffsettableClock; import com.android.server.testutils.TestHandler; import com.android.server.wm.DisplayContent.FixedRotationTransitionListener; -import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -168,25 +167,10 @@ public class DisplayRotationTests { public void setUp() { FakeSettingsProvider.clearSettingsProvider(); - mPreviousStatusBarManagerInternal = LocalServices.getService( - StatusBarManagerInternal.class); - LocalServices.removeServiceForTest(StatusBarManagerInternal.class); - mMockStatusBarManagerInternal = mock(StatusBarManagerInternal.class); - LocalServices.addService(StatusBarManagerInternal.class, mMockStatusBarManagerInternal); mDisplayRotationImmersiveAppCompatPolicyMock = null; mBuilder = new DisplayRotationBuilder(); } - @After - public void tearDown() { - LocalServices.removeServiceForTest(StatusBarManagerInternal.class); - if (mPreviousStatusBarManagerInternal != null) { - LocalServices.addService(StatusBarManagerInternal.class, - mPreviousStatusBarManagerInternal); - mPreviousStatusBarManagerInternal = null; - } - } - // ================================ // Display Settings Related Tests // ================================ @@ -677,7 +661,8 @@ public class DisplayRotationTests { mOrientationSensorListener.onSensorChanged(createSensorEvent(Surface.ROTATION_90)); assertTrue(waitForUiHandler()); - verify(mMockStatusBarManagerInternal).onProposedRotationChanged(Surface.ROTATION_90, true); + verify(mMockStatusBarManagerInternal).onProposedRotationChanged(DEFAULT_DISPLAY, + Surface.ROTATION_90, true); } @Test @@ -697,7 +682,8 @@ public class DisplayRotationTests { mOrientationSensorListener.onSensorChanged(createSensorEvent(Surface.ROTATION_90)); assertTrue(waitForUiHandler()); - verify(mMockStatusBarManagerInternal).onProposedRotationChanged(Surface.ROTATION_90, true); + verify(mMockStatusBarManagerInternal).onProposedRotationChanged(DEFAULT_DISPLAY, + Surface.ROTATION_90, true); // An imaginary ActivityRecord.setRequestedOrientation call disables immersive mode: when(mDisplayRotationImmersiveAppCompatPolicyMock.isRotationLockEnforced( @@ -728,7 +714,7 @@ public class DisplayRotationTests { assertTrue(waitForUiHandler()); verify(mMockStatusBarManagerInternal) - .onProposedRotationChanged(Surface.ROTATION_180, true); + .onProposedRotationChanged(DEFAULT_DISPLAY, Surface.ROTATION_180, true); } @Test @@ -746,7 +732,7 @@ public class DisplayRotationTests { assertTrue(waitForUiHandler()); verify(mMockStatusBarManagerInternal) - .onProposedRotationChanged(Surface.ROTATION_180, false); + .onProposedRotationChanged(DEFAULT_DISPLAY, Surface.ROTATION_180, false); } @Test @@ -773,7 +759,7 @@ public class DisplayRotationTests { assertTrue(waitForUiHandler()); verify(mMockStatusBarManagerInternal) - .onProposedRotationChanged(Surface.ROTATION_180, false); + .onProposedRotationChanged(DEFAULT_DISPLAY, Surface.ROTATION_180, false); } @Test @@ -1526,6 +1512,7 @@ public class DisplayRotationTests { mMockDisplayContent = mock(DisplayContent.class); when(mMockDisplayContent.getDisplay()).thenReturn(mock(Display.class)); + when(mMockDisplayContent.getDisplayId()).thenReturn(DEFAULT_DISPLAY); mMockDisplayContent.isDefaultDisplay = mIsDefaultDisplay; when(mMockDisplayContent.calculateDisplayCutoutForRotation(anyInt())) .thenReturn(NO_CUTOUT); @@ -1541,6 +1528,9 @@ public class DisplayRotationTests { field.set(mMockDisplayContent, mock(FixedRotationTransitionListener.class)); mMockDisplayPolicy = mock(DisplayPolicy.class); + mMockStatusBarManagerInternal = mock(StatusBarManagerInternal.class); + when(mMockDisplayPolicy.getStatusBarManagerInternal()).thenReturn( + mMockStatusBarManagerInternal); mMockRes = mock(Resources.class); when(mMockContext.getResources()).thenReturn((mMockRes)); diff --git a/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java index 1d14dc31fa26..bef4531c9f28 100644 --- a/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java @@ -219,7 +219,7 @@ public class LockTaskControllerTest { mLockTaskController.startLockTaskMode(tr, false, TEST_UID); // THEN a pinning request should be shown - verify(mStatusBarManagerInternal).showScreenPinningRequest(anyInt()); + verify(mStatusBarManagerInternal).showScreenPinningRequest(anyInt(), anyInt()); } @Test @@ -769,9 +769,11 @@ public class LockTaskControllerTest { private Task getTask(Intent intent, int lockTaskAuth) { Task tr = mock(Task.class); + DisplayContent dc = mock(DisplayContent.class); tr.mLockTaskAuth = lockTaskAuth; tr.intent = intent; tr.mUserId = TEST_USER_ID; + tr.mDisplayContent = dc; return tr; } -- GitLab From e6b26ba915d61481255d1cc058ef06cafc538f29 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Fri, 6 Sep 2024 13:13:30 -0700 Subject: [PATCH 064/492] Assign OWNERS to DisplayManager test apps Flag: EXEMPT owners-only Test: presubmit for OWNERS Bug: 326315985 Change-Id: Ia5a81e889935be3eca3b838dade753b160312400 --- .../tests/servicestests/test-apps/DisplayManagerTestApp/OWNERS | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 services/tests/servicestests/test-apps/DisplayManagerTestApp/OWNERS diff --git a/services/tests/servicestests/test-apps/DisplayManagerTestApp/OWNERS b/services/tests/servicestests/test-apps/DisplayManagerTestApp/OWNERS new file mode 100644 index 000000000000..e9557f84f8fb --- /dev/null +++ b/services/tests/servicestests/test-apps/DisplayManagerTestApp/OWNERS @@ -0,0 +1,3 @@ +# Bug component: 345010 + +include /services/core/java/com/android/server/display/OWNERS -- GitLab From 3ed2996cf30c37172521eeafa26ed54c89ef72f5 Mon Sep 17 00:00:00 2001 From: Omar Abdelmonem Date: Sat, 31 Aug 2024 20:17:44 +0000 Subject: [PATCH 065/492] Change TouchpadDebugView color on touchpad button clicked Send HardwareState of the touchpad to the TouchpadDebugView and change the colour of the view each time the touchpad button is clicked Bug: 363251709 Test: Manual testing by checking that the TouchpadDebugView changes colour each time the Touchpad button is pressed and unit testing to the verify the colour change by comparing the old colour of the view with the new one. flag: com.android.hardware.input.touchpad_visualizer Change-Id: I54b9a627b67a2d674a12d34011deb1f8756ba2ca --- .../server/input/InputManagerService.java | 4 +- .../server/input/debug/TouchpadDebugView.java | 56 +++++++++++++++---- .../debug/TouchpadDebugViewController.java | 7 +++ .../input/debug/TouchpadDebugViewTest.java | 36 ++++++++++++ 4 files changed, 90 insertions(+), 13 deletions(-) diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 84cee7ecbd05..1285a61d08f2 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -2269,13 +2269,15 @@ public class InputManagerService extends IInputManager.Stub // Native callback. @SuppressWarnings("unused") private void notifyTouchpadHardwareState(TouchpadHardwareState hardwareStates, int deviceId) { - // TODO(b/286551975): sent the touchpad hardware state data here to TouchpadDebugActivity Slog.d(TAG, "notifyTouchpadHardwareState: Time: " + hardwareStates.getTimestamp() + ", No. Buttons: " + hardwareStates.getButtonsDown() + ", No. Fingers: " + hardwareStates.getFingerCount() + ", No. Touch: " + hardwareStates.getTouchCount() + ", Id: " + deviceId); + if (mTouchpadDebugViewController != null) { + mTouchpadDebugViewController.updateTouchpadHardwareState(hardwareStates); + } } // Native callback. diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java index 7785ffb4b17a..ba56ad073e6a 100644 --- a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java +++ b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java @@ -30,6 +30,9 @@ import android.view.WindowManager; import android.widget.LinearLayout; import android.widget.TextView; +import com.android.server.input.TouchpadFingerState; +import com.android.server.input.TouchpadHardwareState; + import java.util.Objects; public class TouchpadDebugView extends LinearLayout { @@ -52,6 +55,10 @@ public class TouchpadDebugView extends LinearLayout { private int mScreenHeight; private int mWindowLocationBeforeDragX; private int mWindowLocationBeforeDragY; + @NonNull + private TouchpadHardwareState mLastTouchpadState = + new TouchpadHardwareState(0, 0 /* buttonsDown */, 0, 0, + new TouchpadFingerState[0]); public TouchpadDebugView(Context context, int touchpadId) { super(context); @@ -83,14 +90,14 @@ public class TouchpadDebugView extends LinearLayout { private void init(Context context) { setOrientation(VERTICAL); - setLayoutParams(new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT)); - setBackgroundColor(Color.TRANSPARENT); + setLayoutParams(new LayoutParams( + LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); + setBackgroundColor(Color.RED); // TODO(b/286551975): Replace this content with the touchpad debug view. TextView textView1 = new TextView(context); - textView1.setBackgroundColor(Color.parseColor("#FFFF0000")); + textView1.setBackgroundColor(Color.TRANSPARENT); textView1.setTextSize(20); textView1.setText("Touchpad Debug View 1"); textView1.setGravity(Gravity.CENTER); @@ -98,7 +105,7 @@ public class TouchpadDebugView extends LinearLayout { textView1.setLayoutParams(new LayoutParams(1000, 200)); TextView textView2 = new TextView(context); - textView2.setBackgroundColor(Color.BLUE); + textView2.setBackgroundColor(Color.TRANSPARENT); textView2.setTextSize(20); textView2.setText("Touchpad Debug View 2"); textView2.setGravity(Gravity.CENTER); @@ -126,9 +133,7 @@ public class TouchpadDebugView extends LinearLayout { case MotionEvent.ACTION_MOVE: deltaX = event.getRawX() - mWindowLayoutParams.x - mTouchDownX; deltaY = event.getRawY() - mWindowLayoutParams.y - mTouchDownY; - Slog.d("TouchpadDebugView", "Slop = " + mTouchSlop); if (isSlopExceeded(deltaX, deltaY)) { - Slog.d("TouchpadDebugView", "Slop exceeded"); mWindowLayoutParams.x = Math.max(0, Math.min((int) (event.getRawX() - mTouchDownX), mScreenWidth - this.getWidth())); @@ -136,9 +141,6 @@ public class TouchpadDebugView extends LinearLayout { Math.max(0, Math.min((int) (event.getRawY() - mTouchDownY), mScreenHeight - this.getHeight())); - Slog.d("TouchpadDebugView", "New position X: " - + mWindowLayoutParams.x + ", Y: " + mWindowLayoutParams.y); - mWindowManager.updateViewLayout(this, mWindowLayoutParams); } return true; @@ -166,7 +168,7 @@ public class TouchpadDebugView extends LinearLayout { @Override public boolean performClick() { super.performClick(); - Slog.d("TouchpadDebugView", "You clicked me!"); + Slog.d("TouchpadDebugView", "You tapped the window!"); return true; } @@ -201,4 +203,34 @@ public class TouchpadDebugView extends LinearLayout { public WindowManager.LayoutParams getWindowLayoutParams() { return mWindowLayoutParams; } + + public void updateHardwareState(TouchpadHardwareState touchpadHardwareState) { + if (mLastTouchpadState.getButtonsDown() == 0) { + if (touchpadHardwareState.getButtonsDown() > 0) { + onTouchpadButtonPress(); + } + } else { + if (touchpadHardwareState.getButtonsDown() == 0) { + onTouchpadButtonRelease(); + } + } + mLastTouchpadState = touchpadHardwareState; + } + + private void onTouchpadButtonPress() { + Slog.d("TouchpadDebugView", "You clicked me!"); + + // Iterate through all child views + // Temporary demonstration for testing + for (int i = 0; i < getChildCount(); i++) { + getChildAt(i).setBackgroundColor(Color.BLUE); + } + } + + private void onTouchpadButtonRelease() { + Slog.d("TouchpadDebugView", "You released the click"); + for (int i = 0; i < getChildCount(); i++) { + getChildAt(i).setBackgroundColor(Color.RED); + } + } } diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java b/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java index c28e74a02071..bc53c4947a71 100644 --- a/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java +++ b/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java @@ -27,6 +27,7 @@ import android.view.WindowManager; import com.android.server.input.InputManagerService; import com.android.server.input.TouchpadHardwareProperties; +import com.android.server.input.TouchpadHardwareState; import java.util.Objects; @@ -132,4 +133,10 @@ public class TouchpadDebugViewController implements InputManager.InputDeviceList mTouchpadDebugView = null; Slog.d(TAG, "Touchpad debug view removed."); } + + public void updateTouchpadHardwareState(TouchpadHardwareState touchpadHardwareState) { + if (mTouchpadDebugView != null) { + mTouchpadDebugView.updateHardwareState(touchpadHardwareState); + } + } } diff --git a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java index ad0ef1b3a37f..0f08be215033 100644 --- a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java +++ b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java @@ -26,7 +26,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; +import android.graphics.Color; import android.graphics.Rect; +import android.graphics.drawable.ColorDrawable; import android.testing.TestableContext; import android.view.MotionEvent; import android.view.View; @@ -40,6 +42,8 @@ import androidx.test.runner.AndroidJUnit4; import com.android.cts.input.MotionEventBuilder; import com.android.cts.input.PointerBuilder; +import com.android.server.input.TouchpadFingerState; +import com.android.server.input.TouchpadHardwareState; import org.junit.Before; import org.junit.Test; @@ -289,4 +293,36 @@ public class TouchpadDebugViewTest { assertEquals(initialX, mWindowLayoutParamsCaptor.getValue().x); assertEquals(initialY, mWindowLayoutParamsCaptor.getValue().y); } + + @Test + public void testTouchpadClick() { + View child; + + mTouchpadDebugView.updateHardwareState( + new TouchpadHardwareState(0, 1 /* buttonsDown */, 0, 0, + new TouchpadFingerState[0])); + + for (int i = 0; i < mTouchpadDebugView.getChildCount(); i++) { + child = mTouchpadDebugView.getChildAt(i); + assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); + } + + mTouchpadDebugView.updateHardwareState( + new TouchpadHardwareState(0, 0 /* buttonsDown */, 0, 0, + new TouchpadFingerState[0])); + + for (int i = 0; i < mTouchpadDebugView.getChildCount(); i++) { + child = mTouchpadDebugView.getChildAt(i); + assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.RED); + } + + mTouchpadDebugView.updateHardwareState( + new TouchpadHardwareState(0, 1 /* buttonsDown */, 0, 0, + new TouchpadFingerState[0])); + + for (int i = 0; i < mTouchpadDebugView.getChildCount(); i++) { + child = mTouchpadDebugView.getChildAt(i); + assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); + } + } } -- GitLab From 66c9fc0ee8ecb548ce7fddf377ef884898fbce4c Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 6 Sep 2024 20:44:58 +0000 Subject: [PATCH 066/492] Always call tieProfileLockIfNecessary() under mSpManager lock tieProfileLockIfNecessary() runs under the mSpManager lock when a user's LSKF is changed, but not when it's executed by onUserUnlocking(). In the latter case, a race is possible where tieProfileLockToParent() tries to generate an auth-bound key for a parent user whose LSKF has just been removed by a concurrent thread. This fails and throws an exception, crashing system_server. Fix this by ensuring that the mSpManager lock is always held during tieProfileLockIfNecessary(). Bug: 355905501 Flag: android.app.admin.flags.fix_race_condition_in_tie_profile_lock Test: atest FrameworksServicesTests:com.android.server.locksettings Test: atest CtsDevicePolicyTestCases # 6 test cases failed both before and after Change-Id: I5f8c1bcc206460c1480ce58c846e32d91898c4ce --- .../java/android/app/admin/flags/flags.aconfig | 10 ++++++++++ .../locksettings/LockSettingsService.java | 18 +++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/core/java/android/app/admin/flags/flags.aconfig b/core/java/android/app/admin/flags/flags.aconfig index 17df513bf424..4a45a7a09e91 100644 --- a/core/java/android/app/admin/flags/flags.aconfig +++ b/core/java/android/app/admin/flags/flags.aconfig @@ -99,6 +99,16 @@ flag { bug: "323001115" } +flag { + name: "fix_race_condition_in_tie_profile_lock" + namespace: "enterprise" + description: "Fix race condition in tieProfileLockIfNecessary()" + bug: "355905501" + metadata { + purpose: PURPOSE_BUGFIX + } +} + flag { name: "quiet_mode_credential_bug_fix" namespace: "enterprise" diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java index 62731ab2ef7c..3a7eece7e593 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsService.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java @@ -879,8 +879,14 @@ public class LockSettingsService extends ILockSettings.Stub { // Hide notification first, as tie profile lock takes time hideEncryptionNotification(new UserHandle(userId)); - if (isCredentialSharableWithParent(userId)) { - tieProfileLockIfNecessary(userId, LockscreenCredential.createNone()); + if (android.app.admin.flags.Flags.fixRaceConditionInTieProfileLock()) { + synchronized (mSpManager) { + tieProfileLockIfNecessary(userId, LockscreenCredential.createNone()); + } + } else { + if (isCredentialSharableWithParent(userId)) { + tieProfileLockIfNecessary(userId, LockscreenCredential.createNone()); + } } } }); @@ -1245,7 +1251,13 @@ public class LockSettingsService extends ILockSettings.Stub { mStorage.removeChildProfileLock(userId); removeKeystoreProfileKey(userId); } else { - tieProfileLockIfNecessary(userId, profileUserPassword); + if (android.app.admin.flags.Flags.fixRaceConditionInTieProfileLock()) { + synchronized (mSpManager) { + tieProfileLockIfNecessary(userId, profileUserPassword); + } + } else { + tieProfileLockIfNecessary(userId, profileUserPassword); + } } } catch (IllegalStateException e) { setBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, old, userId); -- GitLab From d2db35c39d0f1928ecf0e4d686c79c72ee4c7e57 Mon Sep 17 00:00:00 2001 From: Marvin Escobar Barajas Date: Mon, 12 Aug 2024 20:43:39 +0000 Subject: [PATCH 067/492] Add scroll haptics for touchscreen scrolling in ScrollView Adds haptics for limits and touchscreen scrolling using the HapticScrollFeedbackProvider implementation. Per go/wear-dd-sfbp-integration. BUG: 331830899 Test: Added as a todo. Flag: android.view.flags.enable_touch_scroll_feedback Change-Id: I8ce89fb5a964655b589c4ade45113df914b0e83c --- core/java/android/widget/ScrollView.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index b5bf529fadbd..511c832a4876 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -16,6 +16,7 @@ package android.widget; +import static android.view.flags.Flags.enableTouchScrollFeedback; import static android.view.flags.Flags.viewVelocityApi; import android.annotation.ColorInt; @@ -846,6 +847,8 @@ public class ScrollView extends FrameLayout { deltaY += mTouchSlop; } } + boolean hitTopLimit = false; + boolean hitBottomLimit = false; if (mIsBeingDragged) { // Scroll to follow the motion event mLastMotionY = y - mScrollOffset[1]; @@ -889,12 +892,14 @@ public class ScrollView extends FrameLayout { if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } + hitTopLimit = true; } else if (pulledToY > range) { mEdgeGlowBottom.onPullDistance((float) deltaY / getHeight(), 1.f - displacement); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } + hitBottomLimit = true; } if (shouldDisplayEdgeEffects() && (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished())) { @@ -902,6 +907,20 @@ public class ScrollView extends FrameLayout { } } } + + // TODO: b/360198915 - Add unit tests. + if (enableTouchScrollFeedback()) { + if (hitTopLimit || hitBottomLimit) { + initHapticScrollFeedbackProviderIfNotExists(); + mHapticScrollFeedbackProvider.onScrollLimit(vtev.getDeviceId(), + vtev.getSource(), MotionEvent.AXIS_Y, + /* isStart= */ hitTopLimit); + } else if (Math.abs(deltaY) != 0) { + initHapticScrollFeedbackProviderIfNotExists(); + mHapticScrollFeedbackProvider.onScrollProgress(vtev.getDeviceId(), + vtev.getSource(), MotionEvent.AXIS_Y, deltaY); + } + } break; case MotionEvent.ACTION_UP: if (mIsBeingDragged) { -- GitLab From 87ca2ade920b568c04b38605bcc01e53ced5778b Mon Sep 17 00:00:00 2001 From: Chris Poultney Date: Fri, 6 Sep 2024 17:09:57 -0400 Subject: [PATCH 068/492] Clarify semantics of changingToSame function WallpaperManagerService#changingToSame takes both the "new" wallpaper component and the "new" WallpaperData to decide if the new live wallpaper is the same as the old. But it only used two fields from WallpaperData, both of which still referred to the current wallpaper. This change makes the "new" versus "current" semantics clear. Bug: 347235611 Test: switching live wallpapers works as expected Flag: EXEMPT cleanup Change-Id: Ifb9198337a3dfade196d0e18423c2050433bebb4 --- .../wallpaper/WallpaperManagerService.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index f53dda6ee35b..4dcc6e112ecc 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -3169,7 +3169,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub final WallpaperDestinationChangeHandler liveSync = new WallpaperDestinationChangeHandler( newWallpaper); - boolean same = changingToSame(name, newWallpaper); + boolean same = changingToSame(name, newWallpaper.connection, + newWallpaper.wallpaperComponent); /* * If we have a shared system+lock wallpaper, and we reapply the same wallpaper @@ -3257,14 +3258,15 @@ public class WallpaperManagerService extends IWallpaperManager.Stub return name == null || name.equals(mDefaultWallpaperComponent); } - private boolean changingToSame(ComponentName componentName, WallpaperData wallpaper) { - if (wallpaper.connection != null) { - final ComponentName wallpaperName = wallpaper.wallpaperComponent; - if (isDefaultComponent(componentName) && isDefaultComponent(wallpaperName)) { + private boolean changingToSame(ComponentName newComponentName, + WallpaperConnection currentConnection, ComponentName currentComponentName) { + if (currentConnection != null) { + if (isDefaultComponent(newComponentName) && isDefaultComponent(currentComponentName)) { if (DEBUG) Slog.v(TAG, "changingToSame: still using default"); // Still using default wallpaper. return true; - } else if (wallpaperName != null && wallpaperName.equals(componentName)) { + } else if (currentComponentName != null && currentComponentName.equals( + newComponentName)) { // Changing to same wallpaper. if (DEBUG) Slog.v(TAG, "same wallpaper"); return true; @@ -3279,7 +3281,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub Slog.v(TAG, "bindWallpaperComponentLocked: componentName=" + componentName); } // Has the component changed? - if (!force && changingToSame(componentName, wallpaper)) { + if (!force && changingToSame(componentName, wallpaper.connection, + wallpaper.wallpaperComponent)) { try { if (DEBUG_LIVE) { Slog.v(TAG, "Changing to the same component, ignoring"); -- GitLab From 9262d19ddd9c763782b610dbcbf4dbd5b4d64486 Mon Sep 17 00:00:00 2001 From: Behnam Heydarshahi Date: Fri, 23 Aug 2024 21:26:50 +0000 Subject: [PATCH 069/492] Shorter rebind time for active tile service Rebind after 1 second (down from 5 seconds) when the tile is active, except when there's already been a rebind attempt less than 5 seconds ago. In that case, the rebind delay is still 5 seconds. Flag: com.android.systemui.qs_quick_rebind_active_tiles Bug: 315249245 Bug: 362526228 Test: atest TileLifeCycleManagerTest Change-Id: I674f1ec9f7e53aa6198efebfc5e35f4cb0069bfb --- packages/SystemUI/aconfig/systemui.aconfig | 10 ++ .../qs/external/TileLifecycleManager.java | 34 +++- .../qs/external/TileServiceManager.java | 2 +- .../qs/external/TileLifecycleManagerTest.java | 155 ++++++++++++++++-- .../qs/external/TileLifecycleManagerKosmos.kt | 2 + 5 files changed, 182 insertions(+), 21 deletions(-) diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index 8a1d81be5e11..538a5a77910a 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -294,6 +294,16 @@ flag { bug: "311147395" } +flag { + name: "qs_quick_rebind_active_tiles" + namespace: "systemui" + description: "Rebind active custom tiles quickly." + bug: "362526228" + metadata { + purpose: PURPOSE_BUGFIX + } +} + flag { name: "coroutine_tracing" namespace: "systemui" diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java index cbcf68c27bf8..2f843ac610a3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java @@ -50,10 +50,12 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; +import com.android.systemui.Flags; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.util.concurrency.DelayableExecutor; +import com.android.systemui.util.time.SystemClock; import dagger.assisted.Assisted; import dagger.assisted.AssistedFactory; @@ -95,6 +97,7 @@ public class TileLifecycleManager extends BroadcastReceiver implements // Bind retry control. private static final int MAX_BIND_RETRIES = 5; private static final long DEFAULT_BIND_RETRY_DELAY = 5 * DateUtils.SECOND_IN_MILLIS; + private static final long ACTIVE_TILE_BIND_RETRY_DELAY = 1 * DateUtils.SECOND_IN_MILLIS; private static final long LOW_MEMORY_BIND_RETRY_DELAY = 20 * DateUtils.SECOND_IN_MILLIS; private static final long TILE_SERVICE_ONCLICK_ALLOW_LIST_DEFAULT_DURATION_MS = 15_000; private static final String PROPERTY_TILE_SERVICE_ONCLICK_ALLOW_LIST_DURATION = @@ -107,6 +110,7 @@ public class TileLifecycleManager extends BroadcastReceiver implements private final Intent mIntent; private final UserHandle mUser; private final DelayableExecutor mExecutor; + private final SystemClock mSystemClock; private final IBinder mToken = new Binder(); private final PackageManagerAdapter mPackageManagerAdapter; private final BroadcastDispatcher mBroadcastDispatcher; @@ -120,7 +124,6 @@ public class TileLifecycleManager extends BroadcastReceiver implements private IBinder mClickBinder; private int mBindTryCount; - private long mBindRetryDelay = DEFAULT_BIND_RETRY_DELAY; private AtomicBoolean isDeathRebindScheduled = new AtomicBoolean(false); private AtomicBoolean mBound = new AtomicBoolean(false); private AtomicBoolean mPackageReceiverRegistered = new AtomicBoolean(false); @@ -138,7 +141,8 @@ public class TileLifecycleManager extends BroadcastReceiver implements TileLifecycleManager(@Main Handler handler, Context context, IQSService service, PackageManagerAdapter packageManagerAdapter, BroadcastDispatcher broadcastDispatcher, @Assisted Intent intent, @Assisted UserHandle user, ActivityManager activityManager, - IDeviceIdleController deviceIdleController, @Background DelayableExecutor executor) { + IDeviceIdleController deviceIdleController, @Background DelayableExecutor executor, + SystemClock systemClock) { mContext = context; mHandler = handler; mIntent = intent; @@ -146,6 +150,7 @@ public class TileLifecycleManager extends BroadcastReceiver implements mIntent.putExtra(TileService.EXTRA_TOKEN, mToken); mUser = user; mExecutor = executor; + mSystemClock = systemClock; mPackageManagerAdapter = packageManagerAdapter; mBroadcastDispatcher = broadcastDispatcher; mActivityManager = activityManager; @@ -436,25 +441,31 @@ public class TileLifecycleManager extends BroadcastReceiver implements // If mBound is true (meaning that we should be bound), then reschedule binding for // later. if (mBound.get() && checkComponentState()) { - if (isDeathRebindScheduled.compareAndSet(false, true)) { + if (isDeathRebindScheduled.compareAndSet(false, true)) { // if already not scheduled + + mExecutor.executeDelayed(() -> { // Only rebind if we are supposed to, but remove the scheduling anyway. if (mBound.get()) { setBindService(true); } - isDeathRebindScheduled.set(false); + isDeathRebindScheduled.set(false); // allow scheduling again }, getRebindDelay()); } } }); } + private long mLastRebind = 0; /** * @return the delay to automatically rebind after a service died. It provides a longer delay if * the device is a low memory state because the service is likely to get killed again by the * system. In this case we want to rebind later and not to cause a loop of a frequent rebinds. + * It also provides a longer delay if called quickly (a few seconds) after a first call. */ private long getRebindDelay() { + final long now = mSystemClock.currentTimeMillis(); + final ActivityManager.MemoryInfo info = new ActivityManager.MemoryInfo(); mActivityManager.getMemoryInfo(info); @@ -462,7 +473,20 @@ public class TileLifecycleManager extends BroadcastReceiver implements if (info.lowMemory) { delay = LOW_MEMORY_BIND_RETRY_DELAY; } else { - delay = mBindRetryDelay; + if (Flags.qsQuickRebindActiveTiles()) { + final long elapsedTimeSinceLastRebind = now - mLastRebind; + final boolean justAttemptedRebind = + elapsedTimeSinceLastRebind < DEFAULT_BIND_RETRY_DELAY; + if (isActiveTile() && !justAttemptedRebind) { + delay = ACTIVE_TILE_BIND_RETRY_DELAY; + } else { + delay = DEFAULT_BIND_RETRY_DELAY; + } + } else { + delay = DEFAULT_BIND_RETRY_DELAY; + } + + mLastRebind = now; } if (mDebug) Log.i(TAG, "Rebinding with a delay=" + delay + " - " + getComponent()); return delay; diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java index d10471d86d0b..c5fa8cf05fd0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java +++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java @@ -44,7 +44,7 @@ import java.util.concurrent.atomic.AtomicBoolean; /** * Manages the priority which lets {@link TileServices} make decisions about which tiles * to bind. Also holds on to and manages the {@link TileLifecycleManager}, informing it - * of when it is allowed to bind based on decisions frome the {@link TileServices}. + * of when it is allowed to bind based on decisions from the {@link TileServices}. */ public class TileServiceManager { diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileLifecycleManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileLifecycleManagerTest.java index c1cf91d6520c..bc0ec2d784f4 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileLifecycleManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileLifecycleManagerTest.java @@ -22,6 +22,7 @@ import static android.service.quicksettings.TileService.START_ACTIVITY_NEEDS_PEN import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession; import static com.android.systemui.Flags.FLAG_QS_CUSTOM_TILE_CLICK_GUARANTEED_BUG_FIX; +import static com.android.systemui.Flags.FLAG_QS_QUICK_REBIND_ACTIVE_TILES; import static com.google.common.truth.Truth.assertThat; @@ -75,6 +76,8 @@ import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.time.FakeSystemClock; +import com.google.common.truth.Truth; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -95,7 +98,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { @Parameters(name = "{0}") public static List getParams() { - return allCombinationsOf(FLAG_QS_CUSTOM_TILE_CLICK_GUARANTEED_BUG_FIX); + return allCombinationsOf(FLAG_QS_CUSTOM_TILE_CLICK_GUARANTEED_BUG_FIX, + FLAG_QS_QUICK_REBIND_ACTIVE_TILES); } private final PackageManagerAdapter mMockPackageManagerAdapter = @@ -154,7 +158,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); } @After @@ -169,12 +174,12 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mStateManager.handleDestroy(); } - private void setPackageEnabled(boolean enabled) throws Exception { + private void setPackageEnabledAndActive(boolean enabled, boolean active) throws Exception { ServiceInfo defaultServiceInfo = null; if (enabled) { defaultServiceInfo = new ServiceInfo(); defaultServiceInfo.metaData = new Bundle(); - defaultServiceInfo.metaData.putBoolean(TileService.META_DATA_ACTIVE_TILE, true); + defaultServiceInfo.metaData.putBoolean(TileService.META_DATA_ACTIVE_TILE, active); defaultServiceInfo.metaData.putBoolean(TileService.META_DATA_TOGGLEABLE_TILE, true); } when(mMockPackageManagerAdapter.getServiceInfo(any(), anyInt(), anyInt())) @@ -186,6 +191,10 @@ public class TileLifecycleManagerTest extends SysuiTestCase { .thenReturn(defaultPackageInfo); } + private void setPackageEnabled(boolean enabled) throws Exception { + setPackageEnabledAndActive(enabled, true); + } + private void setPackageInstalledForUser( boolean installed, boolean active, @@ -396,18 +405,125 @@ public class TileLifecycleManagerTest extends SysuiTestCase { } @Test - public void testKillProcess() throws Exception { + public void testKillProcessWhenTileServiceIsNotActive() throws Exception { + setPackageEnabledAndActive(true, false); mStateManager.onStartListening(); mStateManager.executeSetBindService(true); mExecutor.runAllReady(); + verifyBind(1); + verify(mMockTileService, times(1)).onStartListening(); + mStateManager.onBindingDied(mTileServiceComponentName); mExecutor.runAllReady(); - mClock.advanceTime(5000); + mClock.advanceTime(1000); + mExecutor.runAllReady(); + + // still 4 seconds left because non active tile service rebind time is 5 seconds + Truth.assertThat(mContext.isBound(mTileServiceComponentName)).isFalse(); + + mClock.advanceTime(4000); // 5 seconds delay for nonActive service rebinding + mExecutor.runAllReady(); + verifyBind(2); + verify(mMockTileService, times(2)).onStartListening(); + } + + @EnableFlags(FLAG_QS_QUICK_REBIND_ACTIVE_TILES) + @Test + public void testKillProcessWhenTileServiceIsActive_withRebindFlagOn() throws Exception { + mStateManager.onStartListening(); + mStateManager.executeSetBindService(true); + mExecutor.runAllReady(); + verifyBind(1); + verify(mMockTileService, times(1)).onStartListening(); + + mStateManager.onBindingDied(mTileServiceComponentName); + mExecutor.runAllReady(); + mClock.advanceTime(1000); + mExecutor.runAllReady(); + + // Two calls: one for the first bind, one for the restart. + verifyBind(2); + verify(mMockTileService, times(2)).onStartListening(); + } + + @DisableFlags(FLAG_QS_QUICK_REBIND_ACTIVE_TILES) + @Test + public void testKillProcessWhenTileServiceIsActive_withRebindFlagOff() throws Exception { + mStateManager.onStartListening(); + mStateManager.executeSetBindService(true); + mExecutor.runAllReady(); + verifyBind(1); + verify(mMockTileService, times(1)).onStartListening(); + + mStateManager.onBindingDied(mTileServiceComponentName); + mExecutor.runAllReady(); + mClock.advanceTime(1000); + mExecutor.runAllReady(); + verifyBind(0); // the rebind happens after 4 more seconds + + mClock.advanceTime(4000); + mExecutor.runAllReady(); + verifyBind(1); + } + + @EnableFlags(FLAG_QS_QUICK_REBIND_ACTIVE_TILES) + @Test + public void testKillProcessWhenTileServiceIsActiveTwice_withRebindFlagOn_delaysSecondRebind() + throws Exception { + mStateManager.onStartListening(); + mStateManager.executeSetBindService(true); + mExecutor.runAllReady(); + verifyBind(1); + verify(mMockTileService, times(1)).onStartListening(); + + mStateManager.onBindingDied(mTileServiceComponentName); + mExecutor.runAllReady(); + mClock.advanceTime(1000); mExecutor.runAllReady(); // Two calls: one for the first bind, one for the restart. verifyBind(2); verify(mMockTileService, times(2)).onStartListening(); + + mStateManager.onBindingDied(mTileServiceComponentName); + mExecutor.runAllReady(); + mClock.advanceTime(1000); + mExecutor.runAllReady(); + // because active tile will take 5 seconds to bind the second time, not 1 + verifyBind(0); + + mClock.advanceTime(4000); + mExecutor.runAllReady(); + verifyBind(1); + } + + @DisableFlags(FLAG_QS_QUICK_REBIND_ACTIVE_TILES) + @Test + public void testKillProcessWhenTileServiceIsActiveTwice_withRebindFlagOff_rebindsFromFirstKill() + throws Exception { + mStateManager.onStartListening(); + mStateManager.executeSetBindService(true); + mExecutor.runAllReady(); + verifyBind(1); + verify(mMockTileService, times(1)).onStartListening(); + + mStateManager.onBindingDied(mTileServiceComponentName); // rebind scheduled for 5 seconds + mExecutor.runAllReady(); + mClock.advanceTime(1000); + mExecutor.runAllReady(); + + verifyBind(0); // it would bind in 4 more seconds + + mStateManager.onBindingDied(mTileServiceComponentName); // this does not affect the rebind + mExecutor.runAllReady(); + mClock.advanceTime(1000); + mExecutor.runAllReady(); + + verifyBind(0); // only 2 seconds passed from first kill + + mClock.advanceTime(3000); + mExecutor.runAllReady(); + verifyBind(1); // the rebind scheduled 5 seconds from the first kill should now happen } @Test @@ -510,7 +626,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); manager.executeSetBindService(true); mExecutor.runAllReady(); @@ -533,7 +650,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); manager.executeSetBindService(true); mExecutor.runAllReady(); @@ -556,7 +674,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); manager.executeSetBindService(true); mExecutor.runAllReady(); @@ -581,7 +700,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); manager.executeSetBindService(true); mExecutor.runAllReady(); @@ -607,7 +727,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); assertThat(manager.isActiveTile()).isTrue(); } @@ -626,7 +747,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); assertThat(manager.isActiveTile()).isTrue(); } @@ -644,7 +766,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); assertThat(manager.isToggleableTile()).isTrue(); } @@ -663,7 +786,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); assertThat(manager.isToggleableTile()).isTrue(); } @@ -682,7 +806,8 @@ public class TileLifecycleManagerTest extends SysuiTestCase { mUser, mActivityManager, mDeviceIdleController, - mExecutor); + mExecutor, + mClock); assertThat(manager.isToggleableTile()).isFalse(); assertThat(manager.isActiveTile()).isFalse(); diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/external/TileLifecycleManagerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/external/TileLifecycleManagerKosmos.kt index a0fc76b3d7de..4978558ff8a2 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/external/TileLifecycleManagerKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/external/TileLifecycleManagerKosmos.kt @@ -24,6 +24,7 @@ import com.android.systemui.concurrency.fakeExecutor import com.android.systemui.kosmos.Kosmos import com.android.systemui.qs.tiles.impl.custom.packageManagerAdapterFacade import com.android.systemui.util.mockito.mock +import com.android.systemui.util.time.fakeSystemClock val Kosmos.tileLifecycleManagerFactory: TileLifecycleManager.Factory by Kosmos.Fixture { @@ -39,6 +40,7 @@ val Kosmos.tileLifecycleManagerFactory: TileLifecycleManager.Factory by activityManager, mock(), fakeExecutor, + fakeSystemClock, ) } } -- GitLab From 11ea25d2e32d540300dc27805e5457c95842a81d Mon Sep 17 00:00:00 2001 From: Andre Le Date: Fri, 6 Sep 2024 21:18:34 +0000 Subject: [PATCH 070/492] Swipe between QS pages when using mouse scroll Add the capability to switch between QS pages when scrolling using mouse wheel. Bug: 357179684 Flag: NONE not a new feature Test: manually Change-Id: Ia921f546bb260b1f4aa601a0224bd9952f01b52d --- .../android/systemui/qs/PagedTileLayout.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java index 4018320f2195..ca7b06a16a72 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java @@ -14,7 +14,10 @@ import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; import android.util.AttributeSet; +import android.view.InputDevice; +import android.view.KeyEvent; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; @@ -190,6 +193,34 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { } } + @Override + public boolean onGenericMotionEvent(MotionEvent event) { + if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0 + && event.getAction() == MotionEvent.ACTION_SCROLL) { + // Handle mouse (or ext. device) by swiping the page depending on the scroll + final float vscroll; + final float hscroll; + if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) { + vscroll = 0; + hscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL); + } else { + vscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL); + hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL); + } + if (hscroll != 0 || vscroll != 0) { + boolean isForwardScroll = + isLayoutRtl() ? (hscroll < 0 || vscroll < 0) : (hscroll > 0 || vscroll > 0); + int swipeDirection = isForwardScroll ? RIGHT : LEFT; + if (mScroller.isFinished()) { + scrollByX(getDeltaXForPageScrolling(swipeDirection), + SINGLE_PAGE_SCROLL_DURATION_MILLIS); + } + return true; + } + } + return super.onGenericMotionEvent(event); + } + @Override public void setCurrentItem(int item, boolean smoothScroll) { if (isLayoutRtl()) { -- GitLab From d66329098c100ce8c3e5352f916bc3ad939baac3 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Thu, 5 Sep 2024 12:04:05 -0700 Subject: [PATCH 071/492] Handle failures from Before/AfterClass in the runner - Failures from @BeforeClass / @AfterClass are not properly handled by tradefed (at least by IsolatedHostTest). - So let's detect them and propagate failures as if each tests reported the failure, which is a workaround that tradefed uses in a different host test runner. - Also, change the lambdas RavenwoodAwareTestRunner to inner classes, so that the stacktrace would be less cryptic. Flag: EXEMPT host test change only Bug: 364395552 Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh Change-Id: I55299d19cd07af2fcfe71ff93b31a5b401e799e4 --- ravenwood/Android.bp | 3 + .../RavenwoodAfterClassFailureTest.java | 70 +++++ ...nwoodBeforeClassAssumptionFailureTest.java | 66 ++++ .../RavenwoodBeforeClassFailureTest.java | 71 +++++ ...venwoodClassRuleAssumptionFailureTest.java | 78 +++++ .../RavenwoodClassRuleFailureTest.java | 79 +++++ .../RavenwoodAwareTestRunnerHook.java | 21 +- .../test/ravenwood/RavenwoodTestStats.java | 6 +- .../ravenwood/RavenwoodAwareTestRunner.java | 288 ++++++++++++++++-- .../common/RavenwoodCommonUtils.java | 21 ++ .../runtimehelper/ClassLoadHook.java | 10 +- .../adapter/RunnerRewritingAdapter.kt | 8 +- 12 files changed, 686 insertions(+), 35 deletions(-) create mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodAfterClassFailureTest.java create mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassAssumptionFailureTest.java create mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassFailureTest.java create mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleAssumptionFailureTest.java create mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleFailureTest.java diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp index 333fe4c8147f..eebe5e9fc054 100644 --- a/ravenwood/Android.bp +++ b/ravenwood/Android.bp @@ -94,6 +94,9 @@ java_library { libs: [ "ravenwood-runtime-common-ravenwood", ], + static_libs: [ + "framework-annotations-lib", // should it be "libs" instead? + ], visibility: ["//visibility:private"], } diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodAfterClassFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodAfterClassFailureTest.java new file mode 100644 index 000000000000..f9794ad5941e --- /dev/null +++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodAfterClassFailureTest.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.bivalenttest.listenertests; + +import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; + +import org.junit.AfterClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.ArrayList; +import java.util.List; + +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + +/** + * Test that throws from @AfterClass. + * + * Tradefed would ignore it, so instead RavenwoodAwareTestRunner would detect it and kill + * the self (test) process. + * + * Unfortunately, this behavior can't easily be tested from within this class, so for now + * it's only used for a manual test, which you can run by removing the @Ignore. + * + * TODO(b/364948126) Improve the tests and automate it. + */ +@Ignore +@RunWith(ParameterizedAndroidJunit4.class) +public class RavenwoodAfterClassFailureTest { + public RavenwoodAfterClassFailureTest(String param) { + } + + @AfterClass + public static void afterClass() { + if (!isOnRavenwood()) return; // Don't do anything on real device. + + throw new RuntimeException("FAILURE"); + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } +} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassAssumptionFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassAssumptionFailureTest.java new file mode 100644 index 000000000000..61fb06865545 --- /dev/null +++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassAssumptionFailureTest.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.bivalenttest.listenertests; + +import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; + +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.ArrayList; +import java.util.List; + +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + +/** + * Test that fails in assumption in @BeforeClass. + * + * This is only used for manual tests. Make sure `atest` shows 4 test results with + * "ASSUMPTION_FAILED". + * + * TODO(b/364948126) Improve the tests and automate it. + */ +@RunWith(ParameterizedAndroidJunit4.class) +public class RavenwoodBeforeClassAssumptionFailureTest { + public RavenwoodBeforeClassAssumptionFailureTest(String param) { + } + + @BeforeClass + public static void beforeClass() { + if (!isOnRavenwood()) return; // Don't do anything on real device. + + Assume.assumeTrue(false); + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } +} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassFailureTest.java new file mode 100644 index 000000000000..626ce8198eeb --- /dev/null +++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassFailureTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.bivalenttest.listenertests; + +import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; + +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.ArrayList; +import java.util.List; + +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + +/** + * Test that fails throws from @BeforeClass. + * + * This is only used for manual tests. Make sure `atest` shows 4 test results with + * a "FAILURE" runtime exception. + * + * In order to run the test, you'll need to remove the @Ignore. + * + * TODO(b/364948126) Improve the tests and automate it. + */ +@Ignore +@RunWith(ParameterizedAndroidJunit4.class) +public class RavenwoodBeforeClassFailureTest { + public static final String TAG = "RavenwoodBeforeClassFailureTest"; + + public RavenwoodBeforeClassFailureTest(String param) { + } + + @BeforeClass + public static void beforeClass() { + if (!isOnRavenwood()) return; // Don't do anything on real device. + + throw new RuntimeException("FAILURE"); + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } +} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleAssumptionFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleAssumptionFailureTest.java new file mode 100644 index 000000000000..dc949c466110 --- /dev/null +++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleAssumptionFailureTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.bivalenttest.listenertests; + +import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; + +import static org.junit.Assume.assumeTrue; + +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runner.RunWith; +import org.junit.runners.model.Statement; + +import java.util.ArrayList; +import java.util.List; + +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + +/** + * Test that fails in assumption from a class rule. + * + * This is only used for manual tests. Make sure `atest` shows 4 test results with + * "ASSUMPTION_FAILED". + * + * TODO(b/364948126) Improve the tests and automate it. + */ +@RunWith(ParameterizedAndroidJunit4.class) +public class RavenwoodClassRuleAssumptionFailureTest { + public static final String TAG = "RavenwoodClassRuleFailureTest"; + + @ClassRule + public static final TestRule sClassRule = new TestRule() { + @Override + public Statement apply(Statement base, Description description) { + if (!isOnRavenwood()) { + return base; // Just run the test as-is on a real device. + } + + assumeTrue(false); + return null; // unreachable + } + }; + + public RavenwoodClassRuleAssumptionFailureTest(String param) { + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } +} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleFailureTest.java new file mode 100644 index 000000000000..9996bec41525 --- /dev/null +++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleFailureTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.bivalenttest.listenertests; + +import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; + +import org.junit.ClassRule; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runner.RunWith; +import org.junit.runners.model.Statement; + +import java.util.ArrayList; +import java.util.List; + +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + +/** + * Test that fails throws from a class rule. + * + * This is only used for manual tests. Make sure `atest` shows 4 test results with + * a "FAILURE" runtime exception. + * + * In order to run the test, you'll need to remove the @Ignore. + * + * TODO(b/364948126) Improve the tests and automate it. + */ +@Ignore +@RunWith(ParameterizedAndroidJunit4.class) +public class RavenwoodClassRuleFailureTest { + public static final String TAG = "RavenwoodClassRuleFailureTest"; + + @ClassRule + public static final TestRule sClassRule = new TestRule() { + @Override + public Statement apply(Statement base, Description description) { + if (!isOnRavenwood()) { + return base; // Just run the test as-is on a real device. + } + + throw new RuntimeException("FAILURE"); + } + }; + + public RavenwoodClassRuleFailureTest(String param) { + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } +} diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java index 1d182da5e7fd..6d21e440e911 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java @@ -34,6 +34,8 @@ import org.junit.runner.Description; import org.junit.runner.Runner; import org.junit.runners.model.TestClass; +import java.util.Stack; + /** * Provide hook points created by {@link RavenwoodAwareTestRunner}. */ @@ -44,6 +46,11 @@ public class RavenwoodAwareTestRunnerHook { } private static RavenwoodTestStats sStats; // lazy initialization. + + // Keep track of the current class description. + + // Test classes can be nested because of "Suite", so we need a stack to keep track. + private static final Stack sClassDescriptions = new Stack<>(); private static Description sCurrentClassDescription; private static RavenwoodTestStats getStats() { @@ -108,14 +115,15 @@ public class RavenwoodAwareTestRunnerHook { Scope scope, Order order) { Log.v(TAG, "onBefore: description=" + description + ", " + scope + ", " + order); - if (scope == Scope.Class && order == Order.First) { + if (scope == Scope.Class && order == Order.Outer) { // Keep track of the current class. sCurrentClassDescription = description; + sClassDescriptions.push(description); } // Class-level annotations are checked by the runner already, so we only check // method-level annotations here. - if (scope == Scope.Instance && order == Order.First) { + if (scope == Scope.Instance && order == Order.Outer) { if (!RavenwoodEnablementChecker.shouldEnableOnRavenwood( description, true)) { getStats().onTestFinished(sCurrentClassDescription, description, Result.Skipped); @@ -134,17 +142,20 @@ public class RavenwoodAwareTestRunnerHook { Scope scope, Order order, Throwable th) { Log.v(TAG, "onAfter: description=" + description + ", " + scope + ", " + order + ", " + th); - if (scope == Scope.Instance && order == Order.First) { + if (scope == Scope.Instance && order == Order.Outer) { getStats().onTestFinished(sCurrentClassDescription, description, th == null ? Result.Passed : Result.Failed); - } else if (scope == Scope.Class && order == Order.Last) { + } else if (scope == Scope.Class && order == Order.Outer) { getStats().onClassFinished(sCurrentClassDescription); + sClassDescriptions.pop(); + sCurrentClassDescription = + sClassDescriptions.size() == 0 ? null : sClassDescriptions.peek(); } // If RUN_DISABLED_TESTS is set, and the method did _not_ throw, make it an error. if (RavenwoodRule.private$ravenwood().isRunningDisabledTests() - && scope == Scope.Instance && order == Order.First) { + && scope == Scope.Instance && order == Order.Outer) { boolean isTestEnabled = RavenwoodEnablementChecker.shouldEnableOnRavenwood( description, false); diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java index 631f68ff1dec..3ffabefb7681 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java @@ -127,7 +127,11 @@ public class RavenwoodTestStats { int passed = 0; int skipped = 0; int failed = 0; - for (var e : mStats.get(classDescription).values()) { + var stats = mStats.get(classDescription); + if (stats == null) { + return; + } + for (var e : stats.values()) { switch (e) { case Passed: passed++; break; case Skipped: skipped++; break; diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java index bfde9cb7099e..dffb263e77cb 100644 --- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java +++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java @@ -15,20 +15,25 @@ */ package android.platform.test.ravenwood; +import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING; import static com.android.ravenwood.common.RavenwoodCommonUtils.ensureIsPublicVoidMethod; import static com.android.ravenwood.common.RavenwoodCommonUtils.isOnRavenwood; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.util.Log; import com.android.ravenwood.common.SneakyThrow; import org.junit.Assume; +import org.junit.AssumptionViolatedException; import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.rules.TestRule; import org.junit.runner.Description; +import org.junit.runner.Result; import org.junit.runner.Runner; import org.junit.runner.manipulation.Filter; import org.junit.runner.manipulation.Filterable; @@ -39,8 +44,11 @@ import org.junit.runner.manipulation.Orderer; import org.junit.runner.manipulation.Sortable; import org.junit.runner.manipulation.Sorter; import org.junit.runner.notification.Failure; +import org.junit.runner.notification.RunListener; import org.junit.runner.notification.RunNotifier; +import org.junit.runner.notification.StoppedByUserException; import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.MultipleFailureException; import org.junit.runners.model.RunnerBuilder; import org.junit.runners.model.Statement; import org.junit.runners.model.TestClass; @@ -51,6 +59,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Stack; /** * A test runner used for Ravenwood. @@ -61,7 +71,7 @@ import java.lang.reflect.InvocationTargetException; * the inner runner gets a chance to run. This can be used to initialize stuff used by the * inner runner. * - Add hook points, which are handed by RavenwoodAwareTestRunnerHook, with help from - * the four test rules such as {@link #sImplicitClassMinRule}, which are also injected by + * the four test rules such as {@link #sImplicitClassOuterRule}, which are also injected by * the ravenizer tool. * * We use this runner to: @@ -102,28 +112,50 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde /** Order of a hook. */ public enum Order { - First, - Last, + Outer, + Inner, } // The following four rule instances will be injected to tests by the Ravenizer tool. + private static class RavenwoodClassOuterRule implements TestRule { + @Override + public Statement apply(Statement base, Description description) { + return getCurrentRunner().updateStatement(base, description, Scope.Class, Order.Outer); + } + } - public static final TestRule sImplicitClassMinRule = (base, description) -> - getCurrentRunner().updateStatement(base, description, Scope.Class, Order.First); + private static class RavenwoodClassInnerRule implements TestRule { + @Override + public Statement apply(Statement base, Description description) { + return getCurrentRunner().updateStatement(base, description, Scope.Class, Order.Inner); + } + } - public static final TestRule sImplicitClassMaxRule = (base, description) -> - getCurrentRunner().updateStatement(base, description, Scope.Class, Order.Last); + private static class RavenwoodInstanceOuterRule implements TestRule { + @Override + public Statement apply(Statement base, Description description) { + return getCurrentRunner().updateStatement( + base, description, Scope.Instance, Order.Outer); + } + } - public static final TestRule sImplicitInstMinRule = (base, description) -> - getCurrentRunner().updateStatement(base, description, Scope.Instance, Order.First); + private static class RavenwoodInstanceInnerRule implements TestRule { + @Override + public Statement apply(Statement base, Description description) { + return getCurrentRunner().updateStatement( + base, description, Scope.Instance, Order.Inner); + } + } - public static final TestRule sImplicitInstMaxRule = (base, description) -> - getCurrentRunner().updateStatement(base, description, Scope.Instance, Order.Last); + public static final TestRule sImplicitClassOuterRule = new RavenwoodClassOuterRule(); + public static final TestRule sImplicitClassInnerRule = new RavenwoodClassInnerRule(); + public static final TestRule sImplicitInstOuterRule = new RavenwoodInstanceOuterRule(); + public static final TestRule sImplicitInstInnerRule = new RavenwoodInstanceOuterRule(); - public static final String IMPLICIT_CLASS_MIN_RULE_NAME = "sImplicitClassMinRule"; - public static final String IMPLICIT_CLASS_MAX_RULE_NAME = "sImplicitClassMaxRule"; - public static final String IMPLICIT_INST_MIN_RULE_NAME = "sImplicitInstMinRule"; - public static final String IMPLICIT_INST_MAX_RULE_NAME = "sImplicitInstMaxRule"; + public static final String IMPLICIT_CLASS_OUTER_RULE_NAME = "sImplicitClassOuterRule"; + public static final String IMPLICIT_CLASS_INNER_RULE_NAME = "sImplicitClassInnerRule"; + public static final String IMPLICIT_INST_OUTER_RULE_NAME = "sImplicitInstOuterRule"; + public static final String IMPLICIT_INST_INNER_RULE_NAME = "sImplicitInstInnerRule"; /** Keeps track of the runner on the current thread. */ private static final ThreadLocal sCurrentRunner = new ThreadLocal<>(); @@ -157,6 +189,8 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde try { mTestClass = new TestClass(testClass); + Log.v(TAG, "RavenwoodAwareTestRunner starting for " + testClass.getCanonicalName()); + onRunnerInitializing(); /* @@ -261,20 +295,27 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde } @Override - public void run(RunNotifier notifier) { + public void run(RunNotifier realNotifier) { + final RunNotifier notifier = new RavenwoodRunNotifier(realNotifier); + if (mRealRunner instanceof ClassSkippingTestRunner) { mRealRunner.run(notifier); RavenwoodAwareTestRunnerHook.onClassSkipped(getDescription()); return; } + Log.v(TAG, "Starting " + mTestClass.getJavaClass().getCanonicalName()); + if (RAVENWOOD_VERBOSE_LOGGING) { + dumpDescription(getDescription()); + } + if (maybeReportExceptionFromConstructor(notifier)) { return; } sCurrentRunner.set(this); try { - runWithHooks(getDescription(), Scope.Runner, Order.First, + runWithHooks(getDescription(), Scope.Runner, Order.Outer, () -> mRealRunner.run(notifier)); } finally { sCurrentRunner.remove(); @@ -399,4 +440,217 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde } } } + + private void dumpDescription(Description desc) { + dumpDescription(desc, "[TestDescription]=", " "); + } + + private void dumpDescription(Description desc, String header, String indent) { + Log.v(TAG, indent + header + desc); + + var children = desc.getChildren(); + var childrenIndent = " " + indent; + for (int i = 0; i < children.size(); i++) { + dumpDescription(children.get(i), "#" + i + ": ", childrenIndent); + } + } + + /** + * A run notifier that wraps another notifier and provides the following features: + * - Handle a failure that happened before testStarted and testEnded (typically that means + * it's from @BeforeClass or @AfterClass, or a @ClassRule) and deliver it as if + * individual tests in the class reported it. This is for b/364395552. + * + * - Logging. + */ + private class RavenwoodRunNotifier extends RunNotifier { + private final RunNotifier mRealNotifier; + + private final Stack mSuiteStack = new Stack<>(); + private Description mCurrentSuite = null; + private final ArrayList mOutOfTestFailures = new ArrayList<>(); + + private boolean mBeforeTest = true; + private boolean mAfterTest = false; + + private RavenwoodRunNotifier(RunNotifier realNotifier) { + mRealNotifier = realNotifier; + } + + private boolean isInTest() { + return !mBeforeTest && !mAfterTest; + } + + @Override + public void addListener(RunListener listener) { + mRealNotifier.addListener(listener); + } + + @Override + public void removeListener(RunListener listener) { + mRealNotifier.removeListener(listener); + } + + @Override + public void addFirstListener(RunListener listener) { + mRealNotifier.addFirstListener(listener); + } + + @Override + public void fireTestRunStarted(Description description) { + Log.i(TAG, "testRunStarted: " + description); + mRealNotifier.fireTestRunStarted(description); + } + + @Override + public void fireTestRunFinished(Result result) { + Log.i(TAG, "testRunFinished: " + + result.getRunCount() + "," + + result.getFailureCount() + "," + + result.getAssumptionFailureCount() + "," + + result.getIgnoreCount()); + mRealNotifier.fireTestRunFinished(result); + } + + @Override + public void fireTestSuiteStarted(Description description) { + Log.i(TAG, "testSuiteStarted: " + description); + mRealNotifier.fireTestSuiteStarted(description); + + mBeforeTest = true; + mAfterTest = false; + + // Keep track of the current suite, needed if the outer test is a Suite, + // in which case its children are test classes. (not test methods) + mCurrentSuite = description; + mSuiteStack.push(description); + + mOutOfTestFailures.clear(); + } + + @Override + public void fireTestSuiteFinished(Description description) { + Log.i(TAG, "testSuiteFinished: " + description); + mRealNotifier.fireTestSuiteFinished(description); + + maybeHandleOutOfTestFailures(); + + mBeforeTest = true; + mAfterTest = false; + + // Restore the upper suite. + mSuiteStack.pop(); + mCurrentSuite = mSuiteStack.size() == 0 ? null : mSuiteStack.peek(); + } + + @Override + public void fireTestStarted(Description description) throws StoppedByUserException { + Log.i(TAG, "testStarted: " + description); + mRealNotifier.fireTestStarted(description); + + mAfterTest = false; + mBeforeTest = false; + } + + @Override + public void fireTestFailure(Failure failure) { + Log.i(TAG, "testFailure: " + failure); + + if (isInTest()) { + mRealNotifier.fireTestFailure(failure); + } else { + mOutOfTestFailures.add(failure.getException()); + } + } + + @Override + public void fireTestAssumptionFailed(Failure failure) { + Log.i(TAG, "testAssumptionFailed: " + failure); + + if (isInTest()) { + mRealNotifier.fireTestAssumptionFailed(failure); + } else { + mOutOfTestFailures.add(failure.getException()); + } + } + + @Override + public void fireTestIgnored(Description description) { + Log.i(TAG, "testIgnored: " + description); + mRealNotifier.fireTestIgnored(description); + } + + @Override + public void fireTestFinished(Description description) { + Log.i(TAG, "testFinished: " + description); + mRealNotifier.fireTestFinished(description); + + mAfterTest = true; + } + + @Override + public void pleaseStop() { + Log.w(TAG, "pleaseStop:"); + mRealNotifier.pleaseStop(); + } + + /** + * At the end of each Suite, we handle failures happened out of test methods. + * (typically in @BeforeClass or @AfterClasses) + * + * This is to work around b/364395552. + */ + private boolean maybeHandleOutOfTestFailures() { + if (mOutOfTestFailures.size() == 0) { + return false; + } + Throwable th; + if (mOutOfTestFailures.size() == 1) { + th = mOutOfTestFailures.get(0); + } else { + th = new MultipleFailureException(mOutOfTestFailures); + } + if (mBeforeTest) { + reportBeforeTestFailure(mCurrentSuite, th); + return true; + } + if (mAfterTest) { + // Unfortunately, there's no good way to report it, so kill the own process. + onCriticalError( + "Failures detected in @AfterClass, which would be swalloed by tradefed", + th); + return true; // unreachable + } + return false; + } + + private void reportBeforeTestFailure(Description suiteDesc, Throwable th) { + // If a failure happens befere running any tests, we'll need to pretend + // as if each test in the suite reported the failure, to work around b/364395552. + for (var child : suiteDesc.getChildren()) { + if (child.isSuite()) { + // If the chiil is still a "parent" -- a test class or a test suite + // -- propagate to its children. + mRealNotifier.fireTestSuiteStarted(child); + reportBeforeTestFailure(child, th); + mRealNotifier.fireTestSuiteFinished(child); + } else { + mRealNotifier.fireTestStarted(child); + Failure f = new Failure(child, th); + if (th instanceof AssumptionViolatedException) { + mRealNotifier.fireTestAssumptionFailed(f); + } else { + mRealNotifier.fireTestFailure(f); + } + mRealNotifier.fireTestFinished(child); + } + } + } + } + + private void onCriticalError(@NonNull String message, @Nullable Throwable th) { + Log.e(TAG, "Critical error! Ravenwood cannot continue. Killing self process: " + + message, th); + System.exit(1); + } } diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java index 7b5bc5aeb7b6..875ce71149cd 100644 --- a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java +++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java @@ -15,12 +15,17 @@ */ package com.android.ravenwood.common; +import android.annotation.NonNull; +import android.annotation.Nullable; + import com.android.ravenwood.common.divergence.RavenwoodDivergence; import java.io.File; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; @@ -33,6 +38,14 @@ public class RavenwoodCommonUtils { private static final Object sLock = new Object(); + /** + * If set to "1", we enable the verbose logging. + * + * (See also InitLogging() in http://ac/system/libbase/logging.cpp) + */ + public static final boolean RAVENWOOD_VERBOSE_LOGGING = "1".equals(System.getenv( + "RAVENWOOD_VERBOSE")); + /** Name of `libravenwood_runtime` */ private static final String RAVENWOOD_NATIVE_RUNTIME_NAME = "ravenwood_runtime"; @@ -265,4 +278,12 @@ public class RavenwoodCommonUtils { method.getDeclaringClass().getName(), method.getName(), (isStatic ? "static " : ""))); } + + @NonNull + public static String getStackTraceString(@Nullable Throwable th) { + StringWriter stringWriter = new StringWriter(); + PrintWriter writer = new PrintWriter(stringWriter); + th.printStackTrace(writer); + return stringWriter.toString(); + } } diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java index c519204d0586..01e19a70eece 100644 --- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java +++ b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java @@ -15,6 +15,8 @@ */ package com.android.platform.test.ravenwood.runtimehelper; +import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING; + import android.system.ErrnoException; import android.system.Os; @@ -40,14 +42,6 @@ public class ClassLoadHook { private static final boolean SKIP_LOADING_LIBANDROID = "1".equals(System.getenv( "RAVENWOOD_SKIP_LOADING_LIBANDROID")); - /** - * If set to 1, and if $ANDROID_LOG_TAGS isn't set, we enable the verbose logging. - * - * (See also InitLogging() in http://ac/system/libbase/logging.cpp) - */ - private static final boolean RAVENWOOD_VERBOSE_LOGGING = "1".equals(System.getenv( - "RAVENWOOD_VERBOSE")); - public static final String CORE_NATIVE_CLASSES = "core_native_classes"; public static final String ICU_DATA_PATH = "icu.data.path"; public static final String KEYBOARD_PATHS = "keyboard_paths"; diff --git a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/adapter/RunnerRewritingAdapter.kt b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/adapter/RunnerRewritingAdapter.kt index eaef2cf6a956..bd9d96d81604 100644 --- a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/adapter/RunnerRewritingAdapter.kt +++ b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/adapter/RunnerRewritingAdapter.kt @@ -302,7 +302,7 @@ class RunnerRewritingAdapter private constructor( override fun visitCode() { visitFieldInsn(Opcodes.GETSTATIC, ravenwoodTestRunnerType.internlName, - RavenwoodAwareTestRunner.IMPLICIT_CLASS_MIN_RULE_NAME, + RavenwoodAwareTestRunner.IMPLICIT_CLASS_OUTER_RULE_NAME, testRuleType.desc ) visitFieldInsn(Opcodes.PUTSTATIC, @@ -313,7 +313,7 @@ class RunnerRewritingAdapter private constructor( visitFieldInsn(Opcodes.GETSTATIC, ravenwoodTestRunnerType.internlName, - RavenwoodAwareTestRunner.IMPLICIT_CLASS_MAX_RULE_NAME, + RavenwoodAwareTestRunner.IMPLICIT_CLASS_INNER_RULE_NAME, testRuleType.desc ) visitFieldInsn(Opcodes.PUTSTATIC, @@ -361,7 +361,7 @@ class RunnerRewritingAdapter private constructor( visitVarInsn(ALOAD, 0) visitFieldInsn(Opcodes.GETSTATIC, ravenwoodTestRunnerType.internlName, - RavenwoodAwareTestRunner.IMPLICIT_INST_MIN_RULE_NAME, + RavenwoodAwareTestRunner.IMPLICIT_INST_OUTER_RULE_NAME, testRuleType.desc ) visitFieldInsn(Opcodes.PUTFIELD, @@ -373,7 +373,7 @@ class RunnerRewritingAdapter private constructor( visitVarInsn(ALOAD, 0) visitFieldInsn(Opcodes.GETSTATIC, ravenwoodTestRunnerType.internlName, - RavenwoodAwareTestRunner.IMPLICIT_INST_MAX_RULE_NAME, + RavenwoodAwareTestRunner.IMPLICIT_INST_INNER_RULE_NAME, testRuleType.desc ) visitFieldInsn(Opcodes.PUTFIELD, -- GitLab From df488c139f6522dbc207ef846d675598079a5341 Mon Sep 17 00:00:00 2001 From: Merissa Mitchell Date: Thu, 5 Sep 2024 22:41:41 -0700 Subject: [PATCH 072/492] Enable rounded corners when PiP exits to fullscreen. https://screenshot.googleplex.com/Abp88HonUde6WQJ Recall: http://recall/clips/ffcdbc70-08c3-458b-85dc-05a08bed822c Bug: 352772911 Test: atest WMShellFlickerTestsPip2 Flag: EXEMPT bug fix Change-Id: I7eec91dec1ed0c0ba9b8bf01be6fc6ddcd41843d --- .../wm/shell/pip/PipAnimationController.java | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java index 4df649ca8c93..f060158766fe 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java @@ -497,13 +497,8 @@ public class PipAnimationController { mCurrentValue = value; } - boolean shouldApplyCornerRadius() { - return !isOutPipDirection(mTransitionDirection); - } - boolean shouldApplyShadowRadius() { - return !isOutPipDirection(mTransitionDirection) - && !isRemovePipDirection(mTransitionDirection); + return !isRemovePipDirection(mTransitionDirection); } boolean inScaleTransition() { @@ -556,7 +551,7 @@ public class PipAnimationController { final float alpha = getStartValue() * (1 - fraction) + getEndValue() * fraction; setCurrentValue(alpha); getSurfaceTransactionHelper().alpha(tx, leash, alpha) - .round(tx, leash, shouldApplyCornerRadius()) + .round(tx, leash, true /* applyCornerRadius */) .shadow(tx, leash, shouldApplyShadowRadius()); if (!handlePipTransaction(leash, tx, destinationBounds, alpha)) { tx.apply(); @@ -572,7 +567,7 @@ public class PipAnimationController { getSurfaceTransactionHelper() .resetScale(tx, leash, getDestinationBounds()) .crop(tx, leash, getDestinationBounds()) - .round(tx, leash, shouldApplyCornerRadius()) + .round(tx, leash, true /* applyCornerRadius */) .shadow(tx, leash, shouldApplyShadowRadius()); tx.show(leash); tx.apply(); @@ -686,13 +681,11 @@ public class PipAnimationController { getSurfaceTransactionHelper().scaleAndCrop(tx, leash, adjustedSourceRectHint, initialSourceValue, bounds, insets, isInPipDirection, fraction); - if (shouldApplyCornerRadius()) { - final Rect sourceBounds = new Rect(initialContainerRect); - sourceBounds.inset(insets); - getSurfaceTransactionHelper() - .round(tx, leash, sourceBounds, bounds) - .shadow(tx, leash, shouldApplyShadowRadius()); - } + final Rect sourceBounds = new Rect(initialContainerRect); + sourceBounds.inset(insets); + getSurfaceTransactionHelper() + .round(tx, leash, sourceBounds, bounds) + .shadow(tx, leash, shouldApplyShadowRadius()); } if (!handlePipTransaction(leash, tx, bounds, /* alpha= */ 1f)) { tx.apply(); @@ -741,11 +734,9 @@ public class PipAnimationController { .rotateAndScaleWithCrop(tx, leash, initialContainerRect, bounds, insets, degree, x, y, isOutPipDirection, rotationDelta == ROTATION_270 /* clockwise */); - if (shouldApplyCornerRadius()) { - getSurfaceTransactionHelper() - .round(tx, leash, sourceBounds, bounds) - .shadow(tx, leash, shouldApplyShadowRadius()); - } + getSurfaceTransactionHelper() + .round(tx, leash, sourceBounds, bounds) + .shadow(tx, leash, shouldApplyShadowRadius()); if (!handlePipTransaction(leash, tx, bounds, 1f /* alpha */)) { tx.apply(); } @@ -761,7 +752,7 @@ public class PipAnimationController { void onStartTransaction(SurfaceControl leash, SurfaceControl.Transaction tx) { getSurfaceTransactionHelper() .alpha(tx, leash, 1f) - .round(tx, leash, shouldApplyCornerRadius()) + .round(tx, leash, true /* applyCornerRadius */) .shadow(tx, leash, shouldApplyShadowRadius()); tx.show(leash); tx.apply(); -- GitLab From 0df722f5580a9b9fd1ccc063875b100a45b66c56 Mon Sep 17 00:00:00 2001 From: Kyle Holm Date: Fri, 6 Sep 2024 15:05:15 -0700 Subject: [PATCH 073/492] Add a trace to link inputEventId and vsyncId We should have an easy way to query in a perfetto trace for the frame associated with an input event. This change adds a trace event to do that. Bug: 363076084 Test: https://ui.perfetto.dev/#!/?s=039fa15daa0e4cd005587a64962b5a48f7910cec Verified the new slice has the correct vsyncId and inputEventId. Flag: EXEMPT log only update Change-Id: I2d4e5e439076c94b195cbe328b66d0c988e10661 --- libs/hwui/renderthread/CanvasContext.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index dfda25d013ed..8ec04304a808 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -654,6 +654,9 @@ void CanvasContext::draw(bool solelyTextureViewUpdates) { if (vsyncId != UiFrameInfoBuilder::INVALID_VSYNC_ID) { const auto inputEventId = static_cast(mCurrentFrameInfo->get(FrameInfoIndex::InputEventId)); + ATRACE_FORMAT( + "frameTimelineInfo(frameNumber=%llu, vsyncId=%lld, inputEventId=0x%" PRIx32 ")", + frameCompleteNr, vsyncId, inputEventId); const ANativeWindowFrameTimelineInfo ftl = { .frameNumber = frameCompleteNr, .frameTimelineVsyncId = vsyncId, -- GitLab From 55f32a1fa7cff2b5351e42869fa60652a31a205f Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Fri, 6 Sep 2024 16:19:21 -0700 Subject: [PATCH 074/492] Block background dream launch during widget launch and occlusion. This changelist restricts restarting dreams behind the glanceable hub if a widget is launching an activity. It also uses the keyguard occlusion signal from keyguard interactor as another restriction, as this value is often more current than the KeyguardState. Test: atest CommunalDreamStartableTest#shouldNotStartDreamWhenLaunchingWidget Test: atest CommunalDreamStartableTest#shouldNotStartDreamWhenOccluded Fixes: 364522347 Flag: EXEMPT bugfix Change-Id: I18ca19f424214191d61fdcfd170314bb351d3732 --- .../communal/CommunalDreamStartableTest.kt | 32 +++++++++++++++++++ .../communal/CommunalDreamStartable.kt | 4 +++ 2 files changed, 36 insertions(+) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalDreamStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalDreamStartableTest.kt index 3b0057d87048..e531e654cd34 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalDreamStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalDreamStartableTest.kt @@ -22,6 +22,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.SysuiTestCase +import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic @@ -73,6 +74,7 @@ class CommunalDreamStartableTest : SysuiTestCase() { keyguardInteractor = kosmos.keyguardInteractor, keyguardTransitionInteractor = kosmos.keyguardTransitionInteractor, dreamManager = dreamManager, + communalSceneInteractor = kosmos.communalSceneInteractor, bgScope = kosmos.applicationCoroutineScope, ) .apply { start() } @@ -158,6 +160,36 @@ class CommunalDreamStartableTest : SysuiTestCase() { } } + @Test + fun shouldNotStartDreamWhenLaunchingWidget() = + testScope.runTest { + keyguardRepository.setKeyguardShowing(true) + keyguardRepository.setDreaming(false) + powerRepository.setScreenPowerState(ScreenPowerState.SCREEN_ON) + kosmos.communalSceneInteractor.setIsLaunchingWidget(true) + whenever(dreamManager.canStartDreaming(/* isScreenOn= */ true)).thenReturn(true) + runCurrent() + + transition(from = KeyguardState.DREAMING, to = KeyguardState.GLANCEABLE_HUB) + + verify(dreamManager, never()).startDream() + } + + @Test + fun shouldNotStartDreamWhenOccluded() = + testScope.runTest { + keyguardRepository.setKeyguardShowing(true) + keyguardRepository.setDreaming(false) + powerRepository.setScreenPowerState(ScreenPowerState.SCREEN_ON) + keyguardRepository.setKeyguardOccluded(true) + whenever(dreamManager.canStartDreaming(/* isScreenOn= */ true)).thenReturn(true) + runCurrent() + + transition(from = KeyguardState.DREAMING, to = KeyguardState.GLANCEABLE_HUB) + + verify(dreamManager, never()).startDream() + } + private suspend fun TestScope.transition(from: KeyguardState, to: KeyguardState) { kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( from = from, diff --git a/packages/SystemUI/src/com/android/systemui/communal/CommunalDreamStartable.kt b/packages/SystemUI/src/com/android/systemui/communal/CommunalDreamStartable.kt index c69cea4a6a5a..04393feaae37 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/CommunalDreamStartable.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/CommunalDreamStartable.kt @@ -21,6 +21,7 @@ import android.app.DreamManager import com.android.systemui.CoreStartable import com.android.systemui.Flags.glanceableHubAllowKeyguardWhenDreaming import com.android.systemui.Flags.restartDreamOnUnocclude +import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background @@ -55,6 +56,7 @@ constructor( private val keyguardInteractor: KeyguardInteractor, private val keyguardTransitionInteractor: KeyguardTransitionInteractor, private val dreamManager: DreamManager, + private val communalSceneInteractor: CommunalSceneInteractor, @Background private val bgScope: CoroutineScope, ) : CoreStartable { /** Flow that emits when the dream should be started underneath the glanceable hub. */ @@ -66,6 +68,8 @@ constructor( not(keyguardInteractor.isDreaming), // TODO(b/362830856): Remove this workaround. keyguardInteractor.isKeyguardShowing, + not(communalSceneInteractor.isLaunchingWidget), + not(keyguardInteractor.isKeyguardOccluded), ) .filter { it } -- GitLab From a7c29e259c95981278f23d465809a0424f6eed4c Mon Sep 17 00:00:00 2001 From: Dennis Shen Date: Fri, 6 Sep 2024 23:30:11 +0000 Subject: [PATCH 075/492] update mapper to include android_health_service namespace Bug: b/362990874 Test: manual testing Flag: EXEMPT refactor Change-Id: I8795329a2ab6b4c46c9cd4ae347988bb3bf6a1bf --- .../java/com/android/server/am/SettingsToPropertiesMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java index 29373076c3b8..99c3ecaba2e0 100644 --- a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java +++ b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java @@ -139,6 +139,7 @@ public class SettingsToPropertiesMapper { static final String[] sDeviceConfigAconfigScopes = new String[] { "accessibility", "android_core_networking", + "android_health_services", "android_sdk", "android_stylus", "aoc", @@ -235,7 +236,6 @@ public class SettingsToPropertiesMapper { "wear_connectivity", "wear_esim_carriers", "wear_frameworks", - "wear_health_services", "wear_media", "wear_offload", "wear_security", -- GitLab From fff1d48f432741160019a9266728097f10bd2189 Mon Sep 17 00:00:00 2001 From: Yurii Zubrytskyi Date: Fri, 30 Aug 2024 16:54:55 -0700 Subject: [PATCH 076/492] [res] Better modification time resolution in Idmap We used to track the modification time in seconds, which is both imprecise (an apk installation + idmap generation can easily take less time) and forces us to wait for >1s in the tests to just check if up-to-date checks work. This change updates the time to nanosecond resolution where supported (hm, MinGW for Windows, hm), as the underlying OS API provides Test: build + atest libandroidfw_tests idmap2_tests + boot Flag: EXEMPT minor change Change-Id: I37635e6f3b62aff3b4794912ac585a9ef5ea7a1e --- libs/androidfw/AssetManager.cpp | 32 ++++++----- .../include/androidfw/AssetManager.h | 22 ++++---- libs/androidfw/include/androidfw/Idmap.h | 5 +- libs/androidfw/include/androidfw/misc.h | 35 +++++++++--- libs/androidfw/misc.cpp | 55 +++++++++++-------- libs/androidfw/tests/Idmap_test.cpp | 11 +++- tools/aapt/Package.cpp | 11 ++-- 7 files changed, 105 insertions(+), 66 deletions(-) diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index e6182454ad8a..5955915c9fcd 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -1420,18 +1420,20 @@ void AssetManager::mergeInfoLocked(SortedVector* pMergedInfo Mutex AssetManager::SharedZip::gLock; DefaultKeyedVector > AssetManager::SharedZip::gOpen; -AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen) - : mPath(path), mZipFile(NULL), mModWhen(modWhen), - mResourceTableAsset(NULL), mResourceTable(NULL) -{ - if (kIsDebug) { - ALOGI("Creating SharedZip %p %s\n", this, mPath.c_str()); - } - ALOGV("+++ opening zip '%s'\n", mPath.c_str()); - mZipFile = ZipFileRO::open(mPath.c_str()); - if (mZipFile == NULL) { - ALOGD("failed to open Zip archive '%s'\n", mPath.c_str()); - } +AssetManager::SharedZip::SharedZip(const String8& path, ModDate modWhen) + : mPath(path), + mZipFile(NULL), + mModWhen(modWhen), + mResourceTableAsset(NULL), + mResourceTable(NULL) { + if (kIsDebug) { + ALOGI("Creating SharedZip %p %s\n", this, mPath.c_str()); + } + ALOGV("+++ opening zip '%s'\n", mPath.c_str()); + mZipFile = ZipFileRO::open(mPath.c_str()); + if (mZipFile == NULL) { + ALOGD("failed to open Zip archive '%s'\n", mPath.c_str()); + } } AssetManager::SharedZip::SharedZip(int fd, const String8& path) @@ -1453,7 +1455,7 @@ sp AssetManager::SharedZip::get(const String8& path, bool createIfNotPresent) { AutoMutex _l(gLock); - time_t modWhen = getFileModDate(path.c_str()); + auto modWhen = getFileModDate(path.c_str()); sp zip = gOpen.valueFor(path).promote(); if (zip != NULL && zip->mModWhen == modWhen) { return zip; @@ -1520,8 +1522,8 @@ ResTable* AssetManager::SharedZip::setResourceTable(ResTable* res) bool AssetManager::SharedZip::isUpToDate() { - time_t modWhen = getFileModDate(mPath.c_str()); - return mModWhen == modWhen; + auto modWhen = getFileModDate(mPath.c_str()); + return mModWhen == modWhen; } void AssetManager::SharedZip::addOverlay(const asset_path& ap) diff --git a/libs/androidfw/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h index ce0985b38986..376c881ea376 100644 --- a/libs/androidfw/include/androidfw/AssetManager.h +++ b/libs/androidfw/include/androidfw/AssetManager.h @@ -280,21 +280,21 @@ private: ~SharedZip(); private: - SharedZip(const String8& path, time_t modWhen); - SharedZip(int fd, const String8& path); - SharedZip(); // <-- not implemented + SharedZip(const String8& path, ModDate modWhen); + SharedZip(int fd, const String8& path); + SharedZip(); // <-- not implemented - String8 mPath; - ZipFileRO* mZipFile; - time_t mModWhen; + String8 mPath; + ZipFileRO* mZipFile; + ModDate mModWhen; - Asset* mResourceTableAsset; - ResTable* mResourceTable; + Asset* mResourceTableAsset; + ResTable* mResourceTable; - Vector mOverlays; + Vector mOverlays; - static Mutex gLock; - static DefaultKeyedVector > gOpen; + static Mutex gLock; + static DefaultKeyedVector > gOpen; }; /* diff --git a/libs/androidfw/include/androidfw/Idmap.h b/libs/androidfw/include/androidfw/Idmap.h index 64b1f0c6ed03..98f1aa86f2db 100644 --- a/libs/androidfw/include/androidfw/Idmap.h +++ b/libs/androidfw/include/androidfw/Idmap.h @@ -25,8 +25,9 @@ #include "android-base/macros.h" #include "android-base/unique_fd.h" #include "androidfw/ConfigDescription.h" -#include "androidfw/StringPiece.h" #include "androidfw/ResourceTypes.h" +#include "androidfw/StringPiece.h" +#include "androidfw/misc.h" #include "utils/ByteOrder.h" namespace android { @@ -202,7 +203,7 @@ class LoadedIdmap { android::base::unique_fd idmap_fd_; std::string_view overlay_apk_path_; std::string_view target_apk_path_; - time_t idmap_last_mod_time_; + ModDate idmap_last_mod_time_; private: DISALLOW_COPY_AND_ASSIGN(LoadedIdmap); diff --git a/libs/androidfw/include/androidfw/misc.h b/libs/androidfw/include/androidfw/misc.h index 077609d20d55..09ae40c35369 100644 --- a/libs/androidfw/include/androidfw/misc.h +++ b/libs/androidfw/include/androidfw/misc.h @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#pragma once -#include +#include // // Handy utility functions and portability code. // -#ifndef _LIBS_ANDROID_FW_MISC_H -#define _LIBS_ANDROID_FW_MISC_H namespace android { @@ -41,15 +40,35 @@ typedef enum FileType { } FileType; /* get the file's type; follows symlinks */ FileType getFileType(const char* fileName); -/* get the file's modification date; returns -1 w/errno set on failure */ -time_t getFileModDate(const char* fileName); + +// MinGW doesn't support nanosecond resolution in stat() modification time, and given +// that it only matters on the device it's ok to keep it at the second level there. +#ifdef _WIN32 +using ModDate = time_t; +inline constexpr ModDate kInvalidModDate = ModDate(-1); +inline constexpr unsigned long long kModDateResolutionNs = 1ull * 1000 * 1000 * 1000; +inline time_t toTimeT(ModDate m) { + return m; +} +#else +using ModDate = timespec; +inline constexpr ModDate kInvalidModDate = {-1, -1}; +inline constexpr unsigned long long kModDateResolutionNs = 1; +inline time_t toTimeT(ModDate m) { + return m.tv_sec; +} +#endif + +/* get the file's modification date; returns kInvalidModDate w/errno set on failure */ +ModDate getFileModDate(const char* fileName); /* same, but also returns -1 if the file has already been deleted */ -time_t getFileModDate(int fd); +ModDate getFileModDate(int fd); // Check if |path| or |fd| resides on a readonly filesystem. bool isReadonlyFilesystem(const char* path); bool isReadonlyFilesystem(int fd); -}; // namespace android +} // namespace android -#endif // _LIBS_ANDROID_FW_MISC_H +// Whoever uses getFileModDate() will need this as well +bool operator==(const timespec& l, const timespec& r); diff --git a/libs/androidfw/misc.cpp b/libs/androidfw/misc.cpp index 93dcaf549a90..9bdaf18a116a 100644 --- a/libs/androidfw/misc.cpp +++ b/libs/androidfw/misc.cpp @@ -28,11 +28,13 @@ #include #endif // __linux__ -#include -#include #include #include +#include +#include +#include + namespace android { /* @@ -73,27 +75,32 @@ FileType getFileType(const char* fileName) } } -/* - * Get a file's modification date. - */ -time_t getFileModDate(const char* fileName) { - struct stat sb; - if (stat(fileName, &sb) < 0) { - return (time_t)-1; - } - return sb.st_mtime; +static ModDate getModDate(const struct stat& st) { +#ifdef _WIN32 + return st.st_mtime; +#else + return st.st_mtim; +#endif } -time_t getFileModDate(int fd) { - struct stat sb; - if (fstat(fd, &sb) < 0) { - return (time_t)-1; - } - if (sb.st_nlink <= 0) { - errno = ENOENT; - return (time_t)-1; - } - return sb.st_mtime; +ModDate getFileModDate(const char* fileName) { + struct stat sb; + if (stat(fileName, &sb) < 0) { + return kInvalidModDate; + } + return getModDate(sb); +} + +ModDate getFileModDate(int fd) { + struct stat sb; + if (fstat(fd, &sb) < 0) { + return kInvalidModDate; + } + if (sb.st_nlink <= 0) { + errno = ENOENT; + return kInvalidModDate; + } + return getModDate(sb); } #ifndef __linux__ @@ -124,4 +131,8 @@ bool isReadonlyFilesystem(int fd) { } #endif // __linux__ -}; // namespace android +} // namespace android + +bool operator==(const timespec& l, const timespec& r) { + return std::tie(l.tv_sec, l.tv_nsec) == std::tie(r.tv_sec, l.tv_nsec); +} diff --git a/libs/androidfw/tests/Idmap_test.cpp b/libs/androidfw/tests/Idmap_test.cpp index 60aa7d88925d..cb2e56f5f5e4 100644 --- a/libs/androidfw/tests/Idmap_test.cpp +++ b/libs/androidfw/tests/Idmap_test.cpp @@ -14,6 +14,9 @@ * limitations under the License. */ +#include +#include + #include "android-base/file.h" #include "androidfw/ApkAssets.h" #include "androidfw/AssetManager2.h" @@ -27,6 +30,7 @@ #include "data/overlayable/R.h" #include "data/system/R.h" +using namespace std::chrono_literals; using ::testing::NotNull; namespace overlay = com::android::overlay; @@ -218,10 +222,13 @@ TEST_F(IdmapTest, OverlayAssetsIsUpToDate) { unlink(temp_file.path); ASSERT_FALSE(apk_assets->IsUpToDate()); - sleep(2); + + const auto sleep_duration = + std::chrono::nanoseconds(std::max(kModDateResolutionNs, 1'000'000ull)); + std::this_thread::sleep_for(sleep_duration); base::WriteStringToFile("hello", temp_file.path); - sleep(2); + std::this_thread::sleep_for(sleep_duration); ASSERT_FALSE(apk_assets->IsUpToDate()); } diff --git a/tools/aapt/Package.cpp b/tools/aapt/Package.cpp index 5e0f87f0dcaf..60c4bf5c4131 100644 --- a/tools/aapt/Package.cpp +++ b/tools/aapt/Package.cpp @@ -292,13 +292,12 @@ bool processFile(Bundle* bundle, ZipFile* zip, } if (!hasData) { const String8& srcName = file->getSourceFile(); - time_t fileModWhen; - fileModWhen = getFileModDate(srcName.c_str()); - if (fileModWhen == (time_t) -1) { // file existence tested earlier, - return false; // not expecting an error here + auto fileModWhen = getFileModDate(srcName.c_str()); + if (fileModWhen == kInvalidModDate) { // file existence tested earlier, + return false; // not expecting an error here } - - if (fileModWhen > entry->getModWhen()) { + + if (toTimeT(fileModWhen) > entry->getModWhen()) { // mark as deleted so add() will succeed if (bundle->getVerbose()) { printf(" (removing old '%s')\n", storageName.c_str()); -- GitLab From 43cd59456415a03ca3cff79c805048f3872e08f1 Mon Sep 17 00:00:00 2001 From: John Wu Date: Sat, 7 Sep 2024 00:06:10 +0000 Subject: [PATCH 077/492] [Ravenwood] Use native Parcel and Binder implementation Switch over to native libbinder implementation Bug: 361785059 Flag: EXEMPT host side change only Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh Test: atest CtsOsTestCasesRavenwood FrameworksCoreTestsRavenwood Change-Id: Ie6507c156fadfc170759b85553c9e3e4f472c1f4 --- core/java/android/os/Binder.java | 126 +---- core/java/android/os/Parcel.java | 80 +-- core/java/android/os/StrictMode.java | 5 + core/java/android/util/Slog.java | 2 - core/jni/android_os_Parcel.cpp | 45 +- core/jni/android_util_Binder.cpp | 24 +- .../coretests/src/android/os/BinderTest.java | 6 +- .../coretests/src/android/os/BundleTest.java | 13 +- .../src/android/os/ParcelNullabilityTest.java | 6 +- .../coretests/src/android/os/ParcelTest.java | 9 - .../test/ravenwood/RavenwoodRuleImpl.java | 21 +- .../framework/android/os/Parcel_host.java | 530 ------------------ .../runtimehelper/ClassLoadHook.java | 1 + 13 files changed, 90 insertions(+), 778 deletions(-) delete mode 100644 ravenwood/runtime-helper-src/framework/android/os/Parcel_host.java diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index 4bc3dbedeb94..97e9f34064ba 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -21,6 +21,8 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.AppOpsManager; import android.compat.annotation.UnsupportedAppUsage; +import android.ravenwood.annotation.RavenwoodClassLoadHook; +import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.util.ExceptionUtils; import android.util.Log; import android.util.Slog; @@ -30,11 +32,9 @@ import com.android.internal.os.BinderCallHeavyHitterWatcher; import com.android.internal.os.BinderCallHeavyHitterWatcher.BinderCallHeavyHitterListener; import com.android.internal.os.BinderInternal; import com.android.internal.os.BinderInternal.CallSession; -import com.android.internal.os.SomeArgs; import com.android.internal.util.FastPrintWriter; import com.android.internal.util.FunctionalUtils.ThrowingRunnable; import com.android.internal.util.FunctionalUtils.ThrowingSupplier; -import com.android.internal.util.Preconditions; import dalvik.annotation.optimization.CriticalNative; @@ -48,7 +48,6 @@ import java.io.IOException; import java.io.PrintWriter; import java.lang.reflect.Modifier; import java.util.concurrent.atomic.AtomicReferenceArray; -import java.util.function.Supplier; /** * Base class for a remotable object, the core part of a lightweight @@ -82,6 +81,8 @@ import java.util.function.Supplier; * * @see IBinder */ +@RavenwoodKeepWholeClass +@RavenwoodClassLoadHook(RavenwoodClassLoadHook.LIBANDROID_LOADING_HOOK) public class Binder implements IBinder { /* * Set this flag to true to detect anonymous, local or member classes @@ -292,33 +293,6 @@ public class Binder implements IBinder { sWarnOnBlockingOnCurrentThread.set(sWarnOnBlocking); } - private static volatile ThreadLocal sIdentity$ravenwood; - - @android.ravenwood.annotation.RavenwoodKeepWholeClass - private static class IdentitySupplier implements Supplier { - @Override - public SomeArgs get() { - final SomeArgs args = SomeArgs.obtain(); - // Match IPCThreadState behavior - args.arg1 = Boolean.FALSE; - args.argi1 = android.os.Process.myUid(); - args.argi2 = android.os.Process.myPid(); - return args; - } - } - - /** @hide */ - @android.ravenwood.annotation.RavenwoodKeep - public static void init$ravenwood() { - sIdentity$ravenwood = ThreadLocal.withInitial(new IdentitySupplier()); - } - - /** @hide */ - @android.ravenwood.annotation.RavenwoodKeep - public static void reset$ravenwood() { - sIdentity$ravenwood = null; - } - /** * Raw native pointer to JavaBBinderHolder object. Owned by this Java object. Not null. */ @@ -346,14 +320,8 @@ public class Binder implements IBinder { * 0 for a synchronous call. */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native int getCallingPid(); - /** @hide */ - public static final int getCallingPid$ravenwood() { - return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().argi2; - } - /** * Return the Linux UID assigned to the process that sent you the * current transaction that is being processed. This UID can be used with @@ -362,14 +330,8 @@ public class Binder implements IBinder { * incoming transaction, then its own UID is returned. */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native int getCallingUid(); - /** @hide */ - public static final int getCallingUid$ravenwood() { - return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().argi1; - } - /** * Returns {@code true} if the current thread is currently executing an * incoming transaction. @@ -377,21 +339,13 @@ public class Binder implements IBinder { * @hide */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native boolean isDirectlyHandlingTransactionNative(); - /** @hide */ - public static final boolean isDirectlyHandlingTransactionNative$ravenwood() { - // Ravenwood doesn't support IPC - return false; - } - private static boolean sIsHandlingBinderTransaction = false; /** * @hide */ - @android.ravenwood.annotation.RavenwoodKeep public static final boolean isDirectlyHandlingTransaction() { return sIsHandlingBinderTransaction || isDirectlyHandlingTransactionNative(); } @@ -400,7 +354,6 @@ public class Binder implements IBinder { * This is Test API which will be used to override output of isDirectlyHandlingTransactionNative * @hide */ - @android.ravenwood.annotation.RavenwoodKeep public static void setIsDirectlyHandlingTransactionOverride(boolean isInTransaction) { sIsHandlingBinderTransaction = isInTransaction; } @@ -412,15 +365,8 @@ public class Binder implements IBinder { * @hide */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace private static native boolean hasExplicitIdentity(); - /** @hide */ - private static boolean hasExplicitIdentity$ravenwood() { - return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().arg1 - == Boolean.TRUE; - } - /** * Return the Linux UID assigned to the process that sent the transaction * currently being processed. @@ -429,7 +375,6 @@ public class Binder implements IBinder { * executing an incoming transaction and the calling identity has not been * explicitly set with {@link #clearCallingIdentity()} */ - @android.ravenwood.annotation.RavenwoodKeep public static final int getCallingUidOrThrow() { if (!isDirectlyHandlingTransaction() && !hasExplicitIdentity()) { throw new IllegalStateException( @@ -491,26 +436,8 @@ public class Binder implements IBinder { * @see #restoreCallingIdentity(long) */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native long clearCallingIdentity(); - /** @hide */ - public static final long clearCallingIdentity$ravenwood() { - final SomeArgs args = Preconditions.requireNonNullViaRavenwoodRule( - sIdentity$ravenwood).get(); - long res = ((long) args.argi1 << 32) | args.argi2; - if (args.arg1 == Boolean.TRUE) { - res |= (0x1 << 30); - } else { - res &= ~(0x1 << 30); - } - // Match IPCThreadState behavior - args.arg1 = Boolean.TRUE; - args.argi1 = android.os.Process.myUid(); - args.argi2 = android.os.Process.myPid(); - return res; - } - /** * Restore the identity of the incoming IPC on the current thread * back to a previously identity that was returned by {@link @@ -522,18 +449,8 @@ public class Binder implements IBinder { * @see #clearCallingIdentity */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native void restoreCallingIdentity(long token); - /** @hide */ - public static final void restoreCallingIdentity$ravenwood(long token) { - final SomeArgs args = Preconditions.requireNonNullViaRavenwoodRule( - sIdentity$ravenwood).get(); - args.arg1 = ((token & (0x1 << 30)) != 0) ? Boolean.TRUE : Boolean.FALSE; - args.argi1 = (int) (token >> 32); - args.argi2 = (int) (token & ~(0x1 << 30)); - } - /** * Convenience method for running the provided action enclosed in * {@link #clearCallingIdentity}/{@link #restoreCallingIdentity}. @@ -708,16 +625,9 @@ public class Binder implements IBinder { * * @hide */ - @android.ravenwood.annotation.RavenwoodReplace @SystemApi(client = SystemApi.Client.PRIVILEGED_APPS) public final native void markVintfStability(); - /** @hide */ - private void markVintfStability$ravenwood() { - // This is not useful for Ravenwood which uses local binder. - // TODO(b/361785059): Use real native libbinder. - } - /** * Use a VINTF-stability binder w/o VINTF requirements. Should be called * on a binder before it is sent out of process. @@ -736,14 +646,8 @@ public class Binder implements IBinder { * in order to prevent the process from holding on to objects longer than * it needs to. */ - @android.ravenwood.annotation.RavenwoodReplace public static final native void flushPendingCommands(); - /** @hide */ - public static final void flushPendingCommands$ravenwood() { - // Ravenwood doesn't support IPC; ignored - } - /** * Add the calling thread to the IPC thread pool. This function does * not return until the current process is exiting. @@ -801,7 +705,6 @@ public class Binder implements IBinder { *

If you're creating a Binder token (a Binder object without an attached interface), * you should use {@link #Binder(String)} instead. */ - @android.ravenwood.annotation.RavenwoodKeep public Binder() { this(null); } @@ -818,12 +721,9 @@ public class Binder implements IBinder { * Instead of creating multiple tokens with the same descriptor, consider adding a suffix to * help identify them. */ - @android.ravenwood.annotation.RavenwoodKeep public Binder(@Nullable String descriptor) { mObject = getNativeBBinderHolder(); - if (mObject != 0L) { - NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mObject); - } + NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mObject); if (FIND_POTENTIAL_LEAKS) { final Class klass = getClass(); @@ -842,7 +742,6 @@ public class Binder implements IBinder { * will be implemented for you to return the given owner IInterface when * the corresponding descriptor is requested. */ - @android.ravenwood.annotation.RavenwoodKeep public void attachInterface(@Nullable IInterface owner, @Nullable String descriptor) { mOwner = owner; mDescriptor = descriptor; @@ -851,7 +750,6 @@ public class Binder implements IBinder { /** * Default implementation returns an empty interface name. */ - @android.ravenwood.annotation.RavenwoodKeep public @Nullable String getInterfaceDescriptor() { return mDescriptor; } @@ -860,7 +758,6 @@ public class Binder implements IBinder { * Default implementation always returns true -- if you got here, * the object is alive. */ - @android.ravenwood.annotation.RavenwoodKeep public boolean pingBinder() { return true; } @@ -871,7 +768,6 @@ public class Binder implements IBinder { * Note that if you're calling on a local binder, this always returns true * because your process is alive if you're calling it. */ - @android.ravenwood.annotation.RavenwoodKeep public boolean isBinderAlive() { return true; } @@ -881,7 +777,6 @@ public class Binder implements IBinder { * to return the associated {@link IInterface} if it matches the requested * descriptor. */ - @android.ravenwood.annotation.RavenwoodKeep public @Nullable IInterface queryLocalInterface(@NonNull String descriptor) { if (mDescriptor != null && mDescriptor.equals(descriptor)) { return mOwner; @@ -1080,7 +975,6 @@ public class Binder implements IBinder { * * @hide */ - @android.ravenwood.annotation.RavenwoodKeep public @Nullable String getTransactionName(int transactionCode) { return null; } @@ -1089,7 +983,6 @@ public class Binder implements IBinder { * @hide */ @VisibleForTesting - @android.ravenwood.annotation.RavenwoodKeep public final @Nullable String getTransactionTraceName(int transactionCode) { final boolean isInterfaceUserDefined = getMaxTransactionId() == 0; if (mTransactionTraceNames == null) { @@ -1127,7 +1020,6 @@ public class Binder implements IBinder { return transactionTraceName; } - @android.ravenwood.annotation.RavenwoodKeep private @NonNull String getSimpleDescriptor() { String descriptor = mDescriptor; if (descriptor == null) { @@ -1147,7 +1039,6 @@ public class Binder implements IBinder { * @return The highest user-defined transaction id of all transactions. * @hide */ - @android.ravenwood.annotation.RavenwoodKeep public int getMaxTransactionId() { return 0; } @@ -1359,14 +1250,12 @@ public class Binder implements IBinder { /** * Local implementation is a no-op. */ - @android.ravenwood.annotation.RavenwoodKeep public void linkToDeath(@NonNull DeathRecipient recipient, int flags) { } /** * Local implementation is a no-op. */ - @android.ravenwood.annotation.RavenwoodKeep public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags) { return true; } @@ -1394,13 +1283,8 @@ public class Binder implements IBinder { } } - @android.ravenwood.annotation.RavenwoodReplace private static native long getNativeBBinderHolder(); - private static long getNativeBBinderHolder$ravenwood() { - return 0L; - } - /** * By default, we use the calling UID since we can always trust it. */ diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index 2ac2ae916e58..f7285523c01a 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -27,9 +27,8 @@ import android.annotation.SuppressLint; import android.annotation.TestApi; import android.app.AppOpsManager; import android.compat.annotation.UnsupportedAppUsage; +import android.ravenwood.annotation.RavenwoodClassLoadHook; import android.ravenwood.annotation.RavenwoodKeepWholeClass; -import android.ravenwood.annotation.RavenwoodRedirect; -import android.ravenwood.annotation.RavenwoodRedirectionClass; import android.ravenwood.annotation.RavenwoodReplace; import android.ravenwood.annotation.RavenwoodThrow; import android.text.TextUtils; @@ -234,7 +233,7 @@ import java.util.function.IntFunction; * {@link #readSparseArray(ClassLoader, Class)}. */ @RavenwoodKeepWholeClass -@RavenwoodRedirectionClass("Parcel_host") +@RavenwoodClassLoadHook(RavenwoodClassLoadHook.LIBANDROID_LOADING_HOOK) public final class Parcel { private static final boolean DEBUG_RECYCLE = false; @@ -387,148 +386,98 @@ public final class Parcel { private static final int SIZE_COMPLEX_TYPE = 1; @CriticalNative - @RavenwoodRedirect private static native void nativeMarkSensitive(long nativePtr); @FastNative - @RavenwoodThrow private static native void nativeMarkForBinder(long nativePtr, IBinder binder); @CriticalNative - @RavenwoodThrow private static native boolean nativeIsForRpc(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeDataSize(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeDataAvail(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeDataPosition(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeDataCapacity(long nativePtr); @FastNative - @RavenwoodRedirect private static native void nativeSetDataSize(long nativePtr, int size); @CriticalNative - @RavenwoodRedirect private static native void nativeSetDataPosition(long nativePtr, int pos); @FastNative - @RavenwoodRedirect private static native void nativeSetDataCapacity(long nativePtr, int size); @CriticalNative - @RavenwoodRedirect private static native boolean nativePushAllowFds(long nativePtr, boolean allowFds); @CriticalNative - @RavenwoodRedirect private static native void nativeRestoreAllowFds(long nativePtr, boolean lastValue); - @RavenwoodRedirect private static native void nativeWriteByteArray(long nativePtr, byte[] b, int offset, int len); - @RavenwoodRedirect private static native void nativeWriteBlob(long nativePtr, byte[] b, int offset, int len); @CriticalNative - @RavenwoodRedirect private static native int nativeWriteInt(long nativePtr, int val); @CriticalNative - @RavenwoodRedirect private static native int nativeWriteLong(long nativePtr, long val); @CriticalNative - @RavenwoodRedirect private static native int nativeWriteFloat(long nativePtr, float val); @CriticalNative - @RavenwoodRedirect private static native int nativeWriteDouble(long nativePtr, double val); - @RavenwoodThrow private static native void nativeSignalExceptionForError(int error); @FastNative - @RavenwoodRedirect private static native void nativeWriteString8(long nativePtr, String val); @FastNative - @RavenwoodRedirect private static native void nativeWriteString16(long nativePtr, String val); @FastNative - @RavenwoodThrow private static native void nativeWriteStrongBinder(long nativePtr, IBinder val); @FastNative - @RavenwoodRedirect private static native void nativeWriteFileDescriptor(long nativePtr, FileDescriptor val); - @RavenwoodRedirect private static native byte[] nativeCreateByteArray(long nativePtr); - @RavenwoodRedirect private static native boolean nativeReadByteArray(long nativePtr, byte[] dest, int destLen); - @RavenwoodRedirect private static native byte[] nativeReadBlob(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeReadInt(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native long nativeReadLong(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native float nativeReadFloat(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native double nativeReadDouble(long nativePtr); @FastNative - @RavenwoodRedirect private static native String nativeReadString8(long nativePtr); @FastNative - @RavenwoodRedirect private static native String nativeReadString16(long nativePtr); @FastNative - @RavenwoodThrow private static native IBinder nativeReadStrongBinder(long nativePtr); @FastNative - @RavenwoodRedirect private static native FileDescriptor nativeReadFileDescriptor(long nativePtr); - @RavenwoodRedirect private static native long nativeCreate(); - @RavenwoodRedirect private static native void nativeFreeBuffer(long nativePtr); - @RavenwoodRedirect private static native void nativeDestroy(long nativePtr); - @RavenwoodRedirect private static native byte[] nativeMarshall(long nativePtr); - @RavenwoodRedirect private static native void nativeUnmarshall( long nativePtr, byte[] data, int offset, int length); - @RavenwoodRedirect private static native int nativeCompareData(long thisNativePtr, long otherNativePtr); - @RavenwoodRedirect private static native boolean nativeCompareDataInRange( long ptrA, int offsetA, long ptrB, int offsetB, int length); - @RavenwoodRedirect private static native void nativeAppendFrom( long thisNativePtr, long otherNativePtr, int offset, int length); @CriticalNative - @RavenwoodRedirect private static native boolean nativeHasFileDescriptors(long nativePtr); - @RavenwoodRedirect private static native boolean nativeHasFileDescriptorsInRange( long nativePtr, int offset, int length); - @RavenwoodRedirect private static native boolean nativeHasBinders(long nativePtr); - @RavenwoodRedirect private static native boolean nativeHasBindersInRange( long nativePtr, int offset, int length); - @RavenwoodThrow private static native void nativeWriteInterfaceToken(long nativePtr, String interfaceName); - @RavenwoodThrow private static native void nativeEnforceInterface(long nativePtr, String interfaceName); @CriticalNative - @RavenwoodThrow private static native boolean nativeReplaceCallingWorkSourceUid( long nativePtr, int workSourceUid); @CriticalNative - @RavenwoodThrow private static native int nativeReadCallingWorkSourceUid(long nativePtr); /** Last time exception with a stack trace was written */ @@ -537,7 +486,6 @@ public final class Parcel { private static final int WRITE_EXCEPTION_STACK_TRACE_THRESHOLD_MS = 1000; @CriticalNative - @RavenwoodThrow private static native long nativeGetOpenAshmemSize(long nativePtr); public final static Parcelable.Creator STRING_CREATOR @@ -701,12 +649,10 @@ public final class Parcel { /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - @RavenwoodThrow public static native long getGlobalAllocSize(); /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - @RavenwoodThrow public static native long getGlobalAllocCount(); /** @@ -1298,6 +1244,7 @@ public final class Parcel { * @hide */ @UnsupportedAppUsage + @RavenwoodThrow(blockedBy = android.text.Spanned.class) public final void writeCharSequence(@Nullable CharSequence val) { TextUtils.writeToParcel(val, this, 0); } @@ -3037,7 +2984,7 @@ public final class Parcel { * @see #writeNoException * @see #readException */ - @RavenwoodReplace + @RavenwoodReplace(blockedBy = AppOpsManager.class) public final void writeException(@NonNull Exception e) { AppOpsManager.prefixParcelWithAppOpsIfNeeded(this); @@ -3076,10 +3023,15 @@ public final class Parcel { } } - /** @hide */ - public final void writeException$ravenwood(@NonNull Exception e) { - // Ravenwood doesn't support IPC, no transaction headers needed - writeInt(getExceptionCode(e)); + private void writeException$ravenwood(@NonNull Exception e) { + int code = getExceptionCode(e); + writeInt(code); + if (code == 0) { + if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } + throw new RuntimeException(e); + } writeString(e.getMessage()); writeInt(0); } @@ -3137,7 +3089,7 @@ public final class Parcel { * @see #writeException * @see #readException */ - @RavenwoodReplace + @RavenwoodReplace(blockedBy = AppOpsManager.class) public final void writeNoException() { AppOpsManager.prefixParcelWithAppOpsIfNeeded(this); @@ -3168,9 +3120,7 @@ public final class Parcel { } } - /** @hide */ - public final void writeNoException$ravenwood() { - // Ravenwood doesn't support IPC, no transaction headers needed + private void writeNoException$ravenwood() { writeInt(0); } diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java index 50b73a9d3f66..81dc46ecbd3a 100644 --- a/core/java/android/os/StrictMode.java +++ b/core/java/android/os/StrictMode.java @@ -2605,10 +2605,15 @@ public final class StrictMode { * (Java) thread-local policy value. */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) + @android.ravenwood.annotation.RavenwoodReplace private static void onBinderStrictModePolicyChange(@ThreadPolicyMask int newPolicy) { setBlockGuardPolicy(newPolicy); } + private static void onBinderStrictModePolicyChange$ravenwood(@ThreadPolicyMask int newPolicy) { + /* no-op */ + } + /** * A tracked, critical time span. (e.g. during an animation.) * diff --git a/core/java/android/util/Slog.java b/core/java/android/util/Slog.java index 9ecb4cbb283d..b2017a5fa868 100644 --- a/core/java/android/util/Slog.java +++ b/core/java/android/util/Slog.java @@ -224,7 +224,6 @@ public final class Slog { /** * Similar to {@link #wtf(String, String)}, but does not output anything to the log. */ - @android.ravenwood.annotation.RavenwoodThrow public static void wtfQuiet(@Nullable String tag, @NonNull String msg) { Log.wtfQuiet(Log.LOG_ID_SYSTEM, tag, msg, true); } @@ -243,7 +242,6 @@ public final class Slog { * @see Log#wtfStack(String, String) */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) - @android.ravenwood.annotation.RavenwoodThrow public static int wtfStack(@Nullable String tag, @NonNull String msg) { return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, true, true); } diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp index 584ebaa221fc..dec724b6a7ff 100644 --- a/core/jni/android_os_Parcel.cpp +++ b/core/jni/android_os_Parcel.cpp @@ -90,7 +90,7 @@ void recycleJavaParcelObject(JNIEnv* env, jobject parcelObj) env->CallVoidMethod(parcelObj, gParcelOffsets.recycle); } -static void android_os_Parcel_markSensitive(jlong nativePtr) +static void android_os_Parcel_markSensitive(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel) { @@ -116,30 +116,30 @@ static void android_os_Parcel_markForBinder(JNIEnv* env, jclass clazz, jlong nat } } -static jboolean android_os_Parcel_isForRpc(jlong nativePtr) { +static jboolean android_os_Parcel_isForRpc(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->isForRpc() : false; } -static jint android_os_Parcel_dataSize(jlong nativePtr) +static jint android_os_Parcel_dataSize(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->dataSize() : 0; } -static jint android_os_Parcel_dataAvail(jlong nativePtr) +static jint android_os_Parcel_dataAvail(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->dataAvail() : 0; } -static jint android_os_Parcel_dataPosition(jlong nativePtr) +static jint android_os_Parcel_dataPosition(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->dataPosition() : 0; } -static jint android_os_Parcel_dataCapacity(jlong nativePtr) +static jint android_os_Parcel_dataCapacity(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->dataCapacity() : 0; @@ -156,7 +156,7 @@ static void android_os_Parcel_setDataSize(JNIEnv* env, jclass clazz, jlong nativ } } -static void android_os_Parcel_setDataPosition(jlong nativePtr, jint pos) +static void android_os_Parcel_setDataPosition(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jint pos) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -175,7 +175,8 @@ static void android_os_Parcel_setDataCapacity(JNIEnv* env, jclass clazz, jlong n } } -static jboolean android_os_Parcel_pushAllowFds(jlong nativePtr, jboolean allowFds) +static jboolean android_os_Parcel_pushAllowFds(CRITICAL_JNI_PARAMS_COMMA + jlong nativePtr, jboolean allowFds) { Parcel* parcel = reinterpret_cast(nativePtr); jboolean ret = JNI_TRUE; @@ -185,7 +186,8 @@ static jboolean android_os_Parcel_pushAllowFds(jlong nativePtr, jboolean allowFd return ret; } -static void android_os_Parcel_restoreAllowFds(jlong nativePtr, jboolean lastValue) +static void android_os_Parcel_restoreAllowFds(CRITICAL_JNI_PARAMS_COMMA + jlong nativePtr, jboolean lastValue) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -259,22 +261,22 @@ static void android_os_Parcel_writeBlob(JNIEnv* env, jclass clazz, jlong nativeP blob.release(); } -static int android_os_Parcel_writeInt(jlong nativePtr, jint val) { +static int android_os_Parcel_writeInt(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jint val) { Parcel* parcel = reinterpret_cast(nativePtr); return (parcel != NULL) ? parcel->writeInt32(val) : OK; } -static int android_os_Parcel_writeLong(jlong nativePtr, jlong val) { +static int android_os_Parcel_writeLong(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jlong val) { Parcel* parcel = reinterpret_cast(nativePtr); return (parcel != NULL) ? parcel->writeInt64(val) : OK; } -static int android_os_Parcel_writeFloat(jlong nativePtr, jfloat val) { +static int android_os_Parcel_writeFloat(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jfloat val) { Parcel* parcel = reinterpret_cast(nativePtr); return (parcel != NULL) ? parcel->writeFloat(val) : OK; } -static int android_os_Parcel_writeDouble(jlong nativePtr, jdouble val) { +static int android_os_Parcel_writeDouble(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jdouble val) { Parcel* parcel = reinterpret_cast(nativePtr); return (parcel != NULL) ? parcel->writeDouble(val) : OK; } @@ -446,7 +448,7 @@ static jbyteArray android_os_Parcel_readBlob(JNIEnv* env, jclass clazz, jlong na return ret; } -static jint android_os_Parcel_readInt(jlong nativePtr) +static jint android_os_Parcel_readInt(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -455,7 +457,7 @@ static jint android_os_Parcel_readInt(jlong nativePtr) return 0; } -static jlong android_os_Parcel_readLong(jlong nativePtr) +static jlong android_os_Parcel_readLong(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -464,7 +466,7 @@ static jlong android_os_Parcel_readLong(jlong nativePtr) return 0; } -static jfloat android_os_Parcel_readFloat(jlong nativePtr) +static jfloat android_os_Parcel_readFloat(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -473,7 +475,7 @@ static jfloat android_os_Parcel_readFloat(jlong nativePtr) return 0; } -static jdouble android_os_Parcel_readDouble(jlong nativePtr) +static jdouble android_os_Parcel_readDouble(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -690,7 +692,7 @@ static jboolean android_os_Parcel_hasBindersInRange(JNIEnv* env, jclass clazz, j return JNI_FALSE; } -static jboolean android_os_Parcel_hasFileDescriptors(jlong nativePtr) +static jboolean android_os_Parcel_hasFileDescriptors(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { jboolean ret = JNI_FALSE; Parcel* parcel = reinterpret_cast(nativePtr); @@ -807,7 +809,7 @@ static jlong android_os_Parcel_getGlobalAllocCount(JNIEnv* env, jclass clazz) return Parcel::getGlobalAllocCount(); } -static jlong android_os_Parcel_getOpenAshmemSize(jlong nativePtr) +static jlong android_os_Parcel_getOpenAshmemSize(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -816,7 +818,7 @@ static jlong android_os_Parcel_getOpenAshmemSize(jlong nativePtr) return 0; } -static jint android_os_Parcel_readCallingWorkSourceUid(jlong nativePtr) +static jint android_os_Parcel_readCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -825,7 +827,8 @@ static jint android_os_Parcel_readCallingWorkSourceUid(jlong nativePtr) return IPCThreadState::kUnsetWorkSource; } -static jboolean android_os_Parcel_replaceCallingWorkSourceUid(jlong nativePtr, jint uid) +static jboolean android_os_Parcel_replaceCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA + jlong nativePtr, jint uid) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index 921b77d61f4d..f2c70b5f41d4 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -1152,60 +1152,60 @@ void signalExceptionForError(JNIEnv* env, jobject obj, status_t err, // ---------------------------------------------------------------------------- -static jint android_os_Binder_getCallingPid() +static jint android_os_Binder_getCallingPid(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->getCallingPid(); } -static jint android_os_Binder_getCallingUid() +static jint android_os_Binder_getCallingUid(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->getCallingUid(); } -static jboolean android_os_Binder_isDirectlyHandlingTransactionNative() { +static jboolean android_os_Binder_isDirectlyHandlingTransactionNative(CRITICAL_JNI_PARAMS) { return getCurrentServingCall() == BinderCallType::BINDER; } -static jlong android_os_Binder_clearCallingIdentity() +static jlong android_os_Binder_clearCallingIdentity(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->clearCallingIdentity(); } -static void android_os_Binder_restoreCallingIdentity(jlong token) +static void android_os_Binder_restoreCallingIdentity(CRITICAL_JNI_PARAMS_COMMA jlong token) { IPCThreadState::self()->restoreCallingIdentity(token); } -static jboolean android_os_Binder_hasExplicitIdentity() { +static jboolean android_os_Binder_hasExplicitIdentity(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->hasExplicitIdentity(); } -static void android_os_Binder_setThreadStrictModePolicy(jint policyMask) +static void android_os_Binder_setThreadStrictModePolicy(CRITICAL_JNI_PARAMS_COMMA jint policyMask) { IPCThreadState::self()->setStrictModePolicy(policyMask); } -static jint android_os_Binder_getThreadStrictModePolicy() +static jint android_os_Binder_getThreadStrictModePolicy(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->getStrictModePolicy(); } -static jlong android_os_Binder_setCallingWorkSourceUid(jint workSource) +static jlong android_os_Binder_setCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA jint workSource) { return IPCThreadState::self()->setCallingWorkSourceUid(workSource); } -static jlong android_os_Binder_getCallingWorkSourceUid() +static jlong android_os_Binder_getCallingWorkSourceUid(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->getCallingWorkSourceUid(); } -static jlong android_os_Binder_clearCallingWorkSource() +static jlong android_os_Binder_clearCallingWorkSource(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->clearCallingWorkSource(); } -static void android_os_Binder_restoreCallingWorkSource(jlong token) +static void android_os_Binder_restoreCallingWorkSource(CRITICAL_JNI_PARAMS_COMMA jlong token) { IPCThreadState::self()->restoreCallingWorkSource(token); } diff --git a/core/tests/coretests/src/android/os/BinderTest.java b/core/tests/coretests/src/android/os/BinderTest.java index 9767d677807d..90ec93e46418 100644 --- a/core/tests/coretests/src/android/os/BinderTest.java +++ b/core/tests/coretests/src/android/os/BinderTest.java @@ -24,18 +24,16 @@ import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.testng.Assert.assertThrows; -import android.platform.test.annotations.IgnoreUnderRavenwood; +import android.platform.test.annotations.DisabledOnRavenwood; import android.platform.test.ravenwood.RavenwoodRule; import androidx.test.filters.SmallTest; import com.android.internal.os.BinderInternal; - import org.junit.Rule; import org.junit.Test; -@IgnoreUnderRavenwood(blockedBy = WorkSource.class) public class BinderTest { private static final int UID = 100; @@ -89,6 +87,7 @@ public class BinderTest { @SmallTest @Test(expected = java.lang.SecurityException.class) + @DisabledOnRavenwood(blockedBy = ServiceManagerNative.class) public void testServiceManagerNativeSecurityException() throws RemoteException { // Find the service manager IServiceManager sServiceManager = ServiceManagerNative @@ -101,6 +100,7 @@ public class BinderTest { @SmallTest @Test(expected = java.lang.NullPointerException.class) + @DisabledOnRavenwood(blockedBy = ServiceManagerNative.class) public void testServiceManagerNativeNullptrException() throws RemoteException { // Find the service manager IServiceManager sServiceManager = ServiceManagerNative diff --git a/core/tests/coretests/src/android/os/BundleTest.java b/core/tests/coretests/src/android/os/BundleTest.java index ded6fc5de2e5..31e07524d777 100644 --- a/core/tests/coretests/src/android/os/BundleTest.java +++ b/core/tests/coretests/src/android/os/BundleTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import android.platform.test.annotations.DisabledOnRavenwood; -import android.platform.test.annotations.IgnoreUnderRavenwood; import android.platform.test.annotations.Presubmit; import android.platform.test.ravenwood.RavenwoodRule; import android.util.Log; @@ -131,7 +130,6 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = ParcelFileDescriptor.class) public void testCreateFromParcel() throws Exception { boolean withFd; Parcel p; @@ -312,7 +310,7 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP") public void kindofEquals_lazyValuesAndDifferentClassLoaders_returnsFalse() { Parcelable p1 = new CustomParcelable(13, "Tiramisu"); Parcelable p2 = new CustomParcelable(13, "Tiramisu"); @@ -368,7 +366,6 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void readWriteLengthMismatch_logsWtf() throws Exception { mWtfHandler = Log.setWtfHandler((tag, e, system) -> { throw new RuntimeException(e); @@ -383,7 +380,7 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP") public void getParcelable_whenThrowingAndNotDefusing_throws() throws Exception { Bundle.setShouldDefuse(false); Bundle bundle = new Bundle(); @@ -396,7 +393,7 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP") public void getParcelable_whenThrowingAndDefusing_returnsNull() throws Exception { Bundle.setShouldDefuse(true); Bundle bundle = new Bundle(); @@ -412,7 +409,7 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP") public void getParcelable_whenThrowingAndDefusing_leavesElement() throws Exception { Bundle.setShouldDefuse(true); Bundle bundle = new Bundle(); @@ -447,7 +444,6 @@ public class BundleTest { } @Test - @DisabledOnRavenwood(blockedBy = Parcel.class) public void parcelledBundleWithBinder_shouldReturnHasBindersTrue() throws Exception { Bundle bundle = new Bundle(); bundle.putParcelable("test", new CustomParcelable(13, "Tiramisu")); @@ -470,7 +466,6 @@ public class BundleTest { } @Test - @DisabledOnRavenwood(blockedBy = Parcel.class) public void parcelledBundleWithoutBinder_shouldReturnHasBindersFalse() throws Exception { Bundle bundle = new Bundle(); bundle.putParcelable("test", new CustomParcelable(13, "Tiramisu")); diff --git a/core/tests/coretests/src/android/os/ParcelNullabilityTest.java b/core/tests/coretests/src/android/os/ParcelNullabilityTest.java index 09395f15a57b..96316c436d61 100644 --- a/core/tests/coretests/src/android/os/ParcelNullabilityTest.java +++ b/core/tests/coretests/src/android/os/ParcelNullabilityTest.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import android.platform.test.annotations.IgnoreUnderRavenwood; +import android.platform.test.annotations.DisabledOnRavenwood; import android.platform.test.ravenwood.RavenwoodRule; import android.util.ArrayMap; @@ -67,7 +67,7 @@ public final class ParcelNullabilityTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(blockedBy = android.text.Spanned.class) public void nullCharSequence() { Parcel p = Parcel.obtain(); p.writeCharSequence(null); @@ -76,7 +76,6 @@ public final class ParcelNullabilityTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void nullStrongBinder() { Parcel p = Parcel.obtain(); p.writeStrongBinder(null); @@ -85,7 +84,6 @@ public final class ParcelNullabilityTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void nullStringInterface() { Parcel p = Parcel.obtain(); p.writeStrongInterface(null); diff --git a/core/tests/coretests/src/android/os/ParcelTest.java b/core/tests/coretests/src/android/os/ParcelTest.java index 037323111e9f..da9d687ee2b0 100644 --- a/core/tests/coretests/src/android/os/ParcelTest.java +++ b/core/tests/coretests/src/android/os/ParcelTest.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; -import android.platform.test.annotations.IgnoreUnderRavenwood; import android.platform.test.annotations.Presubmit; import android.platform.test.ravenwood.RavenwoodRule; import android.util.Log; @@ -48,7 +47,6 @@ public class ParcelTest { private static final String INTERFACE_TOKEN_2 = "Another IBinder interface token"; @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testIsForRpc() { Parcel p = Parcel.obtain(); assertEquals(false, p.isForRpc()); @@ -56,7 +54,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCallingWorkSourceUidAfterWrite() { Parcel p = Parcel.obtain(); // Method does not throw if replaceCallingWorkSourceUid is called before requests headers @@ -77,7 +74,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCallingWorkSourceUidAfterEnforce() { Parcel p = Parcel.obtain(); p.writeInterfaceToken(INTERFACE_TOKEN_1); @@ -95,7 +91,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testParcelWithMultipleHeaders() { Parcel p = Parcel.obtain(); Binder.setCallingWorkSourceUid(WORK_SOURCE_1); @@ -153,7 +148,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenSameDataWithBinder() { Binder binder = new Binder(); Parcel pA = Parcel.obtain(); @@ -313,7 +307,6 @@ public class ParcelTest { * and 1M length for complex objects are allowed. */ @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testAllocations_whenWithinLimit() { Binder.setIsDirectlyHandlingTransactionOverride(true); Parcel p = Parcel.obtain(); @@ -398,7 +391,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testHasBinders_AfterWritingBinderToParcel() { Binder binder = new Binder(); Parcel pA = Parcel.obtain(); @@ -410,7 +402,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testHasBindersInRange_AfterWritingBinderToParcel() { Binder binder = new Binder(); Parcel pA = Parcel.obtain(); diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java index 0059360a0a29..c4336762c0b8 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java @@ -26,6 +26,7 @@ import android.app.ActivityManager; import android.app.Instrumentation; import android.app.ResourcesManager; import android.content.res.Resources; +import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.os.HandlerThread; @@ -67,6 +68,8 @@ public class RavenwoodRuleImpl { private static ScheduledFuture sPendingTimeout; + private static long sOriginalIdentityToken = -1; + /** * When enabled, attempt to detect uncaught exceptions from background threads. */ @@ -85,6 +88,19 @@ public class RavenwoodRuleImpl { sPendingUncaughtException.compareAndSet(null, throwable); }; + // TODO: expose packCallingIdentity function in libbinder and use it directly + // See: packCallingIdentity in frameworks/native/libs/binder/IPCThreadState.cpp + private static long packBinderIdentityToken( + boolean hasExplicitIdentity, int callingUid, int callingPid) { + long res = ((long) callingUid << 32) | callingPid; + if (hasExplicitIdentity) { + res |= (0x1 << 30); + } else { + res &= ~(0x1 << 30); + } + return res; + } + public static void init(RavenwoodRule rule) throws IOException { if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) { maybeThrowPendingUncaughtException(false); @@ -92,7 +108,8 @@ public class RavenwoodRuleImpl { } android.os.Process.init$ravenwood(rule.mUid, rule.mPid); - android.os.Binder.init$ravenwood(); + sOriginalIdentityToken = Binder.clearCallingIdentity(); + Binder.restoreCallingIdentity(packBinderIdentityToken(false, rule.mUid, rule.mPid)); setSystemProperties(rule.mSystemProperties); ServiceManager.init$ravenwood(); @@ -173,7 +190,7 @@ public class RavenwoodRuleImpl { ServiceManager.reset$ravenwood(); setSystemProperties(RavenwoodSystemProperties.DEFAULT_VALUES); - android.os.Binder.reset$ravenwood(); + Binder.restoreCallingIdentity(sOriginalIdentityToken); android.os.Process.reset$ravenwood(); ResourcesManager.setInstance(null); // Better structure needed. diff --git a/ravenwood/runtime-helper-src/framework/android/os/Parcel_host.java b/ravenwood/runtime-helper-src/framework/android/os/Parcel_host.java deleted file mode 100644 index 720f1d227326..000000000000 --- a/ravenwood/runtime-helper-src/framework/android/os/Parcel_host.java +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Copyright (C) 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package android.os; - -import android.system.ErrnoException; -import android.system.Os; -import android.util.Log; - -import java.io.FileDescriptor; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicLong; - -/** - * Tentative, partial implementation of the Parcel native methods, using Java's - * {@code byte[]}. - * (We don't use a {@link ByteBuffer} because there's enough semantics differences between Parcel - * and {@link ByteBuffer}, and it didn't work out. - * e.g. Parcel seems to allow moving the data position to be beyond its size? Which - * {@link ByteBuffer} wouldn't allow...) - */ -public class Parcel_host { - private static final String TAG = "Parcel"; - - private Parcel_host() { - } - - private static final AtomicLong sNextId = new AtomicLong(1); - - private static final Map sInstances = new ConcurrentHashMap<>(); - - private boolean mDeleted = false; - - private byte[] mBuffer; - private int mSize; - private int mPos; - - private boolean mSensitive; - private boolean mAllowFds; - - // TODO Use the actual value from Parcel.java. - private static final int OK = 0; - - private final Map mFdMap = new ConcurrentHashMap<>(); - - private static final int FD_PLACEHOLDER = 0xDEADBEEF; - private static final int FD_PAYLOAD_SIZE = 8; - - private void validate() { - if (mDeleted) { - // TODO: Put more info - throw new RuntimeException("Parcel already destroyed"); - } - } - - private static Parcel_host getInstance(long id) { - Parcel_host p = sInstances.get(id); - if (p == null) { - // TODO: Put more info - throw new RuntimeException("Parcel doesn't exist with id=" + id); - } - p.validate(); - return p; - } - - /** Native method substitution */ - public static long nativeCreate() { - final long id = sNextId.getAndIncrement(); - final Parcel_host p = new Parcel_host(); - sInstances.put(id, p); - p.init(); - return id; - } - - private void init() { - mBuffer = new byte[0]; - mSize = 0; - mPos = 0; - mSensitive = false; - mAllowFds = true; - mFdMap.clear(); - } - - private void updateSize() { - if (mSize < mPos) { - mSize = mPos; - } - } - - /** Native method substitution */ - public static void nativeDestroy(long nativePtr) { - getInstance(nativePtr).mDeleted = true; - sInstances.remove(nativePtr); - } - - /** Native method substitution */ - public static void nativeFreeBuffer(long nativePtr) { - getInstance(nativePtr).freeBuffer(); - } - - /** Native method substitution */ - private void freeBuffer() { - init(); - } - - private int getCapacity() { - return mBuffer.length; - } - - private void ensureMoreCapacity(int size) { - ensureCapacity(mPos + size); - } - - private void ensureCapacity(int targetSize) { - if (targetSize <= getCapacity()) { - return; - } - var newSize = getCapacity() * 2; - if (newSize < targetSize) { - newSize = targetSize; - } - forceSetCapacity(newSize); - } - - private void forceSetCapacity(int newSize) { - var newBuf = new byte[newSize]; - - // Copy - System.arraycopy(mBuffer, 0, newBuf, 0, Math.min(newSize, getCapacity())); - - this.mBuffer = newBuf; - } - - private void ensureDataAvailable(int requestSize) { - if (mSize - mPos < requestSize) { - throw new RuntimeException(String.format( - "Pacel data underflow. size=%d, pos=%d, request=%d", mSize, mPos, requestSize)); - } - } - - /** Native method substitution */ - public static void nativeMarkSensitive(long nativePtr) { - getInstance(nativePtr).mSensitive = true; - } - - /** Native method substitution */ - public static int nativeDataSize(long nativePtr) { - return getInstance(nativePtr).mSize; - } - - /** Native method substitution */ - public static int nativeDataAvail(long nativePtr) { - var p = getInstance(nativePtr); - return p.mSize - p.mPos; - } - - /** Native method substitution */ - public static int nativeDataPosition(long nativePtr) { - return getInstance(nativePtr).mPos; - } - - /** Native method substitution */ - public static int nativeDataCapacity(long nativePtr) { - return getInstance(nativePtr).mBuffer.length; - } - - /** Native method substitution */ - public static void nativeSetDataSize(long nativePtr, int size) { - var p = getInstance(nativePtr); - p.ensureCapacity(size); - getInstance(nativePtr).mSize = size; - } - - /** Native method substitution */ - public static void nativeSetDataPosition(long nativePtr, int pos) { - var p = getInstance(nativePtr); - // TODO: Should this change the size or the capacity?? - p.mPos = pos; - } - - /** Native method substitution */ - public static void nativeSetDataCapacity(long nativePtr, int size) { - if (size < 0) { - throw new IllegalArgumentException("size < 0: size=" + size); - } - var p = getInstance(nativePtr); - if (p.getCapacity() < size) { - p.forceSetCapacity(size); - } - } - - /** Native method substitution */ - public static boolean nativePushAllowFds(long nativePtr, boolean allowFds) { - var p = getInstance(nativePtr); - var prev = p.mAllowFds; - p.mAllowFds = allowFds; - return prev; - } - - /** Native method substitution */ - public static void nativeRestoreAllowFds(long nativePtr, boolean lastValue) { - getInstance(nativePtr).mAllowFds = lastValue; - } - - /** Native method substitution */ - public static void nativeWriteByteArray(long nativePtr, byte[] b, int offset, int len) { - nativeWriteBlob(nativePtr, b, offset, len); - } - - /** Native method substitution */ - public static void nativeWriteBlob(long nativePtr, byte[] b, int offset, int len) { - var p = getInstance(nativePtr); - - if (b == null) { - nativeWriteInt(nativePtr, -1); - } else { - final var alignedSize = align4(len); - - nativeWriteInt(nativePtr, len); - - p.ensureMoreCapacity(alignedSize); - - System.arraycopy(b, offset, p.mBuffer, p.mPos, len); - p.mPos += alignedSize; - p.updateSize(); - } - } - - /** Native method substitution */ - public static int nativeWriteInt(long nativePtr, int value) { - var p = getInstance(nativePtr); - p.ensureMoreCapacity(Integer.BYTES); - - p.mBuffer[p.mPos++] = (byte) ((value >> 24) & 0xff); - p.mBuffer[p.mPos++] = (byte) ((value >> 16) & 0xff); - p.mBuffer[p.mPos++] = (byte) ((value >> 8) & 0xff); - p.mBuffer[p.mPos++] = (byte) ((value >> 0) & 0xff); - - p.updateSize(); - - return OK; - } - - /** Native method substitution */ - public static int nativeWriteLong(long nativePtr, long value) { - nativeWriteInt(nativePtr, (int) (value >>> 32)); - nativeWriteInt(nativePtr, (int) (value)); - return OK; - } - - /** Native method substitution */ - public static int nativeWriteFloat(long nativePtr, float val) { - return nativeWriteInt(nativePtr, Float.floatToIntBits(val)); - } - - /** Native method substitution */ - public static int nativeWriteDouble(long nativePtr, double val) { - return nativeWriteLong(nativePtr, Double.doubleToLongBits(val)); - } - - private static int align4(int val) { - return ((val + 3) / 4) * 4; - } - - /** Native method substitution */ - public static void nativeWriteString8(long nativePtr, String val) { - if (val == null) { - nativeWriteBlob(nativePtr, null, 0, 0); - } else { - var bytes = val.getBytes(StandardCharsets.UTF_8); - nativeWriteBlob(nativePtr, bytes, 0, bytes.length); - } - } - - /** Native method substitution */ - public static void nativeWriteString16(long nativePtr, String val) { - // Just reuse String8 - nativeWriteString8(nativePtr, val); - } - - /** Native method substitution */ - public static byte[] nativeCreateByteArray(long nativePtr) { - return nativeReadBlob(nativePtr); - } - - /** Native method substitution */ - public static boolean nativeReadByteArray(long nativePtr, byte[] dest, int destLen) { - if (dest == null) { - return false; - } - var data = nativeReadBlob(nativePtr); - if (data == null) { - System.err.println("Percel has NULL, which is unexpected."); // TODO: Is this correct? - return false; - } - // TODO: Make sure the check logic is correct. - if (data.length != destLen) { - System.err.println("Byte array size mismatch: expected=" - + data.length + " given=" + destLen); - return false; - } - System.arraycopy(data, 0, dest, 0, data.length); - return true; - } - - /** Native method substitution */ - public static byte[] nativeReadBlob(long nativePtr) { - var p = getInstance(nativePtr); - if (p.mSize - p.mPos < 4) { - // Match native impl that returns "null" when not enough data - return null; - } - final var size = nativeReadInt(nativePtr); - if (size == -1) { - return null; - } - try { - p.ensureDataAvailable(align4(size)); - } catch (Exception e) { - System.err.println(e.toString()); - return null; - } - - var bytes = new byte[size]; - System.arraycopy(p.mBuffer, p.mPos, bytes, 0, size); - - p.mPos += align4(size); - - return bytes; - } - - /** Native method substitution */ - public static int nativeReadInt(long nativePtr) { - var p = getInstance(nativePtr); - - if (p.mSize - p.mPos < 4) { - // Match native impl that returns "0" when not enough data - return 0; - } - - var ret = (((p.mBuffer[p.mPos++] & 0xff) << 24) - | ((p.mBuffer[p.mPos++] & 0xff) << 16) - | ((p.mBuffer[p.mPos++] & 0xff) << 8) - | ((p.mBuffer[p.mPos++] & 0xff) << 0)); - - return ret; - } - - /** Native method substitution */ - public static long nativeReadLong(long nativePtr) { - return (((long) nativeReadInt(nativePtr)) << 32) - | (((long) nativeReadInt(nativePtr)) & 0xffff_ffffL); - } - - /** Native method substitution */ - public static float nativeReadFloat(long nativePtr) { - return Float.intBitsToFloat(nativeReadInt(nativePtr)); - } - - /** Native method substitution */ - public static double nativeReadDouble(long nativePtr) { - return Double.longBitsToDouble(nativeReadLong(nativePtr)); - } - - /** Native method substitution */ - public static String nativeReadString8(long nativePtr) { - final var bytes = nativeReadBlob(nativePtr); - if (bytes == null) { - return null; - } - return new String(bytes, StandardCharsets.UTF_8); - } - public static String nativeReadString16(long nativePtr) { - return nativeReadString8(nativePtr); - } - - /** Native method substitution */ - public static byte[] nativeMarshall(long nativePtr) { - var p = getInstance(nativePtr); - return Arrays.copyOf(p.mBuffer, p.mSize); - } - - /** Native method substitution */ - public static void nativeUnmarshall( - long nativePtr, byte[] data, int offset, int length) { - var p = getInstance(nativePtr); - p.ensureMoreCapacity(length); - System.arraycopy(data, offset, p.mBuffer, p.mPos, length); - p.mPos += length; - p.updateSize(); - } - - /** Native method substitution */ - public static int nativeCompareData(long thisNativePtr, long otherNativePtr) { - var a = getInstance(thisNativePtr); - var b = getInstance(otherNativePtr); - if ((a.mSize == b.mSize) && Arrays.equals(a.mBuffer, b.mBuffer)) { - return 0; - } else { - return -1; - } - } - - /** Native method substitution */ - public static boolean nativeCompareDataInRange( - long ptrA, int offsetA, long ptrB, int offsetB, int length) { - var a = getInstance(ptrA); - var b = getInstance(ptrB); - if (offsetA < 0 || offsetA + length > a.mSize) { - throw new IllegalArgumentException(); - } - if (offsetB < 0 || offsetB + length > b.mSize) { - throw new IllegalArgumentException(); - } - return Arrays.equals(Arrays.copyOfRange(a.mBuffer, offsetA, offsetA + length), - Arrays.copyOfRange(b.mBuffer, offsetB, offsetB + length)); - } - - /** Native method substitution */ - public static void nativeAppendFrom( - long thisNativePtr, long otherNativePtr, int srcOffset, int length) { - var dst = getInstance(thisNativePtr); - var src = getInstance(otherNativePtr); - - dst.ensureMoreCapacity(length); - - System.arraycopy(src.mBuffer, srcOffset, dst.mBuffer, dst.mPos, length); - dst.mPos += length; // TODO: 4 byte align? - dst.updateSize(); - - // TODO: Update the other's position? - } - - /** Native method substitution */ - public static boolean nativeHasBinders(long nativePtr) { - // Assume false for now, because we don't support adding binders. - return false; - } - - /** Native method substitution */ - public static boolean nativeHasBindersInRange( - long nativePtr, int offset, int length) { - // Assume false for now, because we don't support writing FDs yet. - return false; - } - - /** Native method substitution */ - public static void nativeWriteFileDescriptor(long nativePtr, java.io.FileDescriptor val) { - var p = getInstance(nativePtr); - - if (!p.mAllowFds) { - // Simulate the FDS_NOT_ALLOWED case in frameworks/base/core/jni/android_util_Binder.cpp - throw new RuntimeException("Not allowed to write file descriptors here"); - } - - FileDescriptor dup = null; - try { - dup = Os.dup(val); - } catch (ErrnoException e) { - throw new RuntimeException(e); - } - p.mFdMap.put(p.mPos, dup); - - // Parcel.cpp writes two int32s for a FD. - // Make sure FD_PAYLOAD_SIZE is in sync with this code. - nativeWriteInt(nativePtr, FD_PLACEHOLDER); - nativeWriteInt(nativePtr, FD_PLACEHOLDER); - } - - /** Native method substitution */ - public static java.io.FileDescriptor nativeReadFileDescriptor(long nativePtr) { - var p = getInstance(nativePtr); - - var pos = p.mPos; - var fd = p.mFdMap.get(pos); - - if (fd == null) { - Log.w(TAG, "nativeReadFileDescriptor: Not a FD at pos #" + pos); - return null; - } - nativeReadInt(nativePtr); - nativeReadInt(nativePtr); - return fd; - } - - /** Native method substitution */ - public static boolean nativeHasFileDescriptors(long nativePtr) { - var p = getInstance(nativePtr); - return p.mFdMap.size() > 0; - } - - /** Native method substitution */ - public static boolean nativeHasFileDescriptorsInRange(long nativePtr, int offset, int length) { - var p = getInstance(nativePtr); - - // Original code: hasFileDescriptorsInRange() in frameworks/native/libs/binder/Parcel.cpp - if (offset < 0 || length < 0) { - throw new IllegalArgumentException("Negative value not allowed: offset=" + offset - + " length=" + length); - } - long limit = (long) offset + (long) length; - if (limit > p.mSize) { - throw new IllegalArgumentException("Out of range: offset=" + offset - + " length=" + length + " dataSize=" + p.mSize); - } - - for (var pos : p.mFdMap.keySet()) { - if (offset <= pos && (pos + FD_PAYLOAD_SIZE - 1) < (offset + length)) { - return true; - } - } - return false; - } -} diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java index c519204d0586..97e99e50ea75 100644 --- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java +++ b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java @@ -172,6 +172,7 @@ public class ClassLoadHook { private static final Class[] sLibandroidClasses = { android.util.Log.class, android.os.Parcel.class, + android.os.Binder.class, android.content.res.ApkAssets.class, android.content.res.AssetManager.class, android.content.res.StringBlock.class, -- GitLab From 0d206610fa394037a958be5052d372a035d5c840 Mon Sep 17 00:00:00 2001 From: TYM Tsai Date: Fri, 23 Aug 2024 00:51:11 +0800 Subject: [PATCH 078/492] Code refactoring: Move doRename out of preparePackageLI Bug: 321139675 Flag: EXEMPT Code refactoring Test: atest CtsInstallHostTestCases Test: atest CtsCompilationTestCases Change-Id: I30b73f637ce5b2e610bfa588b2394f11d9668f3e --- .../internal/pm/parsing/pkg/PackageImpl.java | 1 + .../server/pm/InstallPackageHelper.java | 87 ++++++++++++------- 2 files changed, 59 insertions(+), 29 deletions(-) diff --git a/core/java/com/android/internal/pm/parsing/pkg/PackageImpl.java b/core/java/com/android/internal/pm/parsing/pkg/PackageImpl.java index 12d326486e77..032ac4283712 100644 --- a/core/java/com/android/internal/pm/parsing/pkg/PackageImpl.java +++ b/core/java/com/android/internal/pm/parsing/pkg/PackageImpl.java @@ -3025,6 +3025,7 @@ public class PackageImpl implements ParsedPackage, AndroidPackageInternal, @Override public PackageImpl setSplitCodePaths(@Nullable String[] splitCodePaths) { this.splitCodePaths = splitCodePaths; + this.mSplits = null; // reset for paths changed if (splitCodePaths != null) { int size = splitCodePaths.length; for (int index = 0; index < size; index++) { diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java index 43a285cba4b9..2c3f6ea3d9f7 100644 --- a/services/core/java/com/android/server/pm/InstallPackageHelper.java +++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java @@ -1019,7 +1019,9 @@ final class InstallPackageHelper { && scanInstallPackages(requests, createdAppId, versionInfos)) { List reconciledPackages = reconcileInstallPackages(requests, versionInfos); - if (reconciledPackages != null && commitInstallPackages(reconciledPackages)) { + if (reconciledPackages != null + && renameAndUpdatePaths(requests) + && commitInstallPackages(reconciledPackages)) { success = true; } } @@ -1029,24 +1031,49 @@ final class InstallPackageHelper { } } - private boolean prepareInstallPackages(List requests) { - // TODO: will remove the locking after doRename is moved out of prepare + private boolean renameAndUpdatePaths(List requests) { try (PackageManagerTracedLock installLock = mPm.mInstallLock.acquireLock()) { for (InstallRequest request : requests) { + ParsedPackage parsedPackage = request.getParsedPackage(); + final boolean isApex = (request.getScanFlags() & SCAN_AS_APEX) != 0; + if (isApex) { + continue; + } try { - Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "preparePackage"); - request.onPrepareStarted(); - preparePackageLI(request); - } catch (PrepareFailure prepareFailure) { - request.setError(prepareFailure.error, - prepareFailure.getMessage()); - request.setOriginPackage(prepareFailure.mConflictingPackage); - request.setOriginPermission(prepareFailure.mConflictingPermission); + doRenameLI(request, parsedPackage); + setUpFsVerity(parsedPackage); + } catch (Installer.InstallerException | IOException | DigestException + | NoSuchAlgorithmException | PrepareFailure e) { + request.setError(PackageManagerException.INTERNAL_ERROR_VERITY_SETUP, + "Failed to set up verity: " + e); return false; - } finally { - request.onPrepareFinished(); - Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } + + // update paths that are set before renaming + PackageSetting scannedPackageSetting = request.getScannedPackageSetting(); + scannedPackageSetting.setPath(new File(parsedPackage.getPath())); + scannedPackageSetting.setLegacyNativeLibraryPath( + parsedPackage.getNativeLibraryRootDir()); + } + return true; + } + } + + private boolean prepareInstallPackages(List requests) { + for (InstallRequest request : requests) { + try { + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "preparePackage"); + request.onPrepareStarted(); + preparePackage(request); + } catch (PrepareFailure prepareFailure) { + request.setError(prepareFailure.error, + prepareFailure.getMessage()); + request.setOriginPackage(prepareFailure.mConflictingPackage); + request.setOriginPermission(prepareFailure.mConflictingPermission); + return false; + } finally { + request.onPrepareFinished(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } } return true; @@ -1231,8 +1258,7 @@ final class InstallPackageHelper { return newProp != null && newProp.getBoolean(); } - @GuardedBy("mPm.mInstallLock") - private void preparePackageLI(InstallRequest request) throws PrepareFailure { + private void preparePackage(InstallRequest request) throws PrepareFailure { final int[] allUsers = mPm.mUserManager.getUserIds(); final int installFlags = request.getInstallFlags(); final boolean onExternal = request.getVolumeUuid() != null; @@ -1739,18 +1765,7 @@ final class InstallPackageHelper { } } - if (!isApex) { - doRenameLI(request, parsedPackage); - - try { - setUpFsVerity(parsedPackage); - } catch (Installer.InstallerException | IOException | DigestException - | NoSuchAlgorithmException e) { - throw PrepareFailure.ofInternalError( - "Failed to set up verity: " + e, - PackageManagerException.INTERNAL_ERROR_VERITY_SETUP); - } - } else { + if (isApex) { // Use the path returned by apexd parsedPackage.setPath(request.getApexInfo().modulePath); parsedPackage.setBaseApkPath(request.getApexInfo().modulePath); @@ -2086,7 +2101,21 @@ final class InstallPackageHelper { // Reflect the rename in scanned details try { - parsedPackage.setPath(afterCodeFile.getCanonicalPath()); + String afterCanonicalPath = afterCodeFile.getCanonicalPath(); + String beforeCanonicalPath = beforeCodeFile.getCanonicalPath(); + parsedPackage.setPath(afterCanonicalPath); + + parsedPackage.setNativeLibraryDir( + parsedPackage.getNativeLibraryDir() + .replace(beforeCanonicalPath, afterCanonicalPath)); + parsedPackage.setNativeLibraryRootDir( + parsedPackage.getNativeLibraryRootDir() + .replace(beforeCanonicalPath, afterCanonicalPath)); + String secondaryNativeLibraryDir = parsedPackage.getSecondaryNativeLibraryDir(); + if (secondaryNativeLibraryDir != null) { + parsedPackage.setSecondaryNativeLibraryDir( + secondaryNativeLibraryDir.replace(beforeCanonicalPath, afterCanonicalPath)); + } } catch (IOException e) { Slog.e(TAG, "Failed to get path: " + afterCodeFile, e); throw new PrepareFailure(PackageManager.INSTALL_FAILED_MEDIA_UNAVAILABLE, -- GitLab From f19b45e12f397576d961f03bf0de013e5127ce1f Mon Sep 17 00:00:00 2001 From: Aeric Date: Mon, 2 Sep 2024 15:19:30 +0800 Subject: [PATCH 079/492] AuthService registerFaceSensor for hidl should only focus on face hidlConfigStrings registerFaceSensor will register for FaceUnclok HIDL and AIDL, and in the begining setup FaceSensorConfigurations, it will mistake parser all the hidlConfigStrings. And that will cause some buggy if device implement with fingerprint HIDL and FaceUnlock AIDL, the FaceUnlock AIDL will be treated as HIDL. Bug: 363894516 Test: Manual see the log of AuthService when booting. Change-Id: I48ba228a258e56fb9db92dadb33339f52183242a --- .../server/biometrics/AuthService.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java index 2a1687209aad..de8aa2d6c246 100644 --- a/services/core/java/com/android/server/biometrics/AuthService.java +++ b/services/core/java/com/android/server/biometrics/AuthService.java @@ -850,10 +850,28 @@ public class AuthService extends SystemService { return; } + boolean tempResetLockoutRequiresChallenge = false; + + if (hidlConfigStrings != null && hidlConfigStrings.length > 0) { + for (String configString : hidlConfigStrings) { + try { + SensorConfig sensor = new SensorConfig(configString); + switch (sensor.modality) { + case BiometricAuthenticator.TYPE_FACE: + tempResetLockoutRequiresChallenge = true; + break; + } + } catch (Exception e) { + Slog.e(TAG, "Error parsing configString: " + configString, e); + } + } + } + + final boolean resetLockoutRequiresChallenge = tempResetLockoutRequiresChallenge; + handlerProvider.getFaceHandler().post(() -> { final FaceSensorConfigurations mFaceSensorConfigurations = - new FaceSensorConfigurations(hidlConfigStrings != null - && hidlConfigStrings.length > 0); + new FaceSensorConfigurations(resetLockoutRequiresChallenge); if (hidlConfigStrings != null && hidlConfigStrings.length > 0) { mFaceSensorConfigurations.addHidlConfigs(hidlConfigStrings, context); -- GitLab From aa9151e38631694ea04bf73ad6077df84d56e82e Mon Sep 17 00:00:00 2001 From: Sanath Kumar Date: Thu, 29 Aug 2024 23:16:03 -0500 Subject: [PATCH 080/492] JobScheduler: Add evaluation patch for detecting and logging empty jobs This patch implements a low-risk evaluation to detect and log empty jobs via tracing within the job scheduler service. It uses a new hidden API in IJobCallback.aidl. The atrace trace, combined with ScheduledJobStateChanged, will help analyze empty job characteristics. Bug: 349688611 Flag: android.app.job.cleanup_empty_jobs Test: Existing CTS and unit tests pass. Ran a test JobScheduler app and checked the perfetto trace for empty jobs Change-Id: I3261bd14be7f62be664a31a4dfb9baf044c33957 --- .../framework/aconfig/job.aconfig | 7 + .../java/android/app/job/IJobCallback.aidl | 8 + .../java/android/app/job/JobParameters.java | 123 ++++++++++++++ .../android/app/job/JobServiceEngine.java | 9 ++ .../android/server/job/JobServiceContext.java | 36 +++++ .../android/server/job/JobParametersTest.java | 153 ++++++++++++++++++ 6 files changed, 336 insertions(+) create mode 100644 services/tests/mockingservicestests/src/com/android/server/job/JobParametersTest.java diff --git a/apex/jobscheduler/framework/aconfig/job.aconfig b/apex/jobscheduler/framework/aconfig/job.aconfig index 80db264d0f44..5f5507587f72 100644 --- a/apex/jobscheduler/framework/aconfig/job.aconfig +++ b/apex/jobscheduler/framework/aconfig/job.aconfig @@ -23,3 +23,10 @@ flag { description: "Introduce a new RUN_BACKUP_JOBS permission and exemption logic allowing for longer running jobs for apps whose primary purpose is to backup or sync content." bug: "318731461" } + +flag { + name: "cleanup_empty_jobs" + namespace: "backstage_power" + description: "Enables automatic cancellation of jobs due to leaked JobParameters, reducing unnecessary battery drain and improving system efficiency. This includes logging and traces for better issue diagnosis." + bug: "349688611" +} diff --git a/apex/jobscheduler/framework/java/android/app/job/IJobCallback.aidl b/apex/jobscheduler/framework/java/android/app/job/IJobCallback.aidl index 96494ec28204..11d17ca749b7 100644 --- a/apex/jobscheduler/framework/java/android/app/job/IJobCallback.aidl +++ b/apex/jobscheduler/framework/java/android/app/job/IJobCallback.aidl @@ -85,6 +85,14 @@ interface IJobCallback { */ @UnsupportedAppUsage void jobFinished(int jobId, boolean reschedule); + + /* + * Inform JobScheduler to force finish this job because the client has lost + * the job handle. jobFinished can no longer be called from the client. + * @param jobId Unique integer used to identify this job + */ + void forceJobFinished(int jobId); + /* * Inform JobScheduler of a change in the estimated transfer payload. * diff --git a/apex/jobscheduler/framework/java/android/app/job/JobParameters.java b/apex/jobscheduler/framework/java/android/app/job/JobParameters.java index e833bb95a302..52a761f8d486 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobParameters.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobParameters.java @@ -34,15 +34,21 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; import android.os.RemoteException; +import android.system.SystemCleaner; +import android.util.Log; + +import com.android.internal.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.ref.Cleaner; /** * Contains the parameters used to configure/identify your job. You do not create this object * yourself, instead it is handed in to your application by the System. */ public class JobParameters implements Parcelable { + private static final String TAG = "JobParameters"; /** @hide */ public static final int INTERNAL_STOP_REASON_UNKNOWN = -1; @@ -306,6 +312,10 @@ public class JobParameters implements Parcelable { private int mStopReason = STOP_REASON_UNDEFINED; private int mInternalStopReason = INTERNAL_STOP_REASON_UNKNOWN; private String debugStopReason; // Human readable stop reason for debugging. + @Nullable + private JobCleanupCallback mJobCleanupCallback; + @Nullable + private Cleaner.Cleanable mCleanable; /** @hide */ public JobParameters(IBinder callback, String namespace, int jobId, PersistableBundle extras, @@ -326,6 +336,8 @@ public class JobParameters implements Parcelable { this.mTriggeredContentAuthorities = triggeredContentAuthorities; this.mNetwork = network; this.mJobNamespace = namespace; + this.mJobCleanupCallback = null; + this.mCleanable = null; } /** @@ -597,6 +609,8 @@ public class JobParameters implements Parcelable { mStopReason = in.readInt(); mInternalStopReason = in.readInt(); debugStopReason = in.readString(); + mJobCleanupCallback = null; + mCleanable = null; } /** @hide */ @@ -612,6 +626,54 @@ public class JobParameters implements Parcelable { this.debugStopReason = debugStopReason; } + /** @hide */ + public void initCleaner(JobCleanupCallback jobCleanupCallback) { + mJobCleanupCallback = jobCleanupCallback; + mCleanable = SystemCleaner.cleaner().register(this, mJobCleanupCallback); + } + + /** + * Lazy initialize the cleaner and enable it + * + * @hide + */ + public void enableCleaner() { + if (mJobCleanupCallback == null) { + initCleaner(new JobCleanupCallback(IJobCallback.Stub.asInterface(callback), jobId)); + } + mJobCleanupCallback.enableCleaner(); + } + + /** + * Disable the cleaner from running and unregister it + * + * @hide + */ + public void disableCleaner() { + if (mJobCleanupCallback != null) { + mJobCleanupCallback.disableCleaner(); + if (mCleanable != null) { + mCleanable.clean(); + mCleanable = null; + } + mJobCleanupCallback = null; + } + } + + /** @hide */ + @VisibleForTesting + @Nullable + public Cleaner.Cleanable getCleanable() { + return mCleanable; + } + + /** @hide */ + @VisibleForTesting + @Nullable + public JobCleanupCallback getJobCleanupCallback() { + return mJobCleanupCallback; + } + @Override public int describeContents() { return 0; @@ -647,6 +709,67 @@ public class JobParameters implements Parcelable { dest.writeString(debugStopReason); } + /** + * JobCleanupCallback is used track JobParameters leak. If the job is started + * and jobFinish is not called at the time of garbage collection of JobParameters + * instance, it is considered a job leak. Force finish the job. + * + * @hide + */ + public static class JobCleanupCallback implements Runnable { + private final IJobCallback mCallback; + private final int mJobId; + private boolean mIsCleanerEnabled; + + public JobCleanupCallback( + IJobCallback callback, + int jobId) { + mCallback = callback; + mJobId = jobId; + mIsCleanerEnabled = false; + } + + /** + * Check if the cleaner is enabled + * + * @hide + */ + public boolean isCleanerEnabled() { + return mIsCleanerEnabled; + } + + /** + * Enable the cleaner to detect JobParameter leak + * + * @hide + */ + public void enableCleaner() { + mIsCleanerEnabled = true; + } + + /** + * Disable the cleaner from running. + * + * @hide + */ + public void disableCleaner() { + mIsCleanerEnabled = false; + } + + /** @hide */ + @Override + public void run() { + if (!isCleanerEnabled()) { + return; + } + try { + mCallback.forceJobFinished(mJobId); + } catch (Exception e) { + Log.wtf(TAG, "Could not destroy running job", e); + } + } + } + public static final @android.annotation.NonNull Creator CREATOR = new Creator() { @Override public JobParameters createFromParcel(Parcel in) { diff --git a/apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java b/apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java index 79d87edff9b2..5f80c52388b4 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java @@ -165,7 +165,13 @@ public abstract class JobServiceEngine { case MSG_EXECUTE_JOB: { final JobParameters params = (JobParameters) msg.obj; try { + if (Flags.cleanupEmptyJobs()) { + params.enableCleaner(); + } boolean workOngoing = JobServiceEngine.this.onStartJob(params); + if (Flags.cleanupEmptyJobs() && !workOngoing) { + params.disableCleaner(); + } ackStartMessage(params, workOngoing); } catch (Exception e) { Log.e(TAG, "Error while executing job: " + params.getJobId()); @@ -190,6 +196,9 @@ public abstract class JobServiceEngine { IJobCallback callback = params.getCallback(); if (callback != null) { try { + if (Flags.cleanupEmptyJobs()) { + params.disableCleaner(); + } callback.jobFinished(params.getJobId(), needsReschedule); } catch (RemoteException e) { Log.e(TAG, "Error reporting job finish to system: binder has gone" + diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java index be8e304a8101..ee246d84997f 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java @@ -129,6 +129,8 @@ public final class JobServiceContext implements ServiceConnection { private static final String[] VERB_STRINGS = { "VERB_BINDING", "VERB_STARTING", "VERB_EXECUTING", "VERB_STOPPING", "VERB_FINISHED" }; + private static final String TRACE_JOB_FORCE_FINISHED_PREFIX = "forceJobFinished:"; + private static final String TRACE_JOB_FORCE_FINISHED_DELIMITER = "#"; // States that a job occupies while interacting with the client. static final int VERB_BINDING = 0; @@ -291,6 +293,11 @@ public final class JobServiceContext implements ServiceConnection { doJobFinished(this, jobId, reschedule); } + @Override + public void forceJobFinished(int jobId) { + doForceJobFinished(this, jobId); + } + @Override public void updateEstimatedNetworkBytes(int jobId, JobWorkItem item, long downloadBytes, long uploadBytes) { @@ -762,6 +769,35 @@ public final class JobServiceContext implements ServiceConnection { } } + /** + * This method just adds traces to evaluate jobs that leak jobparameters at the client. + * It does not stop the job. + */ + void doForceJobFinished(JobCallback cb, int jobId) { + final long ident = Binder.clearCallingIdentity(); + try { + final JobStatus executing; + synchronized (mLock) { + // not the current job, presumably it has finished in some way already + if (!verifyCallerLocked(cb)) { + return; + } + + executing = getRunningJobLocked(); + } + if (executing != null && jobId == executing.getJobId()) { + final StringBuilder stateSuffix = new StringBuilder(); + stateSuffix.append(TRACE_JOB_FORCE_FINISHED_PREFIX); + stateSuffix.append(executing.getBatteryName()); + stateSuffix.append(TRACE_JOB_FORCE_FINISHED_DELIMITER); + stateSuffix.append(executing.getJobId()); + Trace.instant(Trace.TRACE_TAG_POWER, stateSuffix.toString()); + } + } finally { + Binder.restoreCallingIdentity(ident); + } + } + private void doAcknowledgeGetTransferredDownloadBytesMessage(JobCallback cb, int jobId, int workId, @BytesLong long transferredBytes) { // TODO(255393346): Make sure apps call this appropriately and monitor for abuse diff --git a/services/tests/mockingservicestests/src/com/android/server/job/JobParametersTest.java b/services/tests/mockingservicestests/src/com/android/server/job/JobParametersTest.java new file mode 100644 index 000000000000..c8e4f89aaee6 --- /dev/null +++ b/services/tests/mockingservicestests/src/com/android/server/job/JobParametersTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.job; + +import static android.app.job.Flags.FLAG_CLEANUP_EMPTY_JOBS; + +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + +import static com.google.common.truth.Truth.assertThat; + +import static org.mockito.ArgumentMatchers.any; + +import android.app.job.IJobCallback; +import android.app.job.JobParameters; +import android.net.Uri; +import android.os.Parcel; +import android.platform.test.annotations.RequiresFlagsEnabled; +import android.platform.test.flag.junit.CheckFlagsRule; +import android.platform.test.flag.junit.DeviceFlagsValueProvider; +import android.platform.test.flag.junit.SetFlagsRule; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoSession; +import org.mockito.quality.Strictness; + +public class JobParametersTest { + private static final String TAG = JobParametersTest.class.getSimpleName(); + private static final int TEST_JOB_ID_1 = 123; + private static final String TEST_NAMESPACE = "TEST_NAMESPACE"; + private static final String TEST_DEBUG_STOP_REASON = "TEST_DEBUG_STOP_REASON"; + @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + + @Rule + public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); + + private MockitoSession mMockingSession; + @Mock private Parcel mMockParcel; + @Mock private IJobCallback.Stub mMockJobCallbackStub; + + @Before + public void setUp() throws Exception { + mMockingSession = + mockitoSession().initMocks(this).strictness(Strictness.LENIENT).startMocking(); + } + + @After + public void tearDown() { + if (mMockingSession != null) { + mMockingSession.finishMocking(); + } + + when(mMockParcel.readInt()) + .thenReturn(TEST_JOB_ID_1) // Job ID + .thenReturn(0) // No clip data + .thenReturn(0) // No deadline expired + .thenReturn(0) // No network + .thenReturn(0) // No stop reason + .thenReturn(0); // Internal stop reason + when(mMockParcel.readString()) + .thenReturn(TEST_NAMESPACE) // Job namespace + .thenReturn(TEST_DEBUG_STOP_REASON); // Debug stop reason + when(mMockParcel.readPersistableBundle()).thenReturn(null); + when(mMockParcel.readBundle()).thenReturn(null); + when(mMockParcel.readStrongBinder()).thenReturn(mMockJobCallbackStub); + when(mMockParcel.readBoolean()) + .thenReturn(false) // expedited + .thenReturn(false); // user initiated + when(mMockParcel.createTypedArray(any())).thenReturn(new Uri[0]); + when(mMockParcel.createStringArray()).thenReturn(new String[0]); + } + + /** + * Test to verify that the JobParameters created using Non-Parcelable constructor has not + * cleaner attached + */ + @Test + public void testJobParametersNonParcelableConstructor_noCleaner() { + JobParameters jobParameters = + new JobParameters( + null, + TEST_NAMESPACE, + TEST_JOB_ID_1, + null, + null, + null, + 0, + false, + false, + false, + null, + null, + null); + + // Verify that cleaner is not registered + assertThat(jobParameters.getCleanable()).isNull(); + assertThat(jobParameters.getJobCleanupCallback()).isNull(); + } + + /** + * Test to verify that the JobParameters created using Parcelable constructor has not cleaner + * attached + */ + @Test + public void testJobParametersParcelableConstructor_noCleaner() { + JobParameters jobParameters = JobParameters.CREATOR.createFromParcel(mMockParcel); + + // Verify that cleaner is not registered + assertThat(jobParameters.getCleanable()).isNull(); + assertThat(jobParameters.getJobCleanupCallback()).isNull(); + } + + /** Test to verify that the JobParameters Cleaner is disabled */ + @RequiresFlagsEnabled(FLAG_CLEANUP_EMPTY_JOBS) + @Test + public void testCleanerWithLeakedJobCleanerDisabled_flagCleanupEmptyJobsEnabled() { + // Inject real JobCallbackCleanup + JobParameters jobParameters = JobParameters.CREATOR.createFromParcel(mMockParcel); + + // Enable the cleaner + jobParameters.enableCleaner(); + + // Verify the cleaner is enabled + assertThat(jobParameters.getCleanable()).isNotNull(); + assertThat(jobParameters.getJobCleanupCallback()).isNotNull(); + assertThat(jobParameters.getJobCleanupCallback().isCleanerEnabled()).isTrue(); + + // Disable the cleaner + jobParameters.disableCleaner(); + + // Verify the cleaner is disabled + assertThat(jobParameters.getCleanable()).isNull(); + assertThat(jobParameters.getJobCleanupCallback()).isNull(); + } +} -- GitLab From 8858f6b5608e22e2f08e8a3544b9eee04aa706f8 Mon Sep 17 00:00:00 2001 From: Varun Shah Date: Wed, 4 Sep 2024 18:38:31 +0000 Subject: [PATCH 081/492] Rate limit calls to AM.getMemoryInfo(). Apps do not need to call getMemoryInfo any more than 100 times per second. Rate limit this API - if apps want to consume information about their own memory usage, they can use the getMyMemoryState API instead. Flag: android.app.rate_limit_get_memory_info Bug: 364312431 Test: atest ActivityManagerTest Test: manually check logs for cache hits/misses Change-Id: If2494509d76e269b0ad75d8d73bc6848adab490b --- core/java/android/app/ActivityManager.java | 36 +++++++++++++++++++ .../java/android/app/activity_manager.aconfig | 11 ++++++ 2 files changed, 47 insertions(+) diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index b83be6b86d04..b4fb4803a2b9 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -88,6 +88,7 @@ import android.util.Size; import android.view.WindowInsetsController.Appearance; import android.window.TaskSnapshot; +import com.android.internal.annotations.GuardedBy; import com.android.internal.app.LocalePicker; import com.android.internal.app.procstats.ProcessStats; import com.android.internal.os.RoSystemProperties; @@ -238,6 +239,14 @@ public class ActivityManager { private static final RateLimitingCache> mErrorProcessesCache = new RateLimitingCache<>(10, 2); + /** Rate-Limiting cache that allows no more than 100 calls to the service per second. */ + @GuardedBy("mMemoryInfoCache") + private static final RateLimitingCache mMemoryInfoCache = + new RateLimitingCache<>(10); + /** Used to store cached results for rate-limited calls to getMemoryInfo(). */ + @GuardedBy("mMemoryInfoCache") + private static final MemoryInfo mRateLimitedMemInfo = new MemoryInfo(); + /** * Query handler for mGetCurrentUserIdCache - returns a cached value of the current foreground * user id if the backstage_power/android.app.cache_get_current_user_id flag is enabled. @@ -3510,6 +3519,19 @@ public class ActivityManager { foregroundAppThreshold = source.readLong(); } + /** @hide */ + public void copyTo(MemoryInfo other) { + other.advertisedMem = advertisedMem; + other.availMem = availMem; + other.totalMem = totalMem; + other.threshold = threshold; + other.lowMemory = lowMemory; + other.hiddenAppThreshold = hiddenAppThreshold; + other.secondaryServerThreshold = secondaryServerThreshold; + other.visibleAppThreshold = visibleAppThreshold; + other.foregroundAppThreshold = foregroundAppThreshold; + } + public static final @android.annotation.NonNull Creator CREATOR = new Creator() { public MemoryInfo createFromParcel(Parcel source) { @@ -3536,6 +3558,20 @@ public class ActivityManager { * manage its memory. */ public void getMemoryInfo(MemoryInfo outInfo) { + if (Flags.rateLimitGetMemoryInfo()) { + synchronized (mMemoryInfoCache) { + mMemoryInfoCache.get(() -> { + getMemoryInfoInternal(mRateLimitedMemInfo); + return mRateLimitedMemInfo; + }); + mRateLimitedMemInfo.copyTo(outInfo); + } + } else { + getMemoryInfoInternal(outInfo); + } + } + + private void getMemoryInfoInternal(MemoryInfo outInfo) { try { getService().getMemoryInfo(outInfo); } catch (RemoteException e) { diff --git a/core/java/android/app/activity_manager.aconfig b/core/java/android/app/activity_manager.aconfig index 4c97dbbb4d01..8f91158c499d 100644 --- a/core/java/android/app/activity_manager.aconfig +++ b/core/java/android/app/activity_manager.aconfig @@ -114,3 +114,14 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + namespace: "backstage_power" + name: "rate_limit_get_memory_info" + description: "Rate limit calls to getMemoryInfo using a cache" + is_fixed_read_only: true + bug: "364312431" + metadata { + purpose: PURPOSE_BUGFIX + } +} -- GitLab From bca640f6ef969ae460390ff7993181a988169a18 Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Sun, 8 Sep 2024 14:14:15 +0000 Subject: [PATCH 082/492] Introduce FutureGlobalSearchSession Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: I5517ca7dffea5b8a8e9925de7da9880ae247b8c8 --- .../appfunctions/FutureAppSearchSession.java | 66 ++++---- .../FutureGlobalSearchSession.java | 94 ++++++++++++ .../appfunctions/RemoteServiceCaller.java | 1 - .../appfunctions/RemoteServiceCallerImpl.java | 1 - .../FutureAppSearchSessionTest.kt | 2 +- .../FutureGlobalSearchSessionTest.kt | 141 ++++++++++++++++++ 6 files changed, 266 insertions(+), 39 deletions(-) create mode 100644 services/appfunctions/java/com/android/server/appfunctions/FutureGlobalSearchSession.java create mode 100644 services/tests/appfunctions/src/com/android/server/appfunctions/FutureGlobalSearchSessionTest.kt diff --git a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java index eba628dc1fba..03dd5dd62e51 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java +++ b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java @@ -16,9 +16,6 @@ package com.android.server.appfunctions; -import static android.app.appfunctions.flags.Flags.FLAG_ENABLE_APP_FUNCTION_MANAGER; - -import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.app.appsearch.AppSearchBatchResult; import android.app.appsearch.AppSearchManager; @@ -42,10 +39,7 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.Executor; -/** - * A future API wrapper of {@link AppSearchSession} APIs. - */ -@FlaggedApi(FLAG_ENABLE_APP_FUNCTION_MANAGER) +/** A future API wrapper of {@link AppSearchSession} APIs. */ public class FutureAppSearchSession implements Closeable { private static final String TAG = FutureAppSearchSession.class.getSimpleName(); private final Executor mExecutor; @@ -67,14 +61,14 @@ public class FutureAppSearchSession implements Closeable { /** Converts a failed app search result codes into an exception. */ @NonNull - private static Exception failedResultToException(@NonNull AppSearchResult appSearchResult) { + public static Exception failedResultToException(@NonNull AppSearchResult appSearchResult) { return switch (appSearchResult.getResultCode()) { - case AppSearchResult.RESULT_INVALID_ARGUMENT -> new IllegalArgumentException( - appSearchResult.getErrorMessage()); - case AppSearchResult.RESULT_IO_ERROR -> new IOException( - appSearchResult.getErrorMessage()); - case AppSearchResult.RESULT_SECURITY_ERROR -> new SecurityException( - appSearchResult.getErrorMessage()); + case AppSearchResult.RESULT_INVALID_ARGUMENT -> + new IllegalArgumentException(appSearchResult.getErrorMessage()); + case AppSearchResult.RESULT_IO_ERROR -> + new IOException(appSearchResult.getErrorMessage()); + case AppSearchResult.RESULT_SECURITY_ERROR -> + new SecurityException(appSearchResult.getErrorMessage()); default -> new IllegalStateException(appSearchResult.getErrorMessage()); }; } @@ -137,14 +131,16 @@ public class FutureAppSearchSession implements Closeable { /** Indexes documents into the AppSearchSession database. */ public AndroidFuture> put( @NonNull PutDocumentsRequest putDocumentsRequest) { - return getSessionAsync().thenCompose( - session -> { - AndroidFuture> batchResultFuture = - new AndroidFuture<>(); + return getSessionAsync() + .thenCompose( + session -> { + AndroidFuture> batchResultFuture = + new AndroidFuture<>(); - session.put(putDocumentsRequest, mExecutor, batchResultFuture::complete); - return batchResultFuture; - }); + session.put( + putDocumentsRequest, mExecutor, batchResultFuture::complete); + return batchResultFuture; + }); } /** @@ -152,10 +148,9 @@ public class FutureAppSearchSession implements Closeable { * of search provided. */ public AndroidFuture search( - @NonNull String queryExpression, - @NonNull SearchSpec searchSpec) { - return getSessionAsync().thenApply( - session -> session.search(queryExpression, searchSpec)) + @NonNull String queryExpression, @NonNull SearchSpec searchSpec) { + return getSessionAsync() + .thenApply(session -> session.search(queryExpression, searchSpec)) .thenApply(result -> new FutureSearchResults(result, mExecutor)); } @@ -173,8 +168,8 @@ public class FutureAppSearchSession implements Closeable { private final SearchResults mSearchResults; private final Executor mExecutor; - public FutureSearchResults(@NonNull SearchResults searchResults, - @NonNull Executor executor) { + public FutureSearchResults( + @NonNull SearchResults searchResults, @NonNull Executor executor) { mSearchResults = Objects.requireNonNull(searchResults); mExecutor = Objects.requireNonNull(executor); } @@ -184,15 +179,14 @@ public class FutureAppSearchSession implements Closeable { new AndroidFuture<>(); mSearchResults.getNextPage(mExecutor, nextPageFuture::complete); - return nextPageFuture.thenApply(result -> { - if (result.isSuccess()) { - return result.getResultValue(); - } else { - throw new RuntimeException( - failedResultToException(result)); - } - }); + return nextPageFuture.thenApply( + result -> { + if (result.isSuccess()) { + return result.getResultValue(); + } else { + throw new RuntimeException(failedResultToException(result)); + } + }); } - } } diff --git a/services/appfunctions/java/com/android/server/appfunctions/FutureGlobalSearchSession.java b/services/appfunctions/java/com/android/server/appfunctions/FutureGlobalSearchSession.java new file mode 100644 index 000000000000..0c2262456032 --- /dev/null +++ b/services/appfunctions/java/com/android/server/appfunctions/FutureGlobalSearchSession.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.appfunctions; + +import android.annotation.NonNull; +import android.app.appsearch.AppSearchManager; +import android.app.appsearch.AppSearchResult; +import android.app.appsearch.GlobalSearchSession; +import android.app.appsearch.exceptions.AppSearchException; +import android.app.appsearch.observer.ObserverCallback; +import android.app.appsearch.observer.ObserverSpec; +import android.util.Slog; + +import com.android.internal.infra.AndroidFuture; + +import java.io.Closeable; +import java.io.IOException; +import java.util.concurrent.Executor; + +/** A wrapper around {@link GlobalSearchSession} that provides a future-based API. */ +public class FutureGlobalSearchSession implements Closeable { + private static final String TAG = FutureGlobalSearchSession.class.getSimpleName(); + private final Executor mExecutor; + private final AndroidFuture> mSettableSessionFuture; + + public FutureGlobalSearchSession( + @NonNull AppSearchManager appSearchManager, @NonNull Executor executor) { + this.mExecutor = executor; + mSettableSessionFuture = new AndroidFuture<>(); + appSearchManager.createGlobalSearchSession(mExecutor, mSettableSessionFuture::complete); + } + + private AndroidFuture getSessionAsync() { + return mSettableSessionFuture.thenApply( + result -> { + if (result.isSuccess()) { + return result.getResultValue(); + } else { + throw new RuntimeException( + FutureAppSearchSession.failedResultToException(result)); + } + }); + } + + /** + * Registers an observer callback for the given target package name. + * + * @param targetPackageName The package name of the target app. + * @param spec The observer spec. + * @param executor The executor to run the observer callback on. + * @param observer The observer callback to register. + * @return A future that completes once the observer is registered. + */ + public AndroidFuture registerObserverCallbackAsync( + String targetPackageName, + ObserverSpec spec, + Executor executor, + ObserverCallback observer) { + return getSessionAsync() + .thenCompose( + session -> { + try { + session.registerObserverCallback( + targetPackageName, spec, executor, observer); + return AndroidFuture.completedFuture(null); + } catch (AppSearchException e) { + throw new RuntimeException(e); + } + }); + } + + @Override + public void close() throws IOException { + try { + getSessionAsync().get().close(); + } catch (Exception ex) { + Slog.e(TAG, "Failed to close global search session", ex); + } + } +} diff --git a/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCaller.java b/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCaller.java index 98903ae57a39..58597c38bb94 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCaller.java +++ b/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCaller.java @@ -25,7 +25,6 @@ import android.os.UserHandle; * services are properly unbound after the operation completes or a timeout occurs. * * @param Class of wrapped service. - * @hide */ public interface RemoteServiceCaller { diff --git a/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCallerImpl.java b/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCallerImpl.java index 0e18705c40b0..eea17eeca371 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCallerImpl.java +++ b/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCallerImpl.java @@ -34,7 +34,6 @@ import java.util.function.Function; * Context#bindService}. * * @param Class of wrapped service. - * @hide */ public class RemoteServiceCallerImpl implements RemoteServiceCaller { private static final String TAG = "AppFunctionsServiceCall"; diff --git a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt index 5233f194d6c5..a323799e85e5 100644 --- a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt +++ b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt @@ -42,7 +42,7 @@ class FutureAppSearchSessionTest { fun clearData() { val searchContext = AppSearchManager.SearchContext.Builder(TEST_DB).build() FutureAppSearchSession(appSearchManager, testExecutor, searchContext).use { - val setSchemaRequest = SetSchemaRequest.Builder().build() + val setSchemaRequest = SetSchemaRequest.Builder().setForceOverride(true).build() it.setSchema(setSchemaRequest) } } diff --git a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureGlobalSearchSessionTest.kt b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureGlobalSearchSessionTest.kt new file mode 100644 index 000000000000..8817a66c734e --- /dev/null +++ b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureGlobalSearchSessionTest.kt @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.server.appfunctions + +import android.app.appfunctions.AppFunctionRuntimeMetadata +import android.app.appfunctions.AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema +import android.app.appfunctions.AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema +import android.app.appfunctions.AppFunctionStaticMetadataHelper +import android.app.appsearch.AppSearchManager +import android.app.appsearch.AppSearchManager.SearchContext +import android.app.appsearch.PutDocumentsRequest +import android.app.appsearch.SetSchemaRequest +import android.app.appsearch.observer.DocumentChangeInfo +import android.app.appsearch.observer.ObserverCallback +import android.app.appsearch.observer.ObserverSpec +import android.app.appsearch.observer.SchemaChangeInfo +import androidx.test.platform.app.InstrumentationRegistry +import com.android.internal.infra.AndroidFuture +import com.google.common.truth.Truth.assertThat +import com.google.common.util.concurrent.MoreExecutors +import org.junit.After +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(JUnit4::class) +class FutureGlobalSearchSessionTest { + private val context = InstrumentationRegistry.getInstrumentation().targetContext + private val appSearchManager = context.getSystemService(AppSearchManager::class.java) + private val testExecutor = MoreExecutors.directExecutor() + + @Before + @After + fun clearData() { + val searchContext = SearchContext.Builder(TEST_DB).build() + FutureAppSearchSession(appSearchManager, testExecutor, searchContext).use { + val setSchemaRequest = SetSchemaRequest.Builder().setForceOverride(true).build() + it.setSchema(setSchemaRequest) + } + } + + @Test + fun registerDocumentChangeObserverCallback() { + val baseObserverSpec: ObserverSpec = + ObserverSpec.Builder() + .addFilterSchemas(AppFunctionStaticMetadataHelper.STATIC_SCHEMA_TYPE) + .build() + val packageObserverSpec: ObserverSpec = + ObserverSpec.Builder() + .addFilterSchemas( + AppFunctionRuntimeMetadata.getRuntimeSchemaNameForPackage(TEST_TARGET_PKG_NAME) + ) + .build() + val settableDocumentChangeInfo: AndroidFuture = AndroidFuture() + val observer: ObserverCallback = + object : ObserverCallback { + override fun onSchemaChanged(changeInfo: SchemaChangeInfo) {} + + override fun onDocumentChanged(changeInfo: DocumentChangeInfo) { + settableDocumentChangeInfo.complete(changeInfo) + } + } + val futureGlobalSearchSession = FutureGlobalSearchSession(appSearchManager, testExecutor) + + val registerBaseObserver: Void? = + futureGlobalSearchSession + .registerObserverCallbackAsync( + TEST_TARGET_PKG_NAME, + baseObserverSpec, + testExecutor, + observer, + ) + .get() + val registerPackageObserver: Void? = + futureGlobalSearchSession + .registerObserverCallbackAsync( + TEST_TARGET_PKG_NAME, + packageObserverSpec, + testExecutor, + observer, + ) + .get() + + assertThat(registerBaseObserver).isNull() + assertThat(registerPackageObserver).isNull() + // Trigger document change + val searchContext = SearchContext.Builder(TEST_DB).build() + FutureAppSearchSession(appSearchManager, testExecutor, searchContext).use { session -> + val setSchemaRequest = + SetSchemaRequest.Builder() + .addSchemas( + createParentAppFunctionRuntimeSchema(), + createAppFunctionRuntimeSchema(TEST_TARGET_PKG_NAME), + ) + .build() + val schema = session.setSchema(setSchemaRequest) + assertThat(schema.get()).isNotNull() + val appFunctionRuntimeMetadata = + AppFunctionRuntimeMetadata.Builder(TEST_TARGET_PKG_NAME, TEST_FUNCTION_ID, "") + .build() + val putDocumentsRequest: PutDocumentsRequest = + PutDocumentsRequest.Builder() + .addGenericDocuments(appFunctionRuntimeMetadata) + .build() + val putResult = session.put(putDocumentsRequest).get() + assertThat(putResult.isSuccess).isTrue() + } + assertThat( + settableDocumentChangeInfo + .get() + .changedDocumentIds + .contains( + AppFunctionRuntimeMetadata.getDocumentIdForAppFunction( + TEST_TARGET_PKG_NAME, + TEST_FUNCTION_ID, + ) + ) + ) + .isTrue() + } + + private companion object { + const val TEST_DB: String = "test_db" + const val TEST_TARGET_PKG_NAME = "com.android.frameworks.appfunctionstests" + const val TEST_FUNCTION_ID: String = "print" + } +} -- GitLab From cf9f66d0fb84244ce50518f4d5d53d45d0037f5e Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Sun, 8 Sep 2024 20:49:23 +0000 Subject: [PATCH 083/492] Update OWNERS file for broadcasts related code. Test: n/a Flag: EXEMPT only changing OWNERS Change-Id: I40f9b7f7cbd271c59c15711f72017c6a9dc27ab2 --- BROADCASTS_OWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BROADCASTS_OWNERS b/BROADCASTS_OWNERS index 01f1f8a6ba57..f0cbe46ea402 100644 --- a/BROADCASTS_OWNERS +++ b/BROADCASTS_OWNERS @@ -1,5 +1,5 @@ # Bug component: 316181 -ctate@android.com -jsharkey@google.com +set noparent + sudheersai@google.com yamasani@google.com #{LAST_RESORT_SUGGESTION} -- GitLab From 8ceac2b3a7f30bfc2425e42c0ec3b52b2ecbe056 Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Sun, 8 Sep 2024 21:01:48 +0000 Subject: [PATCH 084/492] Update OWNERS file for blobstore related code. Test: n/a Flag: EXEMPT only changing OWNERS Change-Id: I5bbbb3fc9b84f0b7dbb5d9e5b27d1fe7e92d289e --- apex/blobstore/OWNERS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apex/blobstore/OWNERS b/apex/blobstore/OWNERS index a53bbeaa8601..676cbc7eb2a3 100644 --- a/apex/blobstore/OWNERS +++ b/apex/blobstore/OWNERS @@ -1,2 +1,5 @@ +# Bug component: 25692 +set noparent + sudheersai@google.com -yamasani@google.com +yamasani@google.com #{LAST_RESORT_SUGGESTION} -- GitLab From 6be8f5935bd9b7d3f4184bfa90f25a3693c4c8db Mon Sep 17 00:00:00 2001 From: Yuichiro Hanada Date: Tue, 20 Aug 2024 07:28:51 +0900 Subject: [PATCH 085/492] Add a custom transtion type, TRANSIT_MINIMIZE which is used for the minimize action by the minimize button on the caption bar in ADM Bug: 361524575 Test: manual - the minimize button works Flag: com.android.window.flags.enable_minimize_button Change-Id: I2d331f823d138eb9f092f222c620f3ab2759e89d --- .../FreeformTaskTransitionHandler.java | 21 +++++++++++++++---- .../wm/shell/transition/Transitions.java | 3 +++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskTransitionHandler.java index 1ffa54103d62..832e2d2bc77b 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskTransitionHandler.java @@ -118,7 +118,7 @@ public class FreeformTaskTransitionHandler @Override public IBinder startMinimizedModeTransition(WindowContainerTransaction wct) { - final int type = WindowManager.TRANSIT_TO_BACK; + final int type = Transitions.TRANSIT_MINIMIZE; final IBinder token = mTransitions.startTransition(type, wct, this); mPendingTransitionTokens.add(token); return token; @@ -161,7 +161,8 @@ public class FreeformTaskTransitionHandler transition, info.getType(), change); break; case WindowManager.TRANSIT_TO_BACK: - transitionHandled |= startMinimizeTransition(transition); + transitionHandled |= startMinimizeTransition( + transition, info.getType(), change); break; case WindowManager.TRANSIT_CLOSE: if (change.getTaskInfo().getWindowingMode() == WINDOWING_MODE_FREEFORM) { @@ -227,8 +228,20 @@ public class FreeformTaskTransitionHandler return handled; } - private boolean startMinimizeTransition(IBinder transition) { - return mPendingTransitionTokens.contains(transition); + private boolean startMinimizeTransition( + IBinder transition, + int type, + TransitionInfo.Change change) { + if (!mPendingTransitionTokens.contains(transition)) { + return false; + } + + final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo(); + if (type != Transitions.TRANSIT_MINIMIZE) { + return false; + } + // TODO(b/361524575): Add minimize animations + return true; } private boolean startCloseTransition(IBinder transition, TransitionInfo.Change change, diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index 7dc336bdfb7d..aba8b61af306 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -196,6 +196,9 @@ public class Transitions implements RemoteCallable, /** Transition to set windowing mode after exit pip transition is finished animating. */ public static final int TRANSIT_CLEANUP_PIP_EXIT = WindowManager.TRANSIT_FIRST_CUSTOM + 19; + /** Transition type to minimize a task. */ + public static final int TRANSIT_MINIMIZE = WindowManager.TRANSIT_FIRST_CUSTOM + 20; + /** Transition type for desktop mode transitions. */ public static final int TRANSIT_DESKTOP_MODE_TYPES = WindowManager.TRANSIT_FIRST_CUSTOM + 100; -- GitLab From 5f4912fedd9cc5ed65a78e18ab68cefa5e2ba6cf Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Thu, 5 Sep 2024 15:33:33 +0900 Subject: [PATCH 086/492] Remove deprecate_ui_fonts flag Bug: 279646685 Bug: 364533012 Flag: EXEMPT removing com.android.text.flags.deprecate_ui_fonts Test: N/A Change-Id: I2d050e6c36eb2e0d0d3d05ee9ceb63067ae66895 --- core/java/android/text/flags/flags.aconfig | 7 ------- graphics/java/android/graphics/Paint.java | 11 +---------- libs/hwui/FeatureFlags.h | 8 -------- libs/hwui/hwui/MinikinUtils.cpp | 4 +--- 4 files changed, 2 insertions(+), 28 deletions(-) diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index b2be1a7ef351..34b6c840dd6a 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -58,13 +58,6 @@ flag { bug: "63938206" } -flag { - name: "deprecate_ui_fonts" - namespace: "text" - description: "Feature flag for deprecating UI fonts. By setting true for this feature flag, the elegant text height of will be turned on by default unless explicitly setting it to false by attribute or Java API call." - bug: "279646685" -} - flag { name: "word_style_auto" is_exported: true diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index df95a91d72d7..b866382e4061 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -1805,16 +1805,7 @@ public class Paint { * @return true if elegant metrics are enabled for text drawing. */ public boolean isElegantTextHeight() { - int rawValue = nGetElegantTextHeight(mNativePaint); - switch (rawValue) { - case ELEGANT_TEXT_HEIGHT_DISABLED: - return false; - case ELEGANT_TEXT_HEIGHT_ENABLED: - return true; - case ELEGANT_TEXT_HEIGHT_UNSET: - default: - return com.android.text.flags.Flags.deprecateUiFonts(); - } + return nGetElegantTextHeight(mNativePaint) != ELEGANT_TEXT_HEIGHT_DISABLED; } // Note: the following three values must be equal to the ones in the JNI file: Paint.cpp diff --git a/libs/hwui/FeatureFlags.h b/libs/hwui/FeatureFlags.h index c0cedf12c0ae..fddcf29b9197 100644 --- a/libs/hwui/FeatureFlags.h +++ b/libs/hwui/FeatureFlags.h @@ -25,14 +25,6 @@ namespace android { namespace text_feature { -inline bool deprecate_ui_fonts() { -#ifdef __ANDROID__ - return com_android_text_flags_deprecate_ui_fonts(); -#else - return true; -#endif // __ANDROID__ -} - inline bool letter_spacing_justification() { #ifdef __ANDROID__ return com_android_text_flags_letter_spacing_justification(); diff --git a/libs/hwui/hwui/MinikinUtils.cpp b/libs/hwui/hwui/MinikinUtils.cpp index d66d7f8e83f4..ede385adc779 100644 --- a/libs/hwui/hwui/MinikinUtils.cpp +++ b/libs/hwui/hwui/MinikinUtils.cpp @@ -53,9 +53,7 @@ minikin::MinikinPaint MinikinUtils::prepareMinikinPaint(const Paint* paint, if (familyVariant.has_value()) { minikinPaint.familyVariant = familyVariant.value(); } else { - minikinPaint.familyVariant = text_feature::deprecate_ui_fonts() - ? minikin::FamilyVariant::ELEGANT - : minikin::FamilyVariant::DEFAULT; + minikinPaint.familyVariant = minikin::FamilyVariant::ELEGANT; } return minikinPaint; } -- GitLab From 0f5ca2aaab064fec140e93f3425fc87a9d940fa9 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Thu, 5 Sep 2024 15:57:37 +0900 Subject: [PATCH 087/492] Remove icu_bidi_migration flag Bug: 317144801 Bug: 364533012 Flag: EXEMPT removing com.android.text.flags.icu_bidi_migration Test: N/A Change-Id: Iae06df0055ea52bd0ad4145ce58d825bb7441b85 --- core/java/android/text/ClientFlags.java | 7 - core/java/android/text/MeasuredParagraph.java | 224 +++++++----------- core/java/android/text/TextFlags.java | 2 - core/java/android/text/flags/flags.aconfig | 7 - 4 files changed, 91 insertions(+), 149 deletions(-) diff --git a/core/java/android/text/ClientFlags.java b/core/java/android/text/ClientFlags.java index bbe9cdbbce9f..5f2823b7630f 100644 --- a/core/java/android/text/ClientFlags.java +++ b/core/java/android/text/ClientFlags.java @@ -41,13 +41,6 @@ public class ClientFlags { return TextFlags.isFeatureEnabled(Flags.FLAG_FIX_LINE_HEIGHT_FOR_LOCALE); } - /** - * @see Flags#icuBidiMigration() - */ - public static boolean icuBidiMigration() { - return TextFlags.isFeatureEnabled(Flags.FLAG_ICU_BIDI_MIGRATION); - } - /** * @see Flags#fixMisalignedContextMenu() */ diff --git a/core/java/android/text/MeasuredParagraph.java b/core/java/android/text/MeasuredParagraph.java index 896e08726419..31a226341907 100644 --- a/core/java/android/text/MeasuredParagraph.java +++ b/core/java/android/text/MeasuredParagraph.java @@ -42,8 +42,6 @@ import android.text.style.MetricAffectingSpan; import android.text.style.ReplacementSpan; import android.util.Pools.SynchronizedPool; -import com.android.text.flags.Flags; - import java.util.Arrays; /** @@ -201,14 +199,11 @@ public class MeasuredParagraph { * @hide */ public @Layout.Direction int getParagraphDir() { - if (Flags.icuBidiMigration()) { - if (mBidi == null) { - return Layout.DIR_LEFT_TO_RIGHT; - } - return (mBidi.getParaLevel() & 0x01) == 0 - ? Layout.DIR_LEFT_TO_RIGHT : Layout.DIR_RIGHT_TO_LEFT; + if (mBidi == null) { + return Layout.DIR_LEFT_TO_RIGHT; } - return mParaDir; + return (mBidi.getParaLevel() & 0x01) == 0 + ? Layout.DIR_LEFT_TO_RIGHT : Layout.DIR_RIGHT_TO_LEFT; } /** @@ -219,71 +214,62 @@ public class MeasuredParagraph { */ public Directions getDirections(@IntRange(from = 0) int start, // inclusive @IntRange(from = 0) int end) { // exclusive - if (Flags.icuBidiMigration()) { - // Easy case: mBidi == null means the text is all LTR and no bidi suppot is needed. - if (mBidi == null) { - return Layout.DIRS_ALL_LEFT_TO_RIGHT; - } + // Easy case: mBidi == null means the text is all LTR and no bidi suppot is needed. + if (mBidi == null) { + return Layout.DIRS_ALL_LEFT_TO_RIGHT; + } - // Easy case: If the original text only contains single directionality run, the - // substring is only single run. - if (start == end) { - if ((mBidi.getParaLevel() & 0x01) == 0) { - return Layout.DIRS_ALL_LEFT_TO_RIGHT; - } else { - return Layout.DIRS_ALL_RIGHT_TO_LEFT; - } + // Easy case: If the original text only contains single directionality run, the + // substring is only single run. + if (start == end) { + if ((mBidi.getParaLevel() & 0x01) == 0) { + return Layout.DIRS_ALL_LEFT_TO_RIGHT; + } else { + return Layout.DIRS_ALL_RIGHT_TO_LEFT; } + } - // Okay, now we need to generate the line instance. - Bidi bidi = mBidi.createLineBidi(start, end); - - // Easy case: If the line instance only contains single directionality run, no need - // to reorder visually. - if (bidi.getRunCount() == 1) { - if (bidi.getRunLevel(0) == 1) { - return Layout.DIRS_ALL_RIGHT_TO_LEFT; - } else if (bidi.getRunLevel(0) == 0) { - return Layout.DIRS_ALL_LEFT_TO_RIGHT; - } else { - return new Directions(new int[] { - 0, bidi.getRunLevel(0) << Layout.RUN_LEVEL_SHIFT | (end - start)}); - } - } + // Okay, now we need to generate the line instance. + Bidi bidi = mBidi.createLineBidi(start, end); - // Reorder directionality run visually. - byte[] levels = new byte[bidi.getRunCount()]; - for (int i = 0; i < bidi.getRunCount(); ++i) { - levels[i] = (byte) bidi.getRunLevel(i); + // Easy case: If the line instance only contains single directionality run, no need + // to reorder visually. + if (bidi.getRunCount() == 1) { + if (bidi.getRunLevel(0) == 1) { + return Layout.DIRS_ALL_RIGHT_TO_LEFT; + } else if (bidi.getRunLevel(0) == 0) { + return Layout.DIRS_ALL_LEFT_TO_RIGHT; + } else { + return new Directions(new int[] { + 0, bidi.getRunLevel(0) << Layout.RUN_LEVEL_SHIFT | (end - start)}); } - int[] visualOrders = Bidi.reorderVisual(levels); - - int[] dirs = new int[bidi.getRunCount() * 2]; - for (int i = 0; i < bidi.getRunCount(); ++i) { - int vIndex; - if ((mBidi.getBaseLevel() & 0x01) == 1) { - // For the historical reasons, if the base directionality is RTL, the Android - // draws from the right, i.e. the visually reordered run needs to be reversed. - vIndex = visualOrders[bidi.getRunCount() - i - 1]; - } else { - vIndex = visualOrders[i]; - } + } - // Special packing of dire - dirs[i * 2] = bidi.getRunStart(vIndex); - dirs[i * 2 + 1] = bidi.getRunLevel(vIndex) << Layout.RUN_LEVEL_SHIFT - | (bidi.getRunLimit(vIndex) - dirs[i * 2]); + // Reorder directionality run visually. + byte[] levels = new byte[bidi.getRunCount()]; + for (int i = 0; i < bidi.getRunCount(); ++i) { + levels[i] = (byte) bidi.getRunLevel(i); + } + int[] visualOrders = Bidi.reorderVisual(levels); + + int[] dirs = new int[bidi.getRunCount() * 2]; + for (int i = 0; i < bidi.getRunCount(); ++i) { + int vIndex; + if ((mBidi.getBaseLevel() & 0x01) == 1) { + // For the historical reasons, if the base directionality is RTL, the Android + // draws from the right, i.e. the visually reordered run needs to be reversed. + vIndex = visualOrders[bidi.getRunCount() - i - 1]; + } else { + vIndex = visualOrders[i]; } - return new Directions(dirs); - } - if (mLtrWithoutBidi) { - return Layout.DIRS_ALL_LEFT_TO_RIGHT; + // Special packing of dire + dirs[i * 2] = bidi.getRunStart(vIndex); + dirs[i * 2 + 1] = bidi.getRunLevel(vIndex) << Layout.RUN_LEVEL_SHIFT + | (bidi.getRunLimit(vIndex) - dirs[i * 2]); } - final int length = end - start; - return AndroidBidi.directions(mParaDir, mLevels.getRawArray(), start, mCopiedBuffer, start, - length); + return new Directions(dirs); } /** @@ -681,84 +667,56 @@ public class MeasuredParagraph { } } - if (Flags.icuBidiMigration()) { - if ((textDir == TextDirectionHeuristics.LTR - || textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR - || textDir == TextDirectionHeuristics.ANYRTL_LTR) - && TextUtils.doesNotNeedBidi(mCopiedBuffer, 0, mTextLength)) { - mLevels.clear(); - mLtrWithoutBidi = true; - return; - } - final int bidiRequest; - if (textDir == TextDirectionHeuristics.LTR) { - bidiRequest = Bidi.LTR; - } else if (textDir == TextDirectionHeuristics.RTL) { - bidiRequest = Bidi.RTL; - } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR) { - bidiRequest = Bidi.LEVEL_DEFAULT_LTR; - } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_RTL) { - bidiRequest = Bidi.LEVEL_DEFAULT_RTL; - } else { - final boolean isRtl = textDir.isRtl(mCopiedBuffer, 0, mTextLength); - bidiRequest = isRtl ? Bidi.RTL : Bidi.LTR; - } - mBidi = new Bidi(mCopiedBuffer, 0, null, 0, mCopiedBuffer.length, bidiRequest); - - if (mCopiedBuffer.length > 0 - && mBidi.getParagraphIndex(mCopiedBuffer.length - 1) != 0) { - // Historically, the MeasuredParagraph does not treat the CR letters as paragraph - // breaker but ICU BiDi treats it as paragraph breaker. In the MeasureParagraph, - // the given range always represents a single paragraph, so if the BiDi object has - // multiple paragraph, it should contains a CR letters in the text. Using CR is not - // common in Android and also it should not penalize the easy case, e.g. all LTR, - // check the paragraph count here and replace the CR letters and re-calculate - // BiDi again. - for (int i = 0; i < mTextLength; ++i) { - if (Character.isSurrogate(mCopiedBuffer[i])) { - // All block separators are in BMP. - continue; - } - if (UCharacter.getDirection(mCopiedBuffer[i]) - == UCharacterDirection.BLOCK_SEPARATOR) { - mCopiedBuffer[i] = OBJECT_REPLACEMENT_CHARACTER; - } - } - mBidi = new Bidi(mCopiedBuffer, 0, null, 0, mCopiedBuffer.length, bidiRequest); - } - mLevels.resize(mTextLength); - byte[] rawArray = mLevels.getRawArray(); - for (int i = 0; i < mTextLength; ++i) { - rawArray[i] = mBidi.getLevelAt(i); - } - mLtrWithoutBidi = false; - return; - } if ((textDir == TextDirectionHeuristics.LTR || textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR || textDir == TextDirectionHeuristics.ANYRTL_LTR) && TextUtils.doesNotNeedBidi(mCopiedBuffer, 0, mTextLength)) { mLevels.clear(); - mParaDir = Layout.DIR_LEFT_TO_RIGHT; mLtrWithoutBidi = true; + return; + } + final int bidiRequest; + if (textDir == TextDirectionHeuristics.LTR) { + bidiRequest = Bidi.LTR; + } else if (textDir == TextDirectionHeuristics.RTL) { + bidiRequest = Bidi.RTL; + } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR) { + bidiRequest = Bidi.LEVEL_DEFAULT_LTR; + } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_RTL) { + bidiRequest = Bidi.LEVEL_DEFAULT_RTL; } else { - final int bidiRequest; - if (textDir == TextDirectionHeuristics.LTR) { - bidiRequest = Layout.DIR_REQUEST_LTR; - } else if (textDir == TextDirectionHeuristics.RTL) { - bidiRequest = Layout.DIR_REQUEST_RTL; - } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR) { - bidiRequest = Layout.DIR_REQUEST_DEFAULT_LTR; - } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_RTL) { - bidiRequest = Layout.DIR_REQUEST_DEFAULT_RTL; - } else { - final boolean isRtl = textDir.isRtl(mCopiedBuffer, 0, mTextLength); - bidiRequest = isRtl ? Layout.DIR_REQUEST_RTL : Layout.DIR_REQUEST_LTR; + final boolean isRtl = textDir.isRtl(mCopiedBuffer, 0, mTextLength); + bidiRequest = isRtl ? Bidi.RTL : Bidi.LTR; + } + mBidi = new Bidi(mCopiedBuffer, 0, null, 0, mCopiedBuffer.length, bidiRequest); + + if (mCopiedBuffer.length > 0 + && mBidi.getParagraphIndex(mCopiedBuffer.length - 1) != 0) { + // Historically, the MeasuredParagraph does not treat the CR letters as paragraph + // breaker but ICU BiDi treats it as paragraph breaker. In the MeasureParagraph, + // the given range always represents a single paragraph, so if the BiDi object has + // multiple paragraph, it should contains a CR letters in the text. Using CR is not + // common in Android and also it should not penalize the easy case, e.g. all LTR, + // check the paragraph count here and replace the CR letters and re-calculate + // BiDi again. + for (int i = 0; i < mTextLength; ++i) { + if (Character.isSurrogate(mCopiedBuffer[i])) { + // All block separators are in BMP. + continue; + } + if (UCharacter.getDirection(mCopiedBuffer[i]) + == UCharacterDirection.BLOCK_SEPARATOR) { + mCopiedBuffer[i] = OBJECT_REPLACEMENT_CHARACTER; + } } - mLevels.resize(mTextLength); - mParaDir = AndroidBidi.bidi(bidiRequest, mCopiedBuffer, mLevels.getRawArray()); - mLtrWithoutBidi = false; + mBidi = new Bidi(mCopiedBuffer, 0, null, 0, mCopiedBuffer.length, bidiRequest); + } + mLevels.resize(mTextLength); + byte[] rawArray = mLevels.getRawArray(); + for (int i = 0; i < mTextLength; ++i) { + rawArray[i] = mBidi.getLevelAt(i); } + mLtrWithoutBidi = false; } private void applyReplacementRun(@NonNull ReplacementSpan replacement, diff --git a/core/java/android/text/TextFlags.java b/core/java/android/text/TextFlags.java index 0f1b031a8fad..8ee2ad0ef35e 100644 --- a/core/java/android/text/TextFlags.java +++ b/core/java/android/text/TextFlags.java @@ -57,7 +57,6 @@ public final class TextFlags { public static final String[] TEXT_ACONFIGS_FLAGS = { Flags.FLAG_NO_BREAK_NO_HYPHENATION_SPAN, Flags.FLAG_FIX_LINE_HEIGHT_FOR_LOCALE, - Flags.FLAG_ICU_BIDI_MIGRATION, Flags.FLAG_FIX_MISALIGNED_CONTEXT_MENU, }; @@ -69,7 +68,6 @@ public final class TextFlags { public static final boolean[] TEXT_ACONFIG_DEFAULT_VALUE = { Flags.noBreakNoHyphenationSpan(), Flags.fixLineHeightForLocale(), - Flags.icuBidiMigration(), Flags.fixMisalignedContextMenu(), }; diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index 34b6c840dd6a..e827cbedf503 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -112,13 +112,6 @@ flag { } } -flag { - name: "icu_bidi_migration" - namespace: "text" - description: "A flag for replacing AndroidBidi with android.icu.text.Bidi." - bug: "317144801" -} - flag { name: "lazy_variation_instance" namespace: "text" -- GitLab From fbff45b49e2ba3ec93d6ca26aaff05df52e98742 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Thu, 5 Sep 2024 16:32:15 +0900 Subject: [PATCH 088/492] Remove lazy_variation_instance flag Bug: 324676775 Bug: 364533012 Flag: EXEMPT removing com.android.text.flags.lazy_variation_instance Test: N/A Change-Id: I25c8a14fab777adc913827bed3393beb17ca0931 --- core/java/android/text/flags/flags.aconfig | 9 --------- 1 file changed, 9 deletions(-) diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index e827cbedf503..02f8779a4b46 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -112,15 +112,6 @@ flag { } } -flag { - name: "lazy_variation_instance" - namespace: "text" - description: "A flag for enabling lazy variation instance creation." - # Make read only, as it could be used before the Settings provider is initialized. - is_fixed_read_only: true - bug: "324676775" -} - flag { name: "handwriting_end_of_line_tap" namespace: "text" -- GitLab From ce41cdf4c0a0541c337f34f8062cfc572f909f9c Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Mon, 9 Sep 2024 10:24:31 +0800 Subject: [PATCH 089/492] Import SettingsLib/Metadata library Bug: 332201912 Flag: NONE Add library Test: N/A Change-Id: I227fc74bf3db12776a89b0303f87e6b0d4a264e0 --- packages/SettingsLib/Metadata/Android.bp | 23 ++ .../SettingsLib/Metadata/AndroidManifest.xml | 6 + .../SettingsLib/Metadata/processor/Android.bp | 11 + .../javax.annotation.processing.Processor | 1 + .../PreferenceScreenAnnotationProcessor.kt | 226 ++++++++++++++++++ .../settingslib/metadata/Annotations.kt | 49 ++++ .../metadata/PersistentPreference.kt | 174 ++++++++++++++ .../metadata/PreferenceHierarchy.kt | 127 ++++++++++ .../metadata/PreferenceMetadata.kt | 204 ++++++++++++++++ .../PreferenceScreenBindingKeyProvider.kt | 29 +++ .../metadata/PreferenceScreenRegistry.kt | 157 ++++++++++++ .../metadata/PreferenceStateProviders.kt | 95 ++++++++ .../settingslib/metadata/PreferenceTypes.kt | 40 ++++ 13 files changed, 1142 insertions(+) create mode 100644 packages/SettingsLib/Metadata/Android.bp create mode 100644 packages/SettingsLib/Metadata/AndroidManifest.xml create mode 100644 packages/SettingsLib/Metadata/processor/Android.bp create mode 100644 packages/SettingsLib/Metadata/processor/resources/META-INF/services/javax.annotation.processing.Processor create mode 100644 packages/SettingsLib/Metadata/processor/src/com/android/settingslib/metadata/PreferenceScreenAnnotationProcessor.kt create mode 100644 packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/Annotations.kt create mode 100644 packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PersistentPreference.kt create mode 100644 packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceHierarchy.kt create mode 100644 packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceMetadata.kt create mode 100644 packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceScreenBindingKeyProvider.kt create mode 100644 packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceScreenRegistry.kt create mode 100644 packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceStateProviders.kt create mode 100644 packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceTypes.kt diff --git a/packages/SettingsLib/Metadata/Android.bp b/packages/SettingsLib/Metadata/Android.bp new file mode 100644 index 000000000000..207637f86372 --- /dev/null +++ b/packages/SettingsLib/Metadata/Android.bp @@ -0,0 +1,23 @@ +package { + default_applicable_licenses: ["frameworks_base_license"], +} + +filegroup { + name: "SettingsLibMetadata-srcs", + srcs: ["src/**/*.kt"], +} + +android_library { + name: "SettingsLibMetadata", + defaults: [ + "SettingsLintDefaults", + ], + srcs: [":SettingsLibMetadata-srcs"], + static_libs: [ + "androidx.annotation_annotation", + "androidx.fragment_fragment", + "guava", + "SettingsLibDataStore", + ], + kotlincflags: ["-Xjvm-default=all"], +} diff --git a/packages/SettingsLib/Metadata/AndroidManifest.xml b/packages/SettingsLib/Metadata/AndroidManifest.xml new file mode 100644 index 000000000000..1c801e640f82 --- /dev/null +++ b/packages/SettingsLib/Metadata/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/packages/SettingsLib/Metadata/processor/Android.bp b/packages/SettingsLib/Metadata/processor/Android.bp new file mode 100644 index 000000000000..d8acc7633d81 --- /dev/null +++ b/packages/SettingsLib/Metadata/processor/Android.bp @@ -0,0 +1,11 @@ +package { + default_applicable_licenses: ["frameworks_base_license"], +} + +java_plugin { + name: "SettingsLibMetadata-processor", + srcs: ["src/**/*.kt"], + processor_class: "com.android.settingslib.metadata.PreferenceScreenAnnotationProcessor", + java_resource_dirs: ["resources"], + visibility: ["//visibility:public"], +} diff --git a/packages/SettingsLib/Metadata/processor/resources/META-INF/services/javax.annotation.processing.Processor b/packages/SettingsLib/Metadata/processor/resources/META-INF/services/javax.annotation.processing.Processor new file mode 100644 index 000000000000..762a01a92f42 --- /dev/null +++ b/packages/SettingsLib/Metadata/processor/resources/META-INF/services/javax.annotation.processing.Processor @@ -0,0 +1 @@ +com.android.settingslib.metadata.PreferenceScreenAnnotationProcessor \ No newline at end of file diff --git a/packages/SettingsLib/Metadata/processor/src/com/android/settingslib/metadata/PreferenceScreenAnnotationProcessor.kt b/packages/SettingsLib/Metadata/processor/src/com/android/settingslib/metadata/PreferenceScreenAnnotationProcessor.kt new file mode 100644 index 000000000000..620d717faf69 --- /dev/null +++ b/packages/SettingsLib/Metadata/processor/src/com/android/settingslib/metadata/PreferenceScreenAnnotationProcessor.kt @@ -0,0 +1,226 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +import java.util.TreeMap +import javax.annotation.processing.AbstractProcessor +import javax.annotation.processing.ProcessingEnvironment +import javax.annotation.processing.RoundEnvironment +import javax.lang.model.SourceVersion +import javax.lang.model.element.AnnotationMirror +import javax.lang.model.element.AnnotationValue +import javax.lang.model.element.Element +import javax.lang.model.element.ElementKind +import javax.lang.model.element.ExecutableElement +import javax.lang.model.element.Modifier +import javax.lang.model.element.TypeElement +import javax.lang.model.type.TypeMirror +import javax.tools.Diagnostic + +/** Processor to gather preference screens annotated with `@ProvidePreferenceScreen`. */ +class PreferenceScreenAnnotationProcessor : AbstractProcessor() { + private val screens = TreeMap() + private val overlays = mutableMapOf() + private val contextType: TypeMirror by lazy { + processingEnv.elementUtils.getTypeElement("android.content.Context").asType() + } + + private var options: Map? = null + private lateinit var annotationElement: TypeElement + private lateinit var optionsElement: TypeElement + private lateinit var screenType: TypeMirror + + override fun getSupportedAnnotationTypes() = setOf(ANNOTATION, OPTIONS) + + override fun getSupportedSourceVersion(): SourceVersion = SourceVersion.latestSupported() + + override fun init(processingEnv: ProcessingEnvironment) { + super.init(processingEnv) + val elementUtils = processingEnv.elementUtils + annotationElement = elementUtils.getTypeElement(ANNOTATION) + optionsElement = elementUtils.getTypeElement(OPTIONS) + screenType = elementUtils.getTypeElement("$PACKAGE.$PREFERENCE_SCREEN_METADATA").asType() + } + + override fun process( + annotations: MutableSet, + roundEnv: RoundEnvironment, + ): Boolean { + roundEnv.getElementsAnnotatedWith(optionsElement).singleOrNull()?.run { + if (options != null) error("@$OPTIONS_NAME is already specified: $options", this) + options = + annotationMirrors + .single { it.isElement(optionsElement) } + .elementValues + .entries + .associate { it.key.simpleName.toString() to it.value.value } + } + for (element in roundEnv.getElementsAnnotatedWith(annotationElement)) { + (element as? TypeElement)?.process() + } + if (roundEnv.processingOver()) codegen() + return false + } + + private fun TypeElement.process() { + if (kind != ElementKind.CLASS || modifiers.contains(Modifier.ABSTRACT)) { + error("@$ANNOTATION_NAME must be added to non abstract class", this) + return + } + if (!processingEnv.typeUtils.isAssignable(asType(), screenType)) { + error("@$ANNOTATION_NAME must be added to $PREFERENCE_SCREEN_METADATA subclass", this) + return + } + val constructorType = getConstructorType() + if (constructorType == null) { + error( + "Class must be an object, or has single public constructor that " + + "accepts no parameter or a Context parameter", + this, + ) + return + } + val screenQualifiedName = qualifiedName.toString() + screens[screenQualifiedName] = constructorType + val annotation = annotationMirrors.single { it.isElement(annotationElement) } + val overlay = annotation.getOverlay() + if (overlay != null) { + overlays.put(overlay, screenQualifiedName)?.let { + error("$overlay has been overlaid by $it", this) + } + } + } + + private fun codegen() { + val collector = (options?.get("codegenCollector") as? String) ?: DEFAULT_COLLECTOR + if (collector.isEmpty()) return + val parts = collector.split('/') + if (parts.size == 3) { + generateCode(parts[0], parts[1], parts[2]) + } else { + throw IllegalArgumentException( + "Collector option '$collector' does not follow 'PKG/CLASS/METHOD' format" + ) + } + } + + private fun generateCode(outputPkg: String, outputClass: String, outputFun: String) { + for ((overlay, screen) in overlays) { + if (screens.remove(overlay) == null) { + warn("$overlay is overlaid by $screen but not annotated with @$ANNOTATION_NAME") + } else { + processingEnv.messager.printMessage( + Diagnostic.Kind.NOTE, + "$overlay is overlaid by $screen", + ) + } + } + processingEnv.filer.createSourceFile("$outputPkg.$outputClass").openWriter().use { + it.write("package $outputPkg;\n\n") + it.write("import $PACKAGE.$PREFERENCE_SCREEN_METADATA;\n\n") + it.write("// Generated by annotation processor for @$ANNOTATION_NAME\n") + it.write("public final class $outputClass {\n") + it.write(" private $outputClass() {}\n\n") + it.write( + " public static java.util.List<$PREFERENCE_SCREEN_METADATA> " + + "$outputFun(android.content.Context context) {\n" + ) + it.write( + " java.util.ArrayList<$PREFERENCE_SCREEN_METADATA> screens = " + + "new java.util.ArrayList<>(${screens.size});\n" + ) + for ((screen, constructorType) in screens) { + when (constructorType) { + ConstructorType.DEFAULT -> it.write(" screens.add(new $screen());\n") + ConstructorType.CONTEXT -> it.write(" screens.add(new $screen(context));\n") + ConstructorType.SINGLETON -> it.write(" screens.add($screen.INSTANCE);\n") + } + } + for ((overlay, screen) in overlays) { + it.write(" // $overlay is overlaid by $screen\n") + } + it.write(" return screens;\n") + it.write(" }\n") + it.write("}") + } + } + + private fun AnnotationMirror.isElement(element: TypeElement) = + processingEnv.typeUtils.isSameType(annotationType.asElement().asType(), element.asType()) + + private fun AnnotationMirror.getOverlay(): String? { + for ((key, value) in elementValues) { + if (key.simpleName.contentEquals("overlay")) { + return if (value.isDefaultClassValue(key)) null else value.value.toString() + } + } + return null + } + + private fun AnnotationValue.isDefaultClassValue(key: ExecutableElement) = + processingEnv.typeUtils.isSameType( + value as TypeMirror, + key.defaultValue.value as TypeMirror, + ) + + private fun TypeElement.getConstructorType(): ConstructorType? { + var constructor: ExecutableElement? = null + for (element in enclosedElements) { + if (element.isKotlinObject()) return ConstructorType.SINGLETON + if (element.kind != ElementKind.CONSTRUCTOR) continue + if (!element.modifiers.contains(Modifier.PUBLIC)) continue + if (constructor != null) return null + constructor = element as ExecutableElement + } + return constructor?.parameters?.run { + when { + isEmpty() -> ConstructorType.DEFAULT + size == 1 && processingEnv.typeUtils.isSameType(this[0].asType(), contextType) -> + ConstructorType.CONTEXT + else -> null + } + } + } + + private fun Element.isKotlinObject() = + kind == ElementKind.FIELD && + modifiers.run { contains(Modifier.PUBLIC) && contains(Modifier.STATIC) } && + simpleName.toString() == "INSTANCE" + + private fun warn(msg: CharSequence) = + processingEnv.messager.printMessage(Diagnostic.Kind.WARNING, msg) + + private fun error(msg: CharSequence, element: Element) = + processingEnv.messager.printMessage(Diagnostic.Kind.ERROR, msg, element) + + private enum class ConstructorType { + DEFAULT, // default constructor with no parameter + CONTEXT, // constructor with a Context parameter + SINGLETON, // Kotlin object class + } + + companion object { + private const val PACKAGE = "com.android.settingslib.metadata" + private const val ANNOTATION_NAME = "ProvidePreferenceScreen" + private const val ANNOTATION = "$PACKAGE.$ANNOTATION_NAME" + private const val PREFERENCE_SCREEN_METADATA = "PreferenceScreenMetadata" + + private const val OPTIONS_NAME = "ProvidePreferenceScreenOptions" + private const val OPTIONS = "$PACKAGE.$OPTIONS_NAME" + private const val DEFAULT_COLLECTOR = "$PACKAGE/PreferenceScreenCollector/get" + } +} diff --git a/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/Annotations.kt b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/Annotations.kt new file mode 100644 index 000000000000..ea20a74de3cf --- /dev/null +++ b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/Annotations.kt @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +import kotlin.reflect.KClass + +/** + * Annotation to provide preference screen. + * + * The annotated class must satisfy either condition: + * - the primary constructor has no parameter + * - the primary constructor has a single [android.content.Context] parameter + * - it is a Kotlin object class + * + * @param overlay if specified, current annotated screen will overlay the given screen + */ +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.CLASS) +@MustBeDocumented +annotation class ProvidePreferenceScreen( + val overlay: KClass = PreferenceScreenMetadata::class, +) + +/** + * Provides options for [ProvidePreferenceScreen] annotation processor. + * + * @param codegenCollector generated collector class (format: "pkg/class/method"), an empty string + * means do not generate code + */ +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.CLASS) +@MustBeDocumented +annotation class ProvidePreferenceScreenOptions( + val codegenCollector: String = "com.android.settingslib.metadata/PreferenceScreenCollector/get", +) diff --git a/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PersistentPreference.kt b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PersistentPreference.kt new file mode 100644 index 000000000000..51a85803c6ed --- /dev/null +++ b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PersistentPreference.kt @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +import android.content.Context +import androidx.annotation.ArrayRes +import androidx.annotation.IntDef +import com.android.settingslib.datastore.KeyValueStore + +/** Permit of read and write request. */ +@IntDef( + ReadWritePermit.ALLOW, + ReadWritePermit.DISALLOW, + ReadWritePermit.REQUIRE_APP_PERMISSION, + ReadWritePermit.REQUIRE_USER_AGREEMENT, +) +@Retention(AnnotationRetention.SOURCE) +annotation class ReadWritePermit { + companion object { + /** Allow to read/write value. */ + const val ALLOW = 0 + /** Disallow to read/write value (e.g. uid not allowed). */ + const val DISALLOW = 1 + /** Require (runtime/special) app permission from user explicitly. */ + const val REQUIRE_APP_PERMISSION = 2 + /** Require explicit user agreement (e.g. terms of service). */ + const val REQUIRE_USER_AGREEMENT = 3 + } +} + +/** Preference interface that has a value persisted in datastore. */ +interface PersistentPreference { + + /** + * Returns the key-value storage of the preference. + * + * The default implementation returns the storage provided by + * [PreferenceScreenRegistry.getKeyValueStore]. + */ + fun storage(context: Context): KeyValueStore = + PreferenceScreenRegistry.getKeyValueStore(context, this as PreferenceMetadata)!! + + /** + * Returns if the external application (identified by [callingUid]) has permission to read + * preference value. + * + * The underlying implementation does NOT need to check common states like isEnabled, + * isRestricted or isAvailable. + */ + @ReadWritePermit + fun getReadPermit(context: Context, myUid: Int, callingUid: Int): Int = + PreferenceScreenRegistry.getReadPermit( + context, + myUid, + callingUid, + this as PreferenceMetadata, + ) + + /** + * Returns if the external application (identified by [callingUid]) has permission to write + * preference with given [value]. + * + * The underlying implementation does NOT need to check common states like isEnabled, + * isRestricted or isAvailable. + */ + @ReadWritePermit + fun getWritePermit(context: Context, value: T?, myUid: Int, callingUid: Int): Int = + PreferenceScreenRegistry.getWritePermit( + context, + value, + myUid, + callingUid, + this as PreferenceMetadata, + ) +} + +/** Descriptor of values. */ +sealed interface ValueDescriptor { + + /** Returns if given value (represented by index) is valid. */ + fun isValidValue(context: Context, index: Int): Boolean +} + +/** + * A boolean type value. + * + * A zero value means `False`, otherwise it is `True`. + */ +interface BooleanValue : ValueDescriptor { + override fun isValidValue(context: Context, index: Int) = true +} + +/** Value falls into a given array. */ +interface DiscreteValue : ValueDescriptor { + @get:ArrayRes val values: Int + + @get:ArrayRes val valuesDescription: Int + + fun getValue(context: Context, index: Int): T +} + +/** + * Value falls into a text array, whose element is [CharSequence] type. + * + * [values] resource is ``. + */ +interface DiscreteTextValue : DiscreteValue { + override fun isValidValue(context: Context, index: Int): Boolean { + if (index < 0) return false + return index < context.resources.getTextArray(values).size + } + + override fun getValue(context: Context, index: Int): CharSequence = + context.resources.getTextArray(values)[index] +} + +/** + * Value falls into a string array, whose element is [String] type. + * + * [values] resource is ``. + */ +interface DiscreteStringValue : DiscreteValue { + override fun isValidValue(context: Context, index: Int): Boolean { + if (index < 0) return false + return index < context.resources.getStringArray(values).size + } + + override fun getValue(context: Context, index: Int): String = + context.resources.getStringArray(values)[index] +} + +/** + * Value falls into an integer array. + * + * [values] resource is ``. + */ +interface DiscreteIntValue : DiscreteValue { + override fun isValidValue(context: Context, index: Int): Boolean { + if (index < 0) return false + return index < context.resources.getIntArray(values).size + } + + override fun getValue(context: Context, index: Int): Int = + context.resources.getIntArray(values)[index] +} + +/** Value is between a range. */ +interface RangeValue : ValueDescriptor { + /** The lower bound (inclusive) of the range. */ + val minValue: Int + + /** The upper bound (inclusive) of the range. */ + val maxValue: Int + + /** The increment step within the range. 0 means unset, which implies step size is 1. */ + val incrementStep: Int + get() = 0 + + override fun isValidValue(context: Context, index: Int) = index in minValue..maxValue +} diff --git a/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceHierarchy.kt b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceHierarchy.kt new file mode 100644 index 000000000000..450373804b28 --- /dev/null +++ b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceHierarchy.kt @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +/** A node in preference hierarchy that is associated with [PreferenceMetadata]. */ +open class PreferenceHierarchyNode internal constructor(val metadata: PreferenceMetadata) + +/** + * Preference hierarchy describes the structure of preferences recursively. + * + * A root hierarchy represents a preference screen. A sub-hierarchy represents a preference group. + */ +class PreferenceHierarchy internal constructor(metadata: PreferenceMetadata) : + PreferenceHierarchyNode(metadata) { + + private val children = mutableListOf() + + /** Adds a preference to the hierarchy. */ + operator fun PreferenceMetadata.unaryPlus() { + children.add(PreferenceHierarchyNode(this)) + } + + /** + * Adds preference screen with given key (as a placeholder) to the hierarchy. + * + * This is mainly to support Android Settings overlays. OEMs might want to custom some of the + * screens. In resource-based hierarchy, it leverages the resource overlay. In terms of DSL or + * programmatic hierarchy, it will be a problem to specify concrete screen metadata objects. + * Instead, use preference screen key as a placeholder in the hierarchy and screen metadata will + * be looked up from [PreferenceScreenRegistry] lazily at runtime. + * + * @throws NullPointerException if screen is not registered to [PreferenceScreenRegistry] + */ + operator fun String.unaryPlus() { + children.add(PreferenceHierarchyNode(PreferenceScreenRegistry[this]!!)) + } + + /** Adds a preference to the hierarchy. */ + fun add(metadata: PreferenceMetadata) { + children.add(PreferenceHierarchyNode(metadata)) + } + + /** Adds a preference group to the hierarchy. */ + operator fun PreferenceGroup.unaryPlus() = PreferenceHierarchy(this).also { children.add(it) } + + /** Adds a preference group and returns its preference hierarchy. */ + fun addGroup(metadata: PreferenceGroup): PreferenceHierarchy = + PreferenceHierarchy(metadata).also { children.add(it) } + + /** + * Adds preference screen with given key (as a placeholder) to the hierarchy. + * + * This is mainly to support Android Settings overlays. OEMs might want to custom some of the + * screens. In resource-based hierarchy, it leverages the resource overlay. In terms of DSL or + * programmatic hierarchy, it will be a problem to specify concrete screen metadata objects. + * Instead, use preference screen key as a placeholder in the hierarchy and screen metadata will + * be looked up from [PreferenceScreenRegistry] lazily at runtime. + * + * @throws NullPointerException if screen is not registered to [PreferenceScreenRegistry] + */ + fun addPreferenceScreen(screenKey: String) { + children.add(PreferenceHierarchy(PreferenceScreenRegistry[screenKey]!!)) + } + + /** Extensions to add more preferences to the hierarchy. */ + operator fun plusAssign(init: PreferenceHierarchy.() -> Unit) = init(this) + + /** Traversals preference hierarchy and applies given action. */ + fun forEach(action: (PreferenceHierarchyNode) -> Unit) { + for (it in children) action(it) + } + + /** Traversals preference hierarchy and applies given action. */ + suspend fun forEachAsync(action: suspend (PreferenceHierarchyNode) -> Unit) { + for (it in children) action(it) + } + + /** Finds the [PreferenceMetadata] object associated with given key. */ + fun find(key: String): PreferenceMetadata? { + if (metadata.key == key) return metadata + for (child in children) { + if (child is PreferenceHierarchy) { + val result = child.find(key) + if (result != null) return result + } else { + if (child.metadata.key == key) return child.metadata + } + } + return null + } + + /** Returns all the [PreferenceMetadata]s appear in the hierarchy. */ + fun getAllPreferences(): List = + mutableListOf().also { getAllPreferences(it) } + + private fun getAllPreferences(result: MutableList) { + result.add(metadata) + for (child in children) { + if (child is PreferenceHierarchy) { + child.getAllPreferences(result) + } else { + result.add(child.metadata) + } + } + } +} + +/** + * Builder function to create [PreferenceHierarchy] in + * [DSL](https://kotlinlang.org/docs/type-safe-builders.html) manner. + */ +fun preferenceHierarchy(metadata: PreferenceMetadata, init: PreferenceHierarchy.() -> Unit) = + PreferenceHierarchy(metadata).also(init) diff --git a/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceMetadata.kt b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceMetadata.kt new file mode 100644 index 000000000000..f39f3a065e79 --- /dev/null +++ b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceMetadata.kt @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import androidx.fragment.app.Fragment +import androidx.annotation.AnyThread +import androidx.annotation.DrawableRes +import androidx.annotation.StringRes + +/** + * Interface provides preference metadata (title, summary, icon, etc.). + * + * Besides the existing APIs, subclass could integrate with following interface to provide more + * information: + * - [PreferenceTitleProvider]: provide dynamic title content + * - [PreferenceSummaryProvider]: provide dynamic summary content (e.g. based on preference value) + * - [PreferenceAvailabilityProvider]: provide preference availability (e.g. based on flag) + * - [PreferenceLifecycleProvider]: provide the lifecycle callbacks and notify state change + * + * Notes: + * - UI framework support: + * - This class does not involve any UI logic, it is the data layer. + * - Subclass could integrate with datastore and UI widget to provide UI layer. For instance, + * `PreferenceBinding` supports Jetpack Preference binding. + * - Datastore: + * - Subclass should implement the [PersistentPreference] to note that current preference is + * persistent in datastore. + * - It is always recommended to support back up preference value changed by user. Typically, + * the back up and restore happen within datastore, the [allowBackup] API is to mark if + * current preference value should be backed up (backup allowed by default). + * - Preference indexing for search: + * - Override [isIndexable] API to mark if preference is indexable (enabled by default). + * - If [isIndexable] returns true, preference title and summary will be indexed with cache. + * More indexing data could be provided through [keywords]. + * - Settings search will cache the preference title/summary/keywords for indexing. The cache is + * invalidated when system locale changed, app upgraded, etc. + * - Dynamic content is not suitable to be cached for indexing. Subclass that implements + * [PreferenceTitleProvider] / [PreferenceSummaryProvider] will not have its title / summary + * indexed. + */ +@AnyThread +interface PreferenceMetadata { + + /** Preference key. */ + val key: String + + /** + * Preference title resource id. + * + * Implement [PreferenceTitleProvider] if title is generated dynamically. + */ + val title: Int + @StringRes get() = 0 + + /** + * Preference summary resource id. + * + * Implement [PreferenceSummaryProvider] if summary is generated dynamically (e.g. summary is + * provided per preference value) + */ + val summary: Int + @StringRes get() = 0 + + /** Icon of the preference. */ + val icon: Int + @DrawableRes get() = 0 + + /** Additional keywords for indexing. */ + val keywords: Int + @StringRes get() = 0 + + /** + * Return the extras Bundle object associated with this preference. + * + * It is used to provide more information for metadata. + */ + fun extras(context: Context): Bundle? = null + + /** + * Returns if preference is indexable, default value is `true`. + * + * Return `false` only when the preference is always unavailable on current device. If it is + * conditional available, override [PreferenceAvailabilityProvider]. + */ + fun isIndexable(context: Context): Boolean = true + + /** + * Returns if preference is enabled. + * + * UI framework normally does not allow user to interact with the preference widget when it is + * disabled. + * + * [dependencyOfEnabledState] is provided to support dependency, the [shouldDisableDependents] + * value of dependent preference is used to decide enabled state. + */ + fun isEnabled(context: Context): Boolean { + val dependency = dependencyOfEnabledState(context) ?: return true + return !dependency.shouldDisableDependents(context) + } + + /** Returns the key of depended preference to decide the enabled state. */ + fun dependencyOfEnabledState(context: Context): PreferenceMetadata? = null + + /** Returns whether this preference's dependents should be disabled. */ + fun shouldDisableDependents(context: Context): Boolean = !isEnabled(context) + + /** Returns if the preference is persistent in datastore. */ + fun isPersistent(context: Context): Boolean = this is PersistentPreference<*> + + /** + * Returns if preference value backup is allowed (by default returns `true` if preference is + * persistent). + */ + fun allowBackup(context: Context): Boolean = isPersistent(context) + + /** Returns preference intent. */ + fun intent(context: Context): Intent? = null + + /** Returns preference order. */ + fun order(context: Context): Int? = null + + /** + * Returns the preference title. + * + * Implement [PreferenceTitleProvider] interface if title content is generated dynamically. + */ + fun getPreferenceTitle(context: Context): CharSequence? = + when { + title != 0 -> context.getText(title) + this is PreferenceTitleProvider -> getTitle(context) + else -> null + } + + /** + * Returns the preference summary. + * + * Implement [PreferenceSummaryProvider] interface if summary content is generated dynamically + * (e.g. summary is provided per preference value). + */ + fun getPreferenceSummary(context: Context): CharSequence? = + when { + summary != 0 -> context.getText(summary) + this is PreferenceSummaryProvider -> getSummary(context) + else -> null + } +} + +/** Metadata of preference group. */ +@AnyThread +open class PreferenceGroup(override val key: String, override val title: Int) : PreferenceMetadata + +/** Metadata of preference screen. */ +@AnyThread +interface PreferenceScreenMetadata : PreferenceMetadata { + + /** + * The screen title resource, which precedes [getScreenTitle] if provided. + * + * By default, screen title is same with [title]. + */ + val screenTitle: Int + get() = title + + /** Returns dynamic screen title, use [screenTitle] whenever possible. */ + fun getScreenTitle(context: Context): CharSequence? = null + + /** Returns the fragment class to show the preference screen. */ + fun fragmentClass(): Class? + + /** + * Indicates if [getPreferenceHierarchy] returns a complete hierarchy of the preference screen. + * + * If `true`, the result of [getPreferenceHierarchy] will be used to inflate preference screen. + * Otherwise, it is an intermediate state called hybrid mode, preference hierarchy is + * represented by other ways (e.g. XML resource) and [PreferenceMetadata]s in + * [getPreferenceHierarchy] will only be used to bind UI widgets. + */ + fun hasCompleteHierarchy(): Boolean = true + + /** + * Returns the hierarchy of preference screen. + * + * The implementation MUST include all preferences into the hierarchy regardless of the runtime + * conditions. DO NOT check any condition (except compile time flag) before adding a preference. + */ + fun getPreferenceHierarchy(context: Context): PreferenceHierarchy +} diff --git a/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceScreenBindingKeyProvider.kt b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceScreenBindingKeyProvider.kt new file mode 100644 index 000000000000..84014f191f68 --- /dev/null +++ b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceScreenBindingKeyProvider.kt @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +import android.content.Context + +/** Provides the associated preference screen key for binding. */ +interface PreferenceScreenBindingKeyProvider { + + /** Returns the associated preference screen key. */ + fun getPreferenceScreenBindingKey(context: Context): String? +} + +/** Extra key to provide the preference screen key for binding. */ +const val EXTRA_BINDING_SCREEN_KEY = "settingslib:binding_screen_key" diff --git a/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceScreenRegistry.kt b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceScreenRegistry.kt new file mode 100644 index 000000000000..48798da57dae --- /dev/null +++ b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceScreenRegistry.kt @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +import android.content.Context +import com.android.settingslib.datastore.KeyValueStore +import com.google.common.base.Supplier +import com.google.common.base.Suppliers +import com.google.common.collect.ImmutableMap + +private typealias PreferenceScreenMap = ImmutableMap + +/** Registry of all available preference screens in the app. */ +object PreferenceScreenRegistry : ReadWritePermitProvider { + + /** Provider of key-value store. */ + private lateinit var keyValueStoreProvider: KeyValueStoreProvider + + private var preferenceScreensSupplier: Supplier = Supplier { + ImmutableMap.of() + } + + private val preferenceScreens: PreferenceScreenMap + get() = preferenceScreensSupplier.get() + + private var readWritePermitProvider: ReadWritePermitProvider? = null + + /** Sets the [KeyValueStoreProvider]. */ + fun setKeyValueStoreProvider(keyValueStoreProvider: KeyValueStoreProvider) { + this.keyValueStoreProvider = keyValueStoreProvider + } + + /** + * Returns the key-value store for given preference. + * + * Must call [setKeyValueStoreProvider] before invoking this method, otherwise + * [NullPointerException] is raised. + */ + fun getKeyValueStore(context: Context, preference: PreferenceMetadata): KeyValueStore? = + keyValueStoreProvider.getKeyValueStore(context, preference) + + /** Sets supplier to provide available preference screens. */ + fun setPreferenceScreensSupplier(supplier: Supplier>) { + preferenceScreensSupplier = + Suppliers.memoize { + val screensBuilder = ImmutableMap.builder() + for (screen in supplier.get()) screensBuilder.put(screen.key, screen) + screensBuilder.buildOrThrow() + } + } + + /** Sets available preference screens. */ + fun setPreferenceScreens(vararg screens: PreferenceScreenMetadata) { + val screensBuilder = ImmutableMap.builder() + for (screen in screens) screensBuilder.put(screen.key, screen) + preferenceScreensSupplier = Suppliers.ofInstance(screensBuilder.buildOrThrow()) + } + + /** Returns [PreferenceScreenMetadata] of particular key. */ + operator fun get(key: String?): PreferenceScreenMetadata? = + if (key != null) preferenceScreens[key] else null + + /** + * Sets the provider to check read write permit. Read and write requests are denied by default. + */ + fun setReadWritePermitProvider(readWritePermitProvider: ReadWritePermitProvider?) { + this.readWritePermitProvider = readWritePermitProvider + } + + override fun getReadPermit( + context: Context, + myUid: Int, + callingUid: Int, + preference: PreferenceMetadata, + ) = + readWritePermitProvider?.getReadPermit(context, myUid, callingUid, preference) + ?: ReadWritePermit.DISALLOW + + override fun getWritePermit( + context: Context, + value: Any?, + myUid: Int, + callingUid: Int, + preference: PreferenceMetadata, + ) = + readWritePermitProvider?.getWritePermit(context, value, myUid, callingUid, preference) + ?: ReadWritePermit.DISALLOW +} + +/** Provider of [KeyValueStore]. */ +fun interface KeyValueStoreProvider { + + /** + * Returns the key-value store for given preference. + * + * Here are some use cases: + * - provide the default storage for all preferences + * - determine the storage per preference keys or the interfaces implemented by the preference + */ + fun getKeyValueStore(context: Context, preference: PreferenceMetadata): KeyValueStore? +} + +/** Provider of read and write permit. */ +interface ReadWritePermitProvider { + + @ReadWritePermit + fun getReadPermit( + context: Context, + myUid: Int, + callingUid: Int, + preference: PreferenceMetadata, + ): Int + + @ReadWritePermit + fun getWritePermit( + context: Context, + value: Any?, + myUid: Int, + callingUid: Int, + preference: PreferenceMetadata, + ): Int + + companion object { + @JvmField + val ALLOW_ALL_READ_WRITE = + object : ReadWritePermitProvider { + override fun getReadPermit( + context: Context, + myUid: Int, + callingUid: Int, + preference: PreferenceMetadata, + ) = ReadWritePermit.ALLOW + + override fun getWritePermit( + context: Context, + value: Any?, + myUid: Int, + callingUid: Int, + preference: PreferenceMetadata, + ) = ReadWritePermit.ALLOW + } + } +} diff --git a/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceStateProviders.kt b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceStateProviders.kt new file mode 100644 index 000000000000..a3aa85df5325 --- /dev/null +++ b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceStateProviders.kt @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +import android.content.Context + +/** + * Interface to provide dynamic preference title. + * + * Implement this interface implies that the preference title should not be cached for indexing. + */ +interface PreferenceTitleProvider { + + /** Provides preference title. */ + fun getTitle(context: Context): CharSequence? +} + +/** + * Interface to provide dynamic preference summary. + * + * Implement this interface implies that the preference summary should not be cached for indexing. + */ +interface PreferenceSummaryProvider { + + /** Provides preference summary. */ + fun getSummary(context: Context): CharSequence? +} + +/** + * Interface to provide the state of preference availability. + * + * UI framework normally does not show the preference widget if it is unavailable. + */ +interface PreferenceAvailabilityProvider { + + /** Returns if the preference is available. */ + fun isAvailable(context: Context): Boolean +} + +/** + * Interface to provide the managed configuration state of the preference. + * + * See [Managed configurations](https://developer.android.com/work/managed-configurations) for the + * Android Enterprise support. + */ +interface PreferenceRestrictionProvider { + + /** Returns if preference is restricted by managed configs. */ + fun isRestricted(context: Context): Boolean +} + +/** + * Preference lifecycle to deal with preference state. + * + * Implement this interface when preference depends on runtime conditions. + */ +interface PreferenceLifecycleProvider { + + /** + * Called when preference is attached to UI. + * + * Subclass could override this API to register runtime condition listeners, and invoke + * `onPreferenceStateChanged(this)` on the given [preferenceStateObserver] to update UI when + * internal state (e.g. availability, enabled state, title, summary) is changed. + */ + fun onAttach(context: Context, preferenceStateObserver: PreferenceStateObserver) + + /** + * Called when preference is detached from UI. + * + * Clean up and release resource. + */ + fun onDetach(context: Context) + + /** Observer of preference state. */ + interface PreferenceStateObserver { + + /** Callbacks when preference state is changed. */ + fun onPreferenceStateChanged(preference: PreferenceMetadata) + } +} diff --git a/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceTypes.kt b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceTypes.kt new file mode 100644 index 000000000000..ad996c7c8f86 --- /dev/null +++ b/packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceTypes.kt @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.metadata + +import android.content.Context +import androidx.annotation.StringRes + +/** + * Common base class for preferences that have two selectable states, save a boolean value, and may + * have dependent preferences that are enabled/disabled based on the current state. + */ +interface TwoStatePreference : PreferenceMetadata, PersistentPreference, BooleanValue { + + override fun shouldDisableDependents(context: Context) = + storage(context).getValue(key, Boolean::class.javaObjectType) != true || + super.shouldDisableDependents(context) +} + +/** A preference that provides a two-state toggleable option. */ +open class SwitchPreference +@JvmOverloads +constructor( + override val key: String, + @StringRes override val title: Int = 0, + @StringRes override val summary: Int = 0, +) : TwoStatePreference -- GitLab From d4ed15d09bddf751a5851336844904768ed4f549 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Fri, 6 Sep 2024 18:30:04 +0800 Subject: [PATCH 090/492] Remove explicit creation of SurfaceSession in WM shell Because it is a stateless connection object to SF, it is unnecessary to have individual connections from each functions. There were already several places use null for SurfaceControl.Builder, so the singleton instance SurfaceComposerClient::getDefault() is already in use. Then just use that one. That reduces unnecessary IPC to SF when creating surface. Bug: 163976519 Flag: EXEMPT reduce unnecessary invocation Test: atest SplitTransitionTests Change-Id: I4750ab7dc6e8544e2060ec89207f09f1241966ad --- .../wm/shell/shared/pip/PipContentOverlay.java | 7 +++---- .../com/android/wm/shell/common/SurfaceUtils.java | 10 ++++------ .../com/android/wm/shell/common/SystemWindows.java | 3 +-- .../wm/shell/common/split/SplitDecorManager.java | 14 +++++--------- .../wm/shell/common/split/SplitWindowManager.java | 3 +-- .../compatui/CompatUIWindowManagerAbstract.java | 3 +-- .../wm/shell/compatui/api/CompatUIComponent.kt | 3 +-- .../shell/onehanded/BackgroundWindowManager.java | 3 +-- .../shell/splitscreen/SplitScreenController.java | 3 +-- .../wm/shell/splitscreen/StageCoordinator.java | 5 ----- .../wm/shell/splitscreen/StageTaskListener.java | 10 +++------- .../startingsurface/StartingSurfaceDrawer.java | 3 +-- .../shell/transition/DefaultTransitionHandler.java | 9 +++------ .../shell/transition/ScreenRotationAnimation.java | 9 ++++----- .../wm/shell/transition/WindowThumbnail.java | 5 ++--- .../com/android/wm/shell/windowdecor/ResizeVeil.kt | 8 +------- .../android/wm/shell/ShellTaskOrganizerTests.java | 3 +-- .../wm/shell/splitscreen/SplitTestUtils.java | 3 +-- .../wm/shell/splitscreen/SplitTransitionTests.java | 6 ++---- .../shell/splitscreen/StageCoordinatorTests.java | 6 ++---- .../shell/splitscreen/StageTaskListenerTests.java | 5 +---- .../android/wm/shell/taskview/TaskViewTest.java | 4 +--- .../android/wm/shell/windowdecor/ResizeVeilTest.kt | 2 +- 23 files changed, 41 insertions(+), 86 deletions(-) diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/pip/PipContentOverlay.java b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/pip/PipContentOverlay.java index cf39415b3fe6..6c83d88032df 100644 --- a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/pip/PipContentOverlay.java +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/pip/PipContentOverlay.java @@ -29,7 +29,6 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.TypedValue; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.window.TaskSnapshot; /** @@ -75,7 +74,7 @@ public abstract class PipContentOverlay { public PipColorOverlay(Context context) { mContext = context; - mLeash = new SurfaceControl.Builder(new SurfaceSession()) + mLeash = new SurfaceControl.Builder() .setCallsite(TAG) .setName(LAYER_NAME) .setColorLayer() @@ -123,7 +122,7 @@ public abstract class PipContentOverlay { public PipSnapshotOverlay(TaskSnapshot snapshot, Rect sourceRectHint) { mSnapshot = snapshot; mSourceRectHint = new Rect(sourceRectHint); - mLeash = new SurfaceControl.Builder(new SurfaceSession()) + mLeash = new SurfaceControl.Builder() .setCallsite(TAG) .setName(LAYER_NAME) .build(); @@ -183,7 +182,7 @@ public abstract class PipContentOverlay { mBitmap = Bitmap.createBitmap(overlaySize, overlaySize, Bitmap.Config.ARGB_8888); prepareAppIconOverlay(appIcon); - mLeash = new SurfaceControl.Builder(new SurfaceSession()) + mLeash = new SurfaceControl.Builder() .setCallsite(TAG) .setName(LAYER_NAME) .build(); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SurfaceUtils.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SurfaceUtils.java index 4b138e43bc3f..dd17e2980e58 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SurfaceUtils.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SurfaceUtils.java @@ -17,7 +17,6 @@ package com.android.wm.shell.common; import android.view.SurfaceControl; -import android.view.SurfaceSession; /** * Helpers for handling surface. @@ -25,16 +24,15 @@ import android.view.SurfaceSession; public class SurfaceUtils { /** Creates a dim layer above host surface. */ public static SurfaceControl makeDimLayer(SurfaceControl.Transaction t, SurfaceControl host, - String name, SurfaceSession surfaceSession) { - final SurfaceControl dimLayer = makeColorLayer(host, name, surfaceSession); + String name) { + final SurfaceControl dimLayer = makeColorLayer(host, name); t.setLayer(dimLayer, Integer.MAX_VALUE).setColor(dimLayer, new float[]{0f, 0f, 0f}); return dimLayer; } /** Creates a color layer for host surface. */ - public static SurfaceControl makeColorLayer(SurfaceControl host, String name, - SurfaceSession surfaceSession) { - return new SurfaceControl.Builder(surfaceSession) + public static SurfaceControl makeColorLayer(SurfaceControl host, String name) { + return new SurfaceControl.Builder() .setParent(host) .setColorLayer() .setName(name) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java index ef33b3830e45..3dc86decdb2e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java @@ -42,7 +42,6 @@ import android.view.InsetsState; import android.view.ScrollCaptureResponse; import android.view.SurfaceControl; import android.view.SurfaceControlViewHost; -import android.view.SurfaceSession; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; @@ -311,7 +310,7 @@ public class SystemWindows { @Override protected SurfaceControl getParentSurface(IWindow window, WindowManager.LayoutParams attrs) { - SurfaceControl leash = new SurfaceControl.Builder(new SurfaceSession()) + SurfaceControl leash = new SurfaceControl.Builder() .setContainerLayer() .setName("SystemWindowLeash") .setHidden(false) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java index 7175e361f91a..de3152ad7687 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java @@ -43,7 +43,6 @@ import android.view.IWindow; import android.view.LayoutInflater; import android.view.SurfaceControl; import android.view.SurfaceControlViewHost; -import android.view.SurfaceSession; import android.view.View; import android.view.WindowManager; import android.view.WindowlessWindowManager; @@ -74,7 +73,6 @@ public class SplitDecorManager extends WindowlessWindowManager { private static final String GAP_BACKGROUND_SURFACE_NAME = "GapBackground"; private final IconProvider mIconProvider; - private final SurfaceSession mSurfaceSession; private Drawable mIcon; private ImageView mVeilIconView; @@ -103,17 +101,15 @@ public class SplitDecorManager extends WindowlessWindowManager { private int mOffsetY; private int mRunningAnimationCount = 0; - public SplitDecorManager(Configuration configuration, IconProvider iconProvider, - SurfaceSession surfaceSession) { + public SplitDecorManager(Configuration configuration, IconProvider iconProvider) { super(configuration, null /* rootSurface */, null /* hostInputToken */); mIconProvider = iconProvider; - mSurfaceSession = surfaceSession; } @Override protected SurfaceControl getParentSurface(IWindow window, WindowManager.LayoutParams attrs) { // Can't set position for the ViewRootImpl SC directly. Create a leash to manipulate later. - final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession()) + final SurfaceControl.Builder builder = new SurfaceControl.Builder() .setContainerLayer() .setName(TAG) .setHidden(true) @@ -238,7 +234,7 @@ public class SplitDecorManager extends WindowlessWindowManager { if (mBackgroundLeash == null) { mBackgroundLeash = SurfaceUtils.makeColorLayer(mHostLeash, - RESIZING_BACKGROUND_SURFACE_NAME, mSurfaceSession); + RESIZING_BACKGROUND_SURFACE_NAME); t.setColor(mBackgroundLeash, getResizingBackgroundColor(resizingTask)) .setLayer(mBackgroundLeash, Integer.MAX_VALUE - 1); } @@ -248,7 +244,7 @@ public class SplitDecorManager extends WindowlessWindowManager { final int left = isLandscape ? mOldMainBounds.width() : 0; final int top = isLandscape ? 0 : mOldMainBounds.height(); mGapBackgroundLeash = SurfaceUtils.makeColorLayer(mHostLeash, - GAP_BACKGROUND_SURFACE_NAME, mSurfaceSession); + GAP_BACKGROUND_SURFACE_NAME); // Fill up another side bounds area. t.setColor(mGapBackgroundLeash, getResizingBackgroundColor(resizingTask)) .setLayer(mGapBackgroundLeash, Integer.MAX_VALUE - 2) @@ -405,7 +401,7 @@ public class SplitDecorManager extends WindowlessWindowManager { if (mBackgroundLeash == null) { // Initialize background mBackgroundLeash = SurfaceUtils.makeColorLayer(mHostLeash, - RESIZING_BACKGROUND_SURFACE_NAME, mSurfaceSession); + RESIZING_BACKGROUND_SURFACE_NAME); t.setColor(mBackgroundLeash, getResizingBackgroundColor(resizingTask)) .setLayer(mBackgroundLeash, Integer.MAX_VALUE - 1); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java index 46c1a43f9efe..c5f19742c803 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java @@ -36,7 +36,6 @@ import android.view.InsetsState; import android.view.LayoutInflater; import android.view.SurfaceControl; import android.view.SurfaceControlViewHost; -import android.view.SurfaceSession; import android.view.WindowManager; import android.view.WindowlessWindowManager; @@ -98,7 +97,7 @@ public final class SplitWindowManager extends WindowlessWindowManager { @Override protected SurfaceControl getParentSurface(IWindow window, WindowManager.LayoutParams attrs) { // Can't set position for the ViewRootImpl SC directly. Create a leash to manipulate later. - final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession()) + final SurfaceControl.Builder builder = new SurfaceControl.Builder() .setContainerLayer() .setName(TAG) .setHidden(true) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManagerAbstract.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManagerAbstract.java index 0564c95aef5c..d2b4f1ab6b0d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManagerAbstract.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManagerAbstract.java @@ -38,7 +38,6 @@ import android.util.Log; import android.view.IWindow; import android.view.SurfaceControl; import android.view.SurfaceControlViewHost; -import android.view.SurfaceSession; import android.view.View; import android.view.WindowManager; import android.view.WindowlessWindowManager; @@ -173,7 +172,7 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana @Override protected SurfaceControl getParentSurface(IWindow window, WindowManager.LayoutParams attrs) { String className = getClass().getSimpleName(); - final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession()) + final SurfaceControl.Builder builder = new SurfaceControl.Builder() .setContainerLayer() .setName(className + "Leash") .setHidden(false) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/api/CompatUIComponent.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/api/CompatUIComponent.kt index 831b331a11e9..abc26cfb3e13 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/api/CompatUIComponent.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/api/CompatUIComponent.kt @@ -24,7 +24,6 @@ import android.os.Binder import android.view.IWindow import android.view.SurfaceControl import android.view.SurfaceControlViewHost -import android.view.SurfaceSession import android.view.View import android.view.WindowManager import android.view.WindowlessWindowManager @@ -106,7 +105,7 @@ class CompatUIComponent( attrs: WindowManager.LayoutParams ): SurfaceControl? { val className = javaClass.simpleName - val builder = SurfaceControl.Builder(SurfaceSession()) + val builder = SurfaceControl.Builder() .setContainerLayer() .setName(className + "Leash") .setHidden(false) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/onehanded/BackgroundWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/onehanded/BackgroundWindowManager.java index 71cc8df80cad..422656c6d387 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/onehanded/BackgroundWindowManager.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/onehanded/BackgroundWindowManager.java @@ -38,7 +38,6 @@ import android.view.IWindow; import android.view.LayoutInflater; import android.view.SurfaceControl; import android.view.SurfaceControlViewHost; -import android.view.SurfaceSession; import android.view.View; import android.view.WindowManager; import android.view.WindowlessWindowManager; @@ -105,7 +104,7 @@ public final class BackgroundWindowManager extends WindowlessWindowManager { @Override protected SurfaceControl getParentSurface(IWindow window, WindowManager.LayoutParams attrs) { - final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession()) + final SurfaceControl.Builder builder = new SurfaceControl.Builder() .setColorLayer() .setBufferSize(mDisplayBounds.width(), mDisplayBounds.height()) .setFormat(PixelFormat.RGB_888) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 7e165afce7d4..793e2aa757a3 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -61,7 +61,6 @@ import android.view.IRemoteAnimationRunner; import android.view.RemoteAnimationAdapter; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.view.WindowManager; import android.widget.Toast; import android.window.RemoteTransition; @@ -897,7 +896,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, private SurfaceControl reparentSplitTasksForAnimation(RemoteAnimationTarget[] apps, SurfaceControl.Transaction t, String callsite) { - final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession()) + final SurfaceControl.Builder builder = new SurfaceControl.Builder() .setContainerLayer() .setName("RecentsAnimationSplitTasks") .setHidden(false) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index f3113dce94a4..dad0d4eb4d8d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -104,7 +104,6 @@ import android.view.IRemoteAnimationRunner; import android.view.RemoteAnimationAdapter; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.view.WindowManager; import android.widget.Toast; import android.window.DisplayAreaInfo; @@ -171,8 +170,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private static final String TAG = StageCoordinator.class.getSimpleName(); - private final SurfaceSession mSurfaceSession = new SurfaceSession(); - private final StageTaskListener mMainStage; private final StageListenerImpl mMainStageListener = new StageListenerImpl(); private final StageTaskListener mSideStage; @@ -334,7 +331,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mDisplayId, mMainStageListener, mSyncQueue, - mSurfaceSession, iconProvider, mWindowDecorViewModel); mSideStage = new StageTaskListener( @@ -343,7 +339,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mDisplayId, mSideStageListener, mSyncQueue, - mSurfaceSession, iconProvider, mWindowDecorViewModel); mDisplayController = displayController; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java index 29b5114d87e6..d64c0a24be68 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java @@ -39,7 +39,6 @@ import android.util.Slog; import android.util.SparseArray; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; @@ -93,7 +92,6 @@ public class StageTaskListener implements ShellTaskOrganizer.TaskListener { private final Context mContext; private final StageListenerCallbacks mCallbacks; - private final SurfaceSession mSurfaceSession; private final SyncTransactionQueue mSyncQueue; private final IconProvider mIconProvider; private final Optional mWindowDecorViewModel; @@ -108,12 +106,11 @@ public class StageTaskListener implements ShellTaskOrganizer.TaskListener { StageTaskListener(Context context, ShellTaskOrganizer taskOrganizer, int displayId, StageListenerCallbacks callbacks, SyncTransactionQueue syncQueue, - SurfaceSession surfaceSession, IconProvider iconProvider, + IconProvider iconProvider, Optional windowDecorViewModel) { mContext = context; mCallbacks = callbacks; mSyncQueue = syncQueue; - mSurfaceSession = surfaceSession; mIconProvider = iconProvider; mWindowDecorViewModel = windowDecorViewModel; taskOrganizer.createRootTask(displayId, WINDOWING_MODE_MULTI_WINDOW, this); @@ -203,12 +200,11 @@ public class StageTaskListener implements ShellTaskOrganizer.TaskListener { mRootTaskInfo = taskInfo; mSplitDecorManager = new SplitDecorManager( mRootTaskInfo.configuration, - mIconProvider, - mSurfaceSession); + mIconProvider); mCallbacks.onRootTaskAppeared(); sendStatusChanged(); mSyncQueue.runInSync(t -> mDimLayer = - SurfaceUtils.makeDimLayer(t, mRootLeash, "Dim layer", mSurfaceSession)); + SurfaceUtils.makeDimLayer(t, mRootLeash, "Dim layer")); } else if (taskInfo.parentTaskId == mRootTaskInfo.taskId) { final int taskId = taskInfo.taskId; mChildrenLeashes.put(taskId, leash); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java index fac3592896ea..2e9b53eee13f 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java @@ -33,7 +33,6 @@ import android.hardware.display.DisplayManager; import android.util.SparseArray; import android.view.IWindow; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.view.WindowManager; import android.view.WindowlessWindowManager; import android.window.SplashScreenView; @@ -204,7 +203,7 @@ public class StartingSurfaceDrawer { @Override protected SurfaceControl getParentSurface(IWindow window, WindowManager.LayoutParams attrs) { - final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession()) + final SurfaceControl.Builder builder = new SurfaceControl.Builder() .setContainerLayer() .setName("Windowless window") .setHidden(false) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java index 4fc6c4489f2b..ff4b981f5e8e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java @@ -92,7 +92,6 @@ import android.os.UserHandle; import android.util.ArrayMap; import android.view.Choreographer; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.view.WindowManager; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; @@ -134,8 +133,6 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { private final TransitionAnimation mTransitionAnimation; private final DevicePolicyManager mDevicePolicyManager; - private final SurfaceSession mSurfaceSession = new SurfaceSession(); - /** Keeps track of the currently-running animations associated with each transition. */ private final ArrayMap> mAnimations = new ArrayMap<>(); @@ -705,7 +702,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { TransitionInfo.Change change, TransitionInfo info, int animHint, ArrayList animations, Runnable onAnimFinish) { final int rootIdx = TransitionUtil.rootIndexFor(change, info); - final ScreenRotationAnimation anim = new ScreenRotationAnimation(mContext, mSurfaceSession, + final ScreenRotationAnimation anim = new ScreenRotationAnimation(mContext, mTransactionPool, startTransaction, change, info.getRoot(rootIdx).getLeash(), animHint); // The rotation animation may consist of 3 animations: fade-out screenshot, fade-in real @@ -918,7 +915,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { } final SurfaceControl.Transaction transaction = mTransactionPool.acquire(); - final WindowThumbnail wt = WindowThumbnail.createAndAttach(mSurfaceSession, + final WindowThumbnail wt = WindowThumbnail.createAndAttach( change.getLeash(), thumbnail, transaction); final Animation a = mTransitionAnimation.createCrossProfileAppsThumbnailAnimationLocked(bounds); @@ -943,7 +940,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { @NonNull Runnable finishCallback, TransitionInfo.Change change, TransitionInfo.AnimationOptions options, float cornerRadius) { final SurfaceControl.Transaction transaction = mTransactionPool.acquire(); - final WindowThumbnail wt = WindowThumbnail.createAndAttach(mSurfaceSession, + final WindowThumbnail wt = WindowThumbnail.createAndAttach( change.getLeash(), options.getThumbnail(), transaction); final Rect bounds = change.getEndAbsBounds(); final int orientation = mContext.getResources().getConfiguration().orientation; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java index 0bf9d368ab74..5802e2ca8133 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java @@ -38,7 +38,6 @@ import android.util.Slog; import android.view.Surface; import android.view.SurfaceControl; import android.view.SurfaceControl.Transaction; -import android.view.SurfaceSession; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.window.ScreenCapture; @@ -112,7 +111,7 @@ class ScreenRotationAnimation { /** Intensity of light/whiteness of the layout after rotation occurs. */ private float mEndLuma; - ScreenRotationAnimation(Context context, SurfaceSession session, TransactionPool pool, + ScreenRotationAnimation(Context context, TransactionPool pool, Transaction t, TransitionInfo.Change change, SurfaceControl rootLeash, int animHint) { mContext = context; mTransactionPool = pool; @@ -126,7 +125,7 @@ class ScreenRotationAnimation { mStartRotation = change.getStartRotation(); mEndRotation = change.getEndRotation(); - mAnimLeash = new SurfaceControl.Builder(session) + mAnimLeash = new SurfaceControl.Builder() .setParent(rootLeash) .setEffectLayer() .setCallsite("ShellRotationAnimation") @@ -153,7 +152,7 @@ class ScreenRotationAnimation { return; } - mScreenshotLayer = new SurfaceControl.Builder(session) + mScreenshotLayer = new SurfaceControl.Builder() .setParent(mAnimLeash) .setBLASTLayer() .setSecure(screenshotBuffer.containsSecureLayers()) @@ -178,7 +177,7 @@ class ScreenRotationAnimation { t.setCrop(mSurfaceControl, new Rect(0, 0, mEndWidth, mEndHeight)); if (!isCustomRotate()) { - mBackColorSurface = new SurfaceControl.Builder(session) + mBackColorSurface = new SurfaceControl.Builder() .setParent(rootLeash) .setColorLayer() .setOpaque(true) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/WindowThumbnail.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/WindowThumbnail.java index 2c668ed3d84d..341f2bc66716 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/WindowThumbnail.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/WindowThumbnail.java @@ -21,7 +21,6 @@ import android.graphics.GraphicBuffer; import android.graphics.PixelFormat; import android.hardware.HardwareBuffer; import android.view.SurfaceControl; -import android.view.SurfaceSession; /** * Represents a surface that is displayed over a transition surface. @@ -33,10 +32,10 @@ class WindowThumbnail { private WindowThumbnail() {} /** Create a thumbnail surface and attach it over a parent surface. */ - static WindowThumbnail createAndAttach(SurfaceSession surfaceSession, SurfaceControl parent, + static WindowThumbnail createAndAttach(SurfaceControl parent, HardwareBuffer thumbnailHeader, SurfaceControl.Transaction t) { WindowThumbnail windowThumbnail = new WindowThumbnail(); - windowThumbnail.mSurfaceControl = new SurfaceControl.Builder(surfaceSession) + windowThumbnail.mSurfaceControl = new SurfaceControl.Builder() .setParent(parent) .setName("WindowThumanil : " + parent.toString()) .setCallsite("WindowThumanil") diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.kt index fd6c4d8e604d..fb81ed4169ff 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.kt @@ -30,7 +30,6 @@ import android.view.Display import android.view.LayoutInflater import android.view.SurfaceControl import android.view.SurfaceControlViewHost -import android.view.SurfaceSession import android.view.WindowManager import android.view.WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL import android.view.WindowlessWindowManager @@ -66,7 +65,6 @@ class ResizeVeil @JvmOverloads constructor( private val lightColors = dynamicLightColorScheme(context) private val darkColors = dynamicDarkColorScheme(context) - private val surfaceSession = SurfaceSession() private lateinit var iconView: ImageView private var iconSize = 0 @@ -126,7 +124,7 @@ class ResizeVeil @JvmOverloads constructor( .setCallsite("ResizeVeil#setupResizeVeil") .build() backgroundSurface = surfaceControlBuilderFactory - .create("Resize veil background of Task=" + taskInfo.taskId, surfaceSession) + .create("Resize veil background of Task=" + taskInfo.taskId) .setColorLayer() .setHidden(true) .setParent(veilSurface) @@ -399,10 +397,6 @@ class ResizeVeil @JvmOverloads constructor( fun create(name: String): SurfaceControl.Builder { return SurfaceControl.Builder().setName(name) } - - fun create(name: String, surfaceSession: SurfaceSession): SurfaceControl.Builder { - return SurfaceControl.Builder(surfaceSession).setName(name) - } } companion object { diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTaskOrganizerTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTaskOrganizerTests.java index 413e49562435..e514dc38208e 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTaskOrganizerTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTaskOrganizerTests.java @@ -49,7 +49,6 @@ import android.os.IBinder; import android.os.RemoteException; import android.util.SparseArray; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.window.ITaskOrganizer; import android.window.ITaskOrganizerController; import android.window.TaskAppearedInfo; @@ -169,7 +168,7 @@ public class ShellTaskOrganizerTests extends ShellTestCase { public void testTaskLeashReleasedAfterVanished() throws RemoteException { assumeFalse(ENABLE_SHELL_TRANSITIONS); RunningTaskInfo taskInfo = createTaskInfo(/* taskId= */ 1, WINDOWING_MODE_MULTI_WINDOW); - SurfaceControl taskLeash = new SurfaceControl.Builder(new SurfaceSession()) + SurfaceControl taskLeash = new SurfaceControl.Builder() .setName("task").build(); mOrganizer.registerOrganizer(); mOrganizer.onTaskAppeared(taskInfo, taskLeash); diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java index 751275b9e167..66dcef6f14cc 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java @@ -24,7 +24,6 @@ import android.content.Context; import android.graphics.Rect; import android.os.Handler; import android.view.SurfaceControl; -import android.view.SurfaceSession; import com.android.dx.mockito.inline.extended.ExtendedMockito; import com.android.wm.shell.ShellTaskOrganizer; @@ -89,7 +88,7 @@ public class SplitTestUtils { // Prepare root task for testing. mRootTask = new TestRunningTaskInfoBuilder().build(); - mRootLeash = new SurfaceControl.Builder(new SurfaceSession()).setName("test").build(); + mRootLeash = new SurfaceControl.Builder().setName("test").build(); onTaskAppeared(mRootTask, mRootLeash); } } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java index af288c81616d..ce3944a5855e 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java @@ -53,7 +53,6 @@ import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.window.IRemoteTransition; import android.window.RemoteTransition; import android.window.TransitionInfo; @@ -106,7 +105,6 @@ public class SplitTransitionTests extends ShellTestCase { @Mock private DisplayInsetsController mDisplayInsetsController; @Mock private TransactionPool mTransactionPool; @Mock private Transitions mTransitions; - @Mock private SurfaceSession mSurfaceSession; @Mock private IconProvider mIconProvider; @Mock private WindowDecorViewModel mWindowDecorViewModel; @Mock private ShellExecutor mMainExecutor; @@ -134,11 +132,11 @@ public class SplitTransitionTests extends ShellTestCase { doReturn(mock(SurfaceControl.Transaction.class)).when(mTransactionPool).acquire(); mSplitLayout = SplitTestUtils.createMockSplitLayout(); mMainStage = spy(new StageTaskListener(mContext, mTaskOrganizer, DEFAULT_DISPLAY, mock( - StageTaskListener.StageListenerCallbacks.class), mSyncQueue, mSurfaceSession, + StageTaskListener.StageListenerCallbacks.class), mSyncQueue, mIconProvider, Optional.of(mWindowDecorViewModel))); mMainStage.onTaskAppeared(new TestRunningTaskInfoBuilder().build(), createMockSurface()); mSideStage = spy(new StageTaskListener(mContext, mTaskOrganizer, DEFAULT_DISPLAY, mock( - StageTaskListener.StageListenerCallbacks.class), mSyncQueue, mSurfaceSession, + StageTaskListener.StageListenerCallbacks.class), mSyncQueue, mIconProvider, Optional.of(mWindowDecorViewModel))); mSideStage.onTaskAppeared(new TestRunningTaskInfoBuilder().build(), createMockSurface()); mStageCoordinator = new SplitTestUtils.TestStageCoordinator(mContext, DEFAULT_DISPLAY, diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java index ce343b8a7fa9..a6c16c43c8cb 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java @@ -50,7 +50,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.window.RemoteTransition; import android.window.WindowContainerTransaction; @@ -119,7 +118,6 @@ public class StageCoordinatorTests extends ShellTestCase { private final Rect mBounds2 = new Rect(5, 10, 15, 20); private final Rect mRootBounds = new Rect(0, 0, 45, 60); - private SurfaceSession mSurfaceSession = new SurfaceSession(); private SurfaceControl mRootLeash; private SurfaceControl mDividerLeash; private ActivityManager.RunningTaskInfo mRootTask; @@ -139,7 +137,7 @@ public class StageCoordinatorTests extends ShellTestCase { mDisplayInsetsController, mSplitLayout, mTransitions, mTransactionPool, mMainExecutor, mMainHandler, Optional.empty(), mLaunchAdjacentController, Optional.empty())); - mDividerLeash = new SurfaceControl.Builder(mSurfaceSession).setName("fakeDivider").build(); + mDividerLeash = new SurfaceControl.Builder().setName("fakeDivider").build(); when(mSplitLayout.getBounds1()).thenReturn(mBounds1); when(mSplitLayout.getBounds2()).thenReturn(mBounds2); @@ -149,7 +147,7 @@ public class StageCoordinatorTests extends ShellTestCase { when(mSplitLayout.getDividerLeash()).thenReturn(mDividerLeash); mRootTask = new TestRunningTaskInfoBuilder().build(); - mRootLeash = new SurfaceControl.Builder(mSurfaceSession).setName("test").build(); + mRootLeash = new SurfaceControl.Builder().setName("test").build(); mStageCoordinator.onTaskAppeared(mRootTask, mRootLeash); mSideStage.mRootTaskInfo = new TestRunningTaskInfoBuilder().build(); diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageTaskListenerTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageTaskListenerTests.java index 8b5cb97505c0..b7b7d0d35bcf 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageTaskListenerTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageTaskListenerTests.java @@ -32,7 +32,6 @@ import static org.mockito.Mockito.verify; import android.app.ActivityManager; import android.os.SystemProperties; import android.view.SurfaceControl; -import android.view.SurfaceSession; import android.window.WindowContainerTransaction; import androidx.test.annotation.UiThreadTest; @@ -82,7 +81,6 @@ public final class StageTaskListenerTests extends ShellTestCase { private WindowContainerTransaction mWct; @Captor private ArgumentCaptor mRunnableCaptor; - private SurfaceSession mSurfaceSession = new SurfaceSession(); private SurfaceControl mSurfaceControl; private ActivityManager.RunningTaskInfo mRootTask; private StageTaskListener mStageTaskListener; @@ -97,12 +95,11 @@ public final class StageTaskListenerTests extends ShellTestCase { DEFAULT_DISPLAY, mCallbacks, mSyncQueue, - mSurfaceSession, mIconProvider, Optional.of(mWindowDecorViewModel)); mRootTask = new TestRunningTaskInfoBuilder().build(); mRootTask.parentTaskId = INVALID_TASK_ID; - mSurfaceControl = new SurfaceControl.Builder(mSurfaceSession).setName("test").build(); + mSurfaceControl = new SurfaceControl.Builder().setName("test").build(); mStageTaskListener.onTaskAppeared(mRootTask, mSurfaceControl); } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/taskview/TaskViewTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/taskview/TaskViewTest.java index 198488582700..17fd95b69dba 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/taskview/TaskViewTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/taskview/TaskViewTest.java @@ -49,7 +49,6 @@ import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.SurfaceControl; import android.view.SurfaceHolder; -import android.view.SurfaceSession; import android.view.ViewTreeObserver; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; @@ -95,7 +94,6 @@ public class TaskViewTest extends ShellTestCase { Looper mViewLooper; TestHandler mViewHandler; - SurfaceSession mSession; SurfaceControl mLeash; Context mContext; @@ -106,7 +104,7 @@ public class TaskViewTest extends ShellTestCase { @Before public void setUp() { MockitoAnnotations.initMocks(this); - mLeash = new SurfaceControl.Builder(mSession) + mLeash = new SurfaceControl.Builder() .setName("test") .build(); diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/ResizeVeilTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/ResizeVeilTest.kt index a07be79579eb..e0d16aab1e07 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/ResizeVeilTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/ResizeVeilTest.kt @@ -97,7 +97,7 @@ class ResizeVeilTest : ShellTestCase() { .thenReturn(spyResizeVeilSurfaceBuilder) doReturn(mockResizeVeilSurface).whenever(spyResizeVeilSurfaceBuilder).build() whenever(mockSurfaceControlBuilderFactory - .create(eq("Resize veil background of Task=" + taskInfo.taskId), any())) + .create(eq("Resize veil background of Task=" + taskInfo.taskId))) .thenReturn(spyBackgroundSurfaceBuilder) doReturn(mockBackgroundSurface).whenever(spyBackgroundSurfaceBuilder).build() whenever(mockSurfaceControlBuilderFactory -- GitLab From c55c616ca8debe624d0f83bde28a8bbc2c5efffb Mon Sep 17 00:00:00 2001 From: Lei Li Date: Mon, 9 Sep 2024 10:56:43 +0800 Subject: [PATCH 091/492] memory leak: Closes leaked instance android.content.pm.PackageManager.java switches to using PackageParser2 to parse apk file. And PackageParser2 holds ThreadLocal instances named mSharedAppInfo and mSharedResult. Those ThreadLocals have to be released by calling PackageParser2.close(), or it will cause memory leaks of Activities. Change-Id: Ic04c8b39e565eb462d9edd984468f9aed7749095 Signed-off-by: Lei Li --- core/java/android/content/pm/PackageManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 282ede385ba3..65ab379b182b 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -8847,6 +8847,8 @@ public abstract class PackageManager { } catch (PackageParserException e) { Log.w(TAG, "Failure to parse package archive apkFile= " +apkFile); return null; + } finally { + parser2.close(); } } -- GitLab From 7ce086295893453b5de5ecdcb3c114dfdb43af93 Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Mon, 9 Sep 2024 13:05:29 +0800 Subject: [PATCH 092/492] Import SettingsLib/Preference library Bug: 332201912 Flag: NONE Import library Test: N/A Change-Id: I88dec4dd08ecda9361983db75b88cd3fc4a6675b --- packages/SettingsLib/Preference/Android.bp | 23 ++ .../Preference/AndroidManifest.xml | 6 + .../preference/PreferenceBinding.kt | 118 +++++++++++ .../preference/PreferenceBindingFactory.kt | 49 +++++ .../preference/PreferenceBindings.kt | 86 ++++++++ .../preference/PreferenceDataStoreAdapter.kt | 60 ++++++ .../preference/PreferenceFragment.kt | 109 ++++++++++ .../preference/PreferenceHierarchyInflater.kt | 55 +++++ .../PreferenceScreenBindingHelper.kt | 200 ++++++++++++++++++ .../preference/PreferenceScreenFactory.kt | 106 ++++++++++ .../preference/PreferenceScreenProvider.kt | 39 ++++ 11 files changed, 851 insertions(+) create mode 100644 packages/SettingsLib/Preference/Android.bp create mode 100644 packages/SettingsLib/Preference/AndroidManifest.xml create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBinding.kt create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBindingFactory.kt create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBindings.kt create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceDataStoreAdapter.kt create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceFragment.kt create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceHierarchyInflater.kt create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenBindingHelper.kt create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenFactory.kt create mode 100644 packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenProvider.kt diff --git a/packages/SettingsLib/Preference/Android.bp b/packages/SettingsLib/Preference/Android.bp new file mode 100644 index 000000000000..9665dbd17e2d --- /dev/null +++ b/packages/SettingsLib/Preference/Android.bp @@ -0,0 +1,23 @@ +package { + default_applicable_licenses: ["frameworks_base_license"], +} + +filegroup { + name: "SettingsLibPreference-srcs", + srcs: ["src/**/*.kt"], +} + +android_library { + name: "SettingsLibPreference", + defaults: [ + "SettingsLintDefaults", + ], + srcs: [":SettingsLibPreference-srcs"], + static_libs: [ + "SettingsLibDataStore", + "SettingsLibMetadata", + "androidx.annotation_annotation", + "androidx.preference_preference", + ], + kotlincflags: ["-Xjvm-default=all"], +} diff --git a/packages/SettingsLib/Preference/AndroidManifest.xml b/packages/SettingsLib/Preference/AndroidManifest.xml new file mode 100644 index 000000000000..2d7f7ba5ec40 --- /dev/null +++ b/packages/SettingsLib/Preference/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBinding.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBinding.kt new file mode 100644 index 000000000000..9be0e7194859 --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBinding.kt @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import android.content.Context +import androidx.preference.DialogPreference +import androidx.preference.ListPreference +import androidx.preference.Preference +import androidx.preference.PreferenceScreen +import androidx.preference.SeekBarPreference +import com.android.settingslib.metadata.DiscreteIntValue +import com.android.settingslib.metadata.DiscreteValue +import com.android.settingslib.metadata.PreferenceAvailabilityProvider +import com.android.settingslib.metadata.PreferenceMetadata +import com.android.settingslib.metadata.PreferenceScreenMetadata +import com.android.settingslib.metadata.RangeValue + +/** Binding of preference widget and preference metadata. */ +interface PreferenceBinding { + + /** + * Provides a new [Preference] widget instance. + * + * By default, it returns a new [Preference] object. Subclass could override this method to + * provide customized widget and do **one-off** initialization (e.g. + * [Preference.setOnPreferenceClickListener]). To update widget everytime when state is changed, + * override the [bind] method. + * + * Notes: + * - DO NOT set any properties defined in [PreferenceMetadata]. For example, + * title/summary/icon/extras/isEnabled/isVisible/isPersistent/dependency. These properties + * will be reset by [bind]. + * - Override [bind] if needed to provide more information for customized widget. + */ + fun createWidget(context: Context): Preference = Preference(context) + + /** + * Binds preference widget with given metadata. + * + * Whenever metadata state is changed, this callback is invoked to update widget. By default, + * the common states like title, summary, enabled, etc. are already applied. Subclass should + * override this method to bind more data (e.g. read preference value from storage and apply it + * to widget). + * + * @param preference preference widget created by [createWidget] + * @param metadata metadata to apply + */ + fun bind(preference: Preference, metadata: PreferenceMetadata) { + metadata.apply { + preference.key = key + if (icon != 0) { + preference.setIcon(icon) + } else { + preference.icon = null + } + val context = preference.context + preference.peekExtras()?.clear() + extras(context)?.let { preference.extras.putAll(it) } + preference.title = getPreferenceTitle(context) + preference.summary = getPreferenceSummary(context) + preference.isEnabled = isEnabled(context) + preference.isVisible = + (this as? PreferenceAvailabilityProvider)?.isAvailable(context) != false + preference.isPersistent = isPersistent(context) + metadata.order(context)?.let { preference.order = it } + // PreferenceRegistry will notify dependency change, so we do not need to set + // dependency here. This simplifies dependency management and avoid the + // IllegalStateException when call Preference.setDependency + preference.dependency = null + if (preference !is PreferenceScreen) { // avoid recursive loop when build graph + preference.fragment = (this as? PreferenceScreenCreator)?.fragmentClass()?.name + preference.intent = intent(context) + } + if (preference is DialogPreference) { + preference.dialogTitle = preference.title + } + if (preference is ListPreference && this is DiscreteValue<*>) { + preference.setEntries(valuesDescription) + if (this is DiscreteIntValue) { + val intValues = context.resources.getIntArray(values) + preference.entryValues = Array(intValues.size) { intValues[it].toString() } + } else { + preference.setEntryValues(values) + } + } else if (preference is SeekBarPreference && this is RangeValue) { + preference.min = minValue + preference.max = maxValue + preference.seekBarIncrement = incrementStep + } + } + } +} + +/** Abstract preference screen to provide preference hierarchy and binding factory. */ +interface PreferenceScreenCreator : PreferenceScreenMetadata, PreferenceScreenProvider { + + val preferenceBindingFactory: PreferenceBindingFactory + get() = DefaultPreferenceBindingFactory + + override fun createPreferenceScreen(factory: PreferenceScreenFactory) = + factory.getOrCreatePreferenceScreen().apply { + inflatePreferenceHierarchy(preferenceBindingFactory, getPreferenceHierarchy(context)) + } +} diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBindingFactory.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBindingFactory.kt new file mode 100644 index 000000000000..4c2e1ba683f6 --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBindingFactory.kt @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import com.android.settingslib.metadata.PreferenceGroup +import com.android.settingslib.metadata.PreferenceMetadata +import com.android.settingslib.metadata.SwitchPreference + +/** Factory to map [PreferenceMetadata] to [PreferenceBinding]. */ +interface PreferenceBindingFactory { + + /** Returns the [PreferenceBinding] associated with the [PreferenceMetadata]. */ + fun getPreferenceBinding(metadata: PreferenceMetadata): PreferenceBinding? +} + +/** Default [PreferenceBindingFactory]. */ +object DefaultPreferenceBindingFactory : PreferenceBindingFactory { + + override fun getPreferenceBinding(metadata: PreferenceMetadata) = + metadata as? PreferenceBinding + ?: when (metadata) { + is SwitchPreference -> SwitchPreferenceBinding.INSTANCE + is PreferenceGroup -> PreferenceGroupBinding.INSTANCE + is PreferenceScreenCreator -> PreferenceScreenBinding.INSTANCE + else -> DefaultPreferenceBinding + } +} + +/** A preference key based binding factory. */ +class KeyedPreferenceBindingFactory(private val bindings: Map) : + PreferenceBindingFactory { + + override fun getPreferenceBinding(metadata: PreferenceMetadata) = + bindings[metadata.key] ?: DefaultPreferenceBindingFactory.getPreferenceBinding(metadata) +} diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBindings.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBindings.kt new file mode 100644 index 000000000000..ede970e42e72 --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceBindings.kt @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import android.content.Context +import androidx.preference.Preference +import androidx.preference.PreferenceCategory +import androidx.preference.PreferenceScreen +import androidx.preference.SwitchPreferenceCompat +import com.android.settingslib.metadata.EXTRA_BINDING_SCREEN_KEY +import com.android.settingslib.metadata.PersistentPreference +import com.android.settingslib.metadata.PreferenceMetadata +import com.android.settingslib.metadata.PreferenceScreenMetadata +import com.android.settingslib.metadata.PreferenceTitleProvider + +/** Binding of preference group associated with [PreferenceCategory]. */ +interface PreferenceScreenBinding : PreferenceBinding { + + override fun bind(preference: Preference, metadata: PreferenceMetadata) { + super.bind(preference, metadata) + val context = preference.context + val screenMetadata = metadata as PreferenceScreenMetadata + // Pass the preference key to fragment, so that the fragment could find associated + // preference screen registered in PreferenceScreenRegistry + preference.extras.putString(EXTRA_BINDING_SCREEN_KEY, preference.key) + if (preference is PreferenceScreen) { + val screenTitle = screenMetadata.screenTitle + preference.title = + if (screenTitle != 0) { + context.getString(screenTitle) + } else { + screenMetadata.getScreenTitle(context) + ?: (this as? PreferenceTitleProvider)?.getTitle(context) + } + } + } + + companion object { + @JvmStatic val INSTANCE = object : PreferenceScreenBinding {} + } +} + +/** Binding of preference group associated with [PreferenceCategory]. */ +interface PreferenceGroupBinding : PreferenceBinding { + + override fun createWidget(context: Context) = PreferenceCategory(context) + + companion object { + @JvmStatic val INSTANCE = object : PreferenceGroupBinding {} + } +} + +/** A boolean value type preference associated with [SwitchPreferenceCompat]. */ +interface SwitchPreferenceBinding : PreferenceBinding { + + override fun createWidget(context: Context): Preference = SwitchPreferenceCompat(context) + + override fun bind(preference: Preference, metadata: PreferenceMetadata) { + super.bind(preference, metadata) + (metadata as? PersistentPreference<*>) + ?.storage(preference.context) + ?.getValue(metadata.key, Boolean::class.javaObjectType) + ?.let { (preference as SwitchPreferenceCompat).isChecked = it } + } + + companion object { + @JvmStatic val INSTANCE = object : SwitchPreferenceBinding {} + } +} + +/** Default [PreferenceBinding] for [Preference]. */ +object DefaultPreferenceBinding : PreferenceBinding diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceDataStoreAdapter.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceDataStoreAdapter.kt new file mode 100644 index 000000000000..02acfca6f149 --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceDataStoreAdapter.kt @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import androidx.preference.PreferenceDataStore +import com.android.settingslib.datastore.KeyValueStore + +/** Adapter to translate [KeyValueStore] into [PreferenceDataStore]. */ +class PreferenceDataStoreAdapter(private val keyValueStore: KeyValueStore) : PreferenceDataStore() { + + override fun getBoolean(key: String, defValue: Boolean): Boolean = + keyValueStore.getValue(key, Boolean::class.javaObjectType) ?: defValue + + override fun getFloat(key: String, defValue: Float): Float = + keyValueStore.getValue(key, Float::class.javaObjectType) ?: defValue + + override fun getInt(key: String, defValue: Int): Int = + keyValueStore.getValue(key, Int::class.javaObjectType) ?: defValue + + override fun getLong(key: String, defValue: Long): Long = + keyValueStore.getValue(key, Long::class.javaObjectType) ?: defValue + + override fun getString(key: String, defValue: String?): String? = + keyValueStore.getValue(key, String::class.javaObjectType) ?: defValue + + override fun getStringSet(key: String, defValues: Set?): Set? = + (keyValueStore.getValue(key, Set::class.javaObjectType) as Set?) ?: defValues + + override fun putBoolean(key: String, value: Boolean) = + keyValueStore.setValue(key, Boolean::class.javaObjectType, value) + + override fun putFloat(key: String, value: Float) = + keyValueStore.setValue(key, Float::class.javaObjectType, value) + + override fun putInt(key: String, value: Int) = + keyValueStore.setValue(key, Int::class.javaObjectType, value) + + override fun putLong(key: String, value: Long) = + keyValueStore.setValue(key, Long::class.javaObjectType, value) + + override fun putString(key: String, value: String?) = + keyValueStore.setValue(key, String::class.javaObjectType, value) + + override fun putStringSet(key: String, values: Set?) = + keyValueStore.setValue(key, Set::class.javaObjectType, values) +} diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceFragment.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceFragment.kt new file mode 100644 index 000000000000..207200998b05 --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceFragment.kt @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import android.content.Context +import android.os.Bundle +import androidx.annotation.XmlRes +import androidx.preference.PreferenceFragmentCompat +import androidx.preference.PreferenceScreen +import com.android.settingslib.metadata.EXTRA_BINDING_SCREEN_KEY +import com.android.settingslib.metadata.PreferenceScreenBindingKeyProvider +import com.android.settingslib.metadata.PreferenceScreenRegistry +import com.android.settingslib.preference.PreferenceScreenBindingHelper.Companion.bindRecursively + +/** Fragment to display a preference screen. */ +open class PreferenceFragment : + PreferenceFragmentCompat(), PreferenceScreenProvider, PreferenceScreenBindingKeyProvider { + + private var preferenceScreenBindingHelper: PreferenceScreenBindingHelper? = null + + override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { + preferenceScreen = createPreferenceScreen() + } + + fun createPreferenceScreen(): PreferenceScreen? = + createPreferenceScreen(PreferenceScreenFactory(this)) + + override fun createPreferenceScreen(factory: PreferenceScreenFactory): PreferenceScreen? { + val context = factory.context + fun createPreferenceScreenFromResource() = + factory.inflate(getPreferenceScreenResId(context)) + + if (!usePreferenceScreenMetadata()) return createPreferenceScreenFromResource() + + val screenKey = getPreferenceScreenBindingKey(context) + val screenCreator = + (PreferenceScreenRegistry[screenKey] as? PreferenceScreenCreator) + ?: return createPreferenceScreenFromResource() + + val preferenceBindingFactory = screenCreator.preferenceBindingFactory + val preferenceHierarchy = screenCreator.getPreferenceHierarchy(context) + val preferenceScreen = + if (screenCreator.hasCompleteHierarchy()) { + factory.getOrCreatePreferenceScreen().apply { + inflatePreferenceHierarchy(preferenceBindingFactory, preferenceHierarchy) + } + } else { + createPreferenceScreenFromResource()?.also { + bindRecursively(it, preferenceBindingFactory, preferenceHierarchy) + } ?: return null + } + preferenceScreenBindingHelper = + PreferenceScreenBindingHelper( + context, + preferenceBindingFactory, + preferenceScreen, + preferenceHierarchy, + ) + return preferenceScreen + } + + /** + * Returns if preference screen metadata can be used to set up preference screen. + * + * This is for flagging purpose. If false (e.g. flag is disabled), xml resource is used to build + * preference screen. + */ + protected open fun usePreferenceScreenMetadata(): Boolean = true + + /** Returns the xml resource to create preference screen. */ + @XmlRes protected open fun getPreferenceScreenResId(context: Context): Int = 0 + + override fun getPreferenceScreenBindingKey(context: Context): String? = + arguments?.getString(EXTRA_BINDING_SCREEN_KEY) + + override fun onDestroy() { + preferenceScreenBindingHelper?.close() + super.onDestroy() + } + + companion object { + /** Returns [PreferenceFragment] instance to display the preference screen of given key. */ + fun of(screenKey: String): PreferenceFragment? { + val screenMetadata = PreferenceScreenRegistry[screenKey] ?: return null + if ( + screenMetadata is PreferenceScreenCreator && screenMetadata.hasCompleteHierarchy() + ) { + return PreferenceFragment().apply { + arguments = Bundle().apply { putString(EXTRA_BINDING_SCREEN_KEY, screenKey) } + } + } + return null + } + } +} diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceHierarchyInflater.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceHierarchyInflater.kt new file mode 100644 index 000000000000..5ef7823a4745 --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceHierarchyInflater.kt @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import androidx.preference.PreferenceDataStore +import androidx.preference.PreferenceGroup +import com.android.settingslib.datastore.KeyValueStore +import com.android.settingslib.metadata.PersistentPreference +import com.android.settingslib.metadata.PreferenceHierarchy +import com.android.settingslib.metadata.PreferenceMetadata + +/** Inflates [PreferenceHierarchy] into given [PreferenceGroup] recursively. */ +fun PreferenceGroup.inflatePreferenceHierarchy( + preferenceBindingFactory: PreferenceBindingFactory, + hierarchy: PreferenceHierarchy, + storages: MutableMap = mutableMapOf(), +) { + fun PreferenceMetadata.preferenceBinding() = preferenceBindingFactory.getPreferenceBinding(this) + + hierarchy.metadata.let { it.preferenceBinding()?.bind(this, it) } + hierarchy.forEach { + val metadata = it.metadata + val preferenceBinding = metadata.preferenceBinding() ?: return@forEach + val widget = preferenceBinding.createWidget(context) + if (it is PreferenceHierarchy) { + val preferenceGroup = widget as PreferenceGroup + // MUST add preference before binding, otherwise exception is raised when add child + addPreference(preferenceGroup) + preferenceGroup.inflatePreferenceHierarchy(preferenceBindingFactory, it) + } else { + preferenceBinding.bind(widget, metadata) + (metadata as? PersistentPreference<*>)?.storage(context)?.let { storage -> + widget.preferenceDataStore = + storages.getOrPut(storage) { PreferenceDataStoreAdapter(storage) } + } + // MUST add preference after binding for persistent preference to get initial value + // (preference key is set within bind method) + addPreference(widget) + } + } +} diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenBindingHelper.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenBindingHelper.kt new file mode 100644 index 000000000000..3610894c3fc0 --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenBindingHelper.kt @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import android.content.Context +import android.os.Handler +import android.os.Looper +import androidx.preference.Preference +import androidx.preference.PreferenceGroup +import androidx.preference.PreferenceScreen +import com.android.settingslib.datastore.KeyedDataObservable +import com.android.settingslib.datastore.KeyedObservable +import com.android.settingslib.datastore.KeyedObserver +import com.android.settingslib.metadata.PersistentPreference +import com.android.settingslib.metadata.PreferenceHierarchy +import com.android.settingslib.metadata.PreferenceLifecycleProvider +import com.android.settingslib.metadata.PreferenceMetadata +import com.android.settingslib.metadata.PreferenceScreenRegistry +import com.google.common.collect.ImmutableMap +import com.google.common.collect.ImmutableMultimap +import java.util.concurrent.Executor + +/** + * Helper to bind preferences on given [preferenceScreen]. + * + * When there is any preference change event detected (e.g. preference value changed, runtime + * states, dependency is updated), this helper class will re-bind [PreferenceMetadata] to update + * widget UI. + */ +class PreferenceScreenBindingHelper( + context: Context, + private val preferenceBindingFactory: PreferenceBindingFactory, + private val preferenceScreen: PreferenceScreen, + preferenceHierarchy: PreferenceHierarchy, +) : KeyedDataObservable(), AutoCloseable { + + private val handler = Handler(Looper.getMainLooper()) + private val executor = + object : Executor { + override fun execute(command: Runnable) { + handler.post(command) + } + } + + private val preferences: ImmutableMap + private val dependencies: ImmutableMultimap + private val storages = mutableSetOf>() + + private val preferenceObserver: KeyedObserver + + private val storageObserver = + KeyedObserver { key, _ -> + if (key != null) { + notifyChange(key, CHANGE_REASON_VALUE) + } + } + + private val stateObserver = + object : PreferenceLifecycleProvider.PreferenceStateObserver { + override fun onPreferenceStateChanged(preference: PreferenceMetadata) { + notifyChange(preference.key, CHANGE_REASON_STATE) + } + } + + init { + val preferencesBuilder = ImmutableMap.builder() + val dependenciesBuilder = ImmutableMultimap.builder() + fun PreferenceMetadata.addDependency(dependency: PreferenceMetadata) { + dependenciesBuilder.put(key, dependency.key) + } + + fun PreferenceMetadata.add() { + preferencesBuilder.put(key, this) + dependencyOfEnabledState(context)?.addDependency(this) + if (this is PreferenceLifecycleProvider) onAttach(context, stateObserver) + if (this is PersistentPreference<*>) storages.add(storage(context)) + } + + fun PreferenceHierarchy.addPreferences() { + metadata.add() + forEach { + if (it is PreferenceHierarchy) { + it.addPreferences() + } else { + it.metadata.add() + } + } + } + + preferenceHierarchy.addPreferences() + this.preferences = preferencesBuilder.buildOrThrow() + this.dependencies = dependenciesBuilder.build() + + preferenceObserver = KeyedObserver { key, reason -> onPreferenceChange(key, reason) } + addObserver(preferenceObserver, executor) + for (storage in storages) storage.addObserver(storageObserver, executor) + } + + private fun onPreferenceChange(key: String?, reason: Int) { + if (key == null) return + + // bind preference to update UI + preferenceScreen.findPreference(key)?.let { + preferenceBindingFactory.bind(it, preferences[key]) + } + + // check reason to avoid potential infinite loop + if (reason != CHANGE_REASON_DEPENDENT) { + notifyDependents(key, mutableSetOf()) + } + } + + /** Notifies dependents recursively. */ + private fun notifyDependents(key: String, notifiedKeys: MutableSet) { + if (!notifiedKeys.add(key)) return + for (dependency in dependencies[key]) { + notifyChange(dependency, CHANGE_REASON_DEPENDENT) + notifyDependents(dependency, notifiedKeys) + } + } + + override fun close() { + removeObserver(preferenceObserver) + val context = preferenceScreen.context + for (preference in preferences.values) { + if (preference is PreferenceLifecycleProvider) preference.onDetach(context) + } + for (storage in storages) storage.removeObserver(storageObserver) + } + + companion object { + /** Preference value is changed. */ + private const val CHANGE_REASON_VALUE = 0 + /** Preference state (title/summary, enable state, etc.) is changed. */ + private const val CHANGE_REASON_STATE = 1 + /** Dependent preference state is changed. */ + private const val CHANGE_REASON_DEPENDENT = 2 + + /** Updates preference screen that has incomplete hierarchy. */ + @JvmStatic + fun bind(preferenceScreen: PreferenceScreen) { + PreferenceScreenRegistry[preferenceScreen.key]?.run { + if (!hasCompleteHierarchy()) { + val preferenceBindingFactory = + (this as? PreferenceScreenCreator)?.preferenceBindingFactory ?: return + bindRecursively( + preferenceScreen, + preferenceBindingFactory, + getPreferenceHierarchy(preferenceScreen.context), + ) + } + } + } + + internal fun bindRecursively( + preferenceScreen: PreferenceScreen, + preferenceBindingFactory: PreferenceBindingFactory, + preferenceHierarchy: PreferenceHierarchy, + ) = + preferenceScreen.bindRecursively( + preferenceBindingFactory, + preferenceHierarchy.getAllPreferences().associateBy { it.key }, + ) + + private fun PreferenceGroup.bindRecursively( + preferenceBindingFactory: PreferenceBindingFactory, + preferences: Map, + ) { + preferenceBindingFactory.bind(this, preferences[key]) + val count = preferenceCount + for (index in 0 until count) { + val preference = getPreference(index) + if (preference is PreferenceGroup) { + preference.bindRecursively(preferenceBindingFactory, preferences) + } else { + preferenceBindingFactory.bind(preference, preferences[preference.key]) + } + } + } + + private fun PreferenceBindingFactory.bind( + preference: Preference, + metadata: PreferenceMetadata?, + ) = metadata?.let { getPreferenceBinding(it)?.bind(preference, it) } + } +} diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenFactory.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenFactory.kt new file mode 100644 index 000000000000..7f99d7a9bbdd --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenFactory.kt @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import android.content.Context +import androidx.preference.Preference +import androidx.preference.PreferenceFragmentCompat +import androidx.preference.PreferenceManager +import androidx.preference.PreferenceScreen +import com.android.settingslib.metadata.PreferenceScreenRegistry + +/** Factory to create preference screen. */ +class PreferenceScreenFactory { + /** Preference manager to create/inflate preference screen. */ + val preferenceManager: PreferenceManager + + /** + * Optional existing hierarchy to merge the new hierarchies into. + * + * Provide existing hierarchy will preserve the internal state (e.g. scrollbar position) for + * [PreferenceFragmentCompat]. + */ + private val rootScreen: PreferenceScreen? + + /** + * Factory constructor from preference fragment. + * + * The fragment must be within a valid lifecycle. + */ + constructor(preferenceFragment: PreferenceFragmentCompat) { + preferenceManager = preferenceFragment.preferenceManager + rootScreen = preferenceFragment.preferenceScreen + } + + /** Factory constructor from [Context]. */ + constructor(context: Context) : this(PreferenceManager(context)) + + /** Factory constructor from [PreferenceManager]. */ + constructor(preferenceManager: PreferenceManager) { + this.preferenceManager = preferenceManager + rootScreen = null + } + + /** Context of the factory to create preference screen. */ + val context: Context + get() = preferenceManager.context + + /** Returns the existing hierarchy or create a new empty preference screen. */ + fun getOrCreatePreferenceScreen(): PreferenceScreen = + rootScreen ?: preferenceManager.createPreferenceScreen(context) + + /** + * Inflates [PreferenceScreen] from xml resource. + * + * @param xmlRes The resource ID of the XML to inflate + * @return The root hierarchy (if one was not provided, the new hierarchy's root) + */ + fun inflate(xmlRes: Int): PreferenceScreen? = + if (xmlRes != 0) { + preferenceManager.inflateFromResource(preferenceManager.context, xmlRes, rootScreen) + } else { + rootScreen + } + + /** + * Creates [PreferenceScreen] of given key. + * + * The screen must be registered in [PreferenceScreenFactory] and provide a complete hierarchy. + */ + fun createBindingScreen(screenKey: String?): PreferenceScreen? { + val metadata = PreferenceScreenRegistry[screenKey] ?: return null + if (metadata is PreferenceScreenCreator && metadata.hasCompleteHierarchy()) { + return metadata.createPreferenceScreen(this) + } + return null + } + + companion object { + /** Creates [PreferenceScreen] from [PreferenceScreenRegistry]. */ + @JvmStatic + fun createBindingScreen(preference: Preference): PreferenceScreen? { + val preferenceScreenCreator = + (PreferenceScreenRegistry[preference.key] as? PreferenceScreenCreator) + ?: return null + if (!preferenceScreenCreator.hasCompleteHierarchy()) return null + val factory = PreferenceScreenFactory(preference.context) + val preferenceScreen = preferenceScreenCreator.createPreferenceScreen(factory) + factory.preferenceManager.setPreferences(preferenceScreen) + return preferenceScreen + } + } +} diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenProvider.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenProvider.kt new file mode 100644 index 000000000000..057329293796 --- /dev/null +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenProvider.kt @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settingslib.preference + +import android.content.Context +import androidx.preference.PreferenceScreen + +/** + * Interface to provide [PreferenceScreen]. + * + * When implemented by Activity/Fragment, the Activity/Fragment [Context] APIs (e.g. `getContext()`, + * `getActivity()`) MUST not be used: preference screen creation could happen in background service, + * where the Activity/Fragment lifecycle callbacks (`onCreate`, `onDestroy`, etc.) are not invoked + * and context APIs return null. + */ +interface PreferenceScreenProvider { + + /** + * Creates [PreferenceScreen]. + * + * Preference screen creation could happen in background service. The implementation MUST use + * [PreferenceScreenFactory.context] to obtain context. + */ + fun createPreferenceScreen(factory: PreferenceScreenFactory): PreferenceScreen? +} -- GitLab From 0469ca8398efc93397e3989f01c1fa14e7227cdc Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Sun, 8 Sep 2024 12:05:04 -0700 Subject: [PATCH 093/492] Pipe appTransition signal to taskbar to pause region sampling when it's ongoing For nav bar, RegionSamplingHelper calls LightTransitionsController#setIconsDark to apply color changes, which listens to mTransitionPending signal. For taskbar, due to the RegionSamplingHelper in Launcher and LightTransitionsController in SysUI, we need to pipe this signal (mTransitionPending) through. Bug: 361593564 Test: https://android-build.corp.google.com/builds/abtd/run/L78300030006280283 Flag: EXEMPT bugfix Change-Id: I4a3607ddc6c92ee1bee6464d121024582aa70870 --- .../shared/recents/IOverviewProxy.aidl | 5 ++++ .../navigationbar/TaskbarDelegate.java | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl index c00007b55482..283e4556d05c 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl @@ -132,4 +132,9 @@ oneway interface IOverviewProxy { * Sent when {@link TaskbarDelegate#transitionTo} is called. */ void transitionTo(int barMode, boolean animate) = 33; + + /** + * Sent when {@link TaskbarDelegate#appTransitionPending} is called. + */ + void appTransitionPending(boolean pending) = 34; } diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java index e44069f78ee3..b3c697e06a92 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java @@ -425,6 +425,18 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, } } + private void appTransitionPending(boolean pending) { + if (mOverviewProxyService.getProxy() == null) { + return; + } + + try { + mOverviewProxyService.getProxy().appTransitionPending(pending); + } catch (RemoteException e) { + Log.e(TAG, "appTransitionPending() failed, pending: " + pending, e); + } + } + @Override public void setImeWindowStatus(int displayId, @ImeWindowVisibility int vis, @BackDispositionMode int backDisposition, boolean showImeSwitcher) { @@ -533,6 +545,21 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, } } + @Override + public void appTransitionPending(int displayId, boolean forced) { + appTransitionPending(true); + } + + @Override + public void appTransitionCancelled(int displayId) { + appTransitionPending(false); + } + + @Override + public void appTransitionFinished(int displayId) { + appTransitionPending(false); + } + private void clearTransient() { if (mTaskbarTransientShowing) { mTaskbarTransientShowing = false; -- GitLab From f52cdce1aca3e1eb6c64605affa1a328a3929aed Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 9 Sep 2024 15:03:24 +0800 Subject: [PATCH 094/492] Exclude game apps from orientation experiment Game's content are usually orientation specified. Flag: EXEMPT disabled code Test: presubmit Bug: 357141415 Change-Id: Ib10c9ec6b691f0c35548aa936a6079c19da63789 --- services/core/java/com/android/server/wm/ActivityRecord.java | 3 ++- .../java/com/android/server/wm/WindowManagerConstants.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 99747e05e7f0..0be6471f189e 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -8149,7 +8149,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ @Override protected int getOverrideOrientation() { - if (mWmService.mConstants.mIgnoreActivityOrientationRequest) { + if (mWmService.mConstants.mIgnoreActivityOrientationRequest + && info.applicationInfo.category != ApplicationInfo.CATEGORY_GAME) { return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; } return mAppCompatController.getOrientationPolicy() diff --git a/services/core/java/com/android/server/wm/WindowManagerConstants.java b/services/core/java/com/android/server/wm/WindowManagerConstants.java index 47c42f4292f1..e0f24d8bf447 100644 --- a/services/core/java/com/android/server/wm/WindowManagerConstants.java +++ b/services/core/java/com/android/server/wm/WindowManagerConstants.java @@ -34,7 +34,7 @@ import java.util.concurrent.Executor; */ final class WindowManagerConstants { - /** The orientation of activity will be always "unspecified". */ + /** The orientation of activity will be always "unspecified" except for game apps. */ private static final String KEY_IGNORE_ACTIVITY_ORIENTATION_REQUEST = "ignore_activity_orientation_request"; -- GitLab From 1cd3dae3d2e1cd5490e8d4da413842dc67d99a86 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Fri, 6 Sep 2024 10:09:17 +0000 Subject: [PATCH 095/492] Clean up some dead code. The close transition only be create in startPostCommitAnimation, so it won't happen before startSystemAnimation. Also once the timeout happen, shell will ask core to cancel the animation, so there won't have "transition before animation" case. Bug: 347168362 Flag: com.android.window.flags.migrate_predictive_back_transition Test: atest BackAnimationControllerTest Change-Id: Ice26762bd0c7eb8a7cdf5d6b010abdd9c1030d95 --- .../shell/back/BackAnimationController.java | 47 +++++-------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java index 7b3b2071ef02..156399499c5b 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java @@ -982,7 +982,6 @@ public class BackAnimationController implements RemoteCallable { - mBackTransitionHandler.consumeQueuedTransitionIfNeeded(); if (!mShellBackAnimationRegistry.cancel( mBackNavigationInfo != null ? mBackNavigationInfo.getType() @@ -1160,8 +1156,6 @@ public class BackAnimationController implements RemoteCallable { -- GitLab From e4e8f22cc838744b45b47d8752c9d421051148de Mon Sep 17 00:00:00 2001 From: Gustav Sennton Date: Mon, 9 Sep 2024 08:14:03 +0000 Subject: [PATCH 096/492] Ignore test base class MaximizeAppWindow The test base class scenarios/MaximizeAppWindow.kt takes several constructor parameters so cannot be run as a test by BlockJUnit4ClassRunner. Bug: 364595323 Test: atest frameworks/base/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/* Flag: com.android.window.flags.enable_desktop_windowing_mode Change-Id: I7d88709e7fe4eff43b3d6590fb7aab93968a39de --- .../android/wm/shell/scenarios/MaximizeAppWindow.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/MaximizeAppWindow.kt b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/MaximizeAppWindow.kt index 426f40b5e81b..a54d497bf511 100644 --- a/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/MaximizeAppWindow.kt +++ b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/MaximizeAppWindow.kt @@ -17,7 +17,6 @@ package com.android.wm.shell.scenarios import android.app.Instrumentation -import android.platform.test.annotations.Postsubmit import android.tools.NavBar import android.tools.Rotation import android.tools.flicker.rules.ChangeDisplayOrientationRule @@ -33,15 +32,12 @@ import com.android.wm.shell.Utils import org.junit.After import org.junit.Assume import org.junit.Before +import org.junit.Ignore import org.junit.Rule import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.BlockJUnit4ClassRunner -@RunWith(BlockJUnit4ClassRunner::class) -@Postsubmit -open class MaximizeAppWindow -@JvmOverloads +@Ignore("Test Base Class") +abstract class MaximizeAppWindow constructor(private val rotation: Rotation = Rotation.ROTATION_0, isResizable: Boolean = true) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() -- GitLab From d5908ace20ae7f736e4d6a872302618f7635d63e Mon Sep 17 00:00:00 2001 From: Miguel Aranda Date: Mon, 9 Sep 2024 09:23:13 +0000 Subject: [PATCH 097/492] Temporarily disable Conscrypt perf tests These tests are failing, and I'm waiting for resolution within b/361015659 Change-Id: If8184b9a5d4eddf267dba70a669ec7227452fc0e --- .../src/android/conscrypt/conscrypt/ClientSocketPerfTest.java | 2 +- .../src/android/conscrypt/conscrypt/ServerSocketPerfTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java index f20b1706129b..3577fcdf04d6 100644 --- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java @@ -194,7 +194,7 @@ public final class ClientSocketPerfTest { /** * Simple benchmark for the amount of time to send a given number of messages */ - @Test + // @Test Temporarily disabled @Parameters(method = "getParams") public void time(Config config) throws Exception { reset(); diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java index af3c405eab82..ac5710047db9 100644 --- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java @@ -198,7 +198,7 @@ public final class ServerSocketPerfTest { executor.awaitTermination(5, TimeUnit.SECONDS); } - @Test + // @Test Temporarily disabled @Parameters(method = "getParams") public void throughput(Config config) throws Exception { setup(config); -- GitLab From 13e69db0dbbf5e354fd80082e07814caf88cd9b7 Mon Sep 17 00:00:00 2001 From: Miguel Aranda Date: Mon, 9 Sep 2024 09:39:47 +0000 Subject: [PATCH 098/492] Revert "Migrate libcore benchmarks to BenchmarkRule" This reverts commit e292bf87b548929d4c3fc7740b653962f345239f. Reason for revert: This has been causing failures and is not does not seem compatible with the CB dashboard Change-Id: Iea68da6aae4d5cc4f72b65268e522e22e34b45fe --- .../src/android/libcore/AdditionPerfTest.java | 22 ++-- .../android/libcore/ArrayCopyPerfTest.java | 14 +-- .../libcore/ArrayIterationPerfTest.java | 12 +- .../libcore/ArrayListIterationPerfTest.java | 10 +- .../android/libcore/BigIntegerPerfTest.java | 19 ++- .../libcore/BufferedZipFilePerfTest.java | 12 +- .../libcore/ClassLoaderResourcePerfTest.java | 11 +- .../src/android/libcore/ClonePerfTest.java | 19 ++- .../android/libcore/DeepArrayOpsPerfTest.java | 11 +- .../android/libcore/FieldAccessPerfTest.java | 25 ++-- .../libcore/HashedCollectionsPerfTest.java | 17 ++- .../android/libcore/ImtConflictPerfTest.java | 47 ++++--- .../libcore/MethodInvocationPerfTest.java | 29 +++-- .../libcore/MultiplicationPerfTest.java | 15 ++- .../android/libcore/ReferenceGetPerfTest.java | 13 +- .../android/libcore/ReferencePerfTest.java | 17 ++- .../libcore/SmallBigIntegerPerfTest.java | 10 +- .../libcore/StringDexCachePerfTest.java | 9 +- .../libcore/StringIterationPerfTest.java | 15 ++- .../VirtualVersusInterfacePerfTest.java | 11 +- .../android/libcore/XmlSerializePerfTest.java | 9 +- .../libcore/XmlSerializerPerfTest.java | 14 +-- .../src/android/libcore/ZipFilePerfTest.java | 9 +- .../android/libcore/ZipFileReadPerfTest.java | 9 +- .../regression/AnnotatedElementPerfTest.java | 59 +++++---- .../libcore/regression/BidiPerfTest.java | 20 +-- .../regression/BigIntegerPerfTest.java | 12 +- .../libcore/regression/BitSetPerfTest.java | 20 +-- .../regression/BreakIteratorPerfTest.java | 10 +- .../libcore/regression/BulkPerfTest.java | 8 +- .../regression/ByteBufferPerfTest.java | 70 +++++------ .../ByteBufferScalarVersusVectorPerfTest.java | 12 +- .../libcore/regression/CharacterPerfTest.java | 36 +++--- .../regression/CharsetForNamePerfTest.java | 8 +- .../libcore/regression/CharsetPerfTest.java | 14 +-- .../regression/CharsetUtf8PerfTest.java | 8 +- .../libcore/regression/ChecksumPerfTest.java | 14 +-- .../regression/CipherInputStreamPerfTest.java | 8 +- .../libcore/regression/CipherPerfTest.java | 10 +- .../libcore/regression/CollatorPerfTest.java | 14 +-- .../regression/CollectionsPerfTest.java | 14 +-- .../regression/DateFormatPerfTest.java | 10 +- .../regression/DecimalFormatPerfTest.java | 20 +-- .../DecimalFormatSymbolsPerfTest.java | 8 +- .../regression/DefaultCharsetPerfTest.java | 8 +- .../libcore/regression/DnsPerfTest.java | 8 +- .../regression/DoPrivilegedPerfTest.java | 14 +-- .../libcore/regression/DoublePerfTest.java | 12 +- .../regression/EqualsHashCodePerfTest.java | 12 +- .../regression/ExpensiveObjectsPerfTest.java | 38 +++--- .../libcore/regression/FilePerfTest.java | 10 +- .../libcore/regression/FloatPerfTest.java | 12 +- .../libcore/regression/FormatterPerfTest.java | 32 ++--- .../libcore/regression/IdnPerfTest.java | 10 +- .../IntConstantDivisionPerfTest.java | 22 ++-- .../IntConstantMultiplicationPerfTest.java | 28 ++--- .../IntConstantRemainderPerfTest.java | 20 +-- .../libcore/regression/IntegerPerfTest.java | 22 ++-- .../regression/IntegralToStringPerfTest.java | 54 ++++---- .../regression/KeyPairGeneratorPerfTest.java | 8 +- .../regression/LoopingBackwardsPerfTest.java | 10 +- .../libcore/regression/MathPerfTest.java | 118 +++++++++--------- .../regression/MessageDigestPerfTest.java | 24 ++-- .../regression/MutableIntPerfTest.java | 12 +- .../regression/NumberFormatPerfTest.java | 8 +- ...NumberFormatTrivialFormatLongPerfTest.java | 8 +- .../regression/PriorityQueuePerfTest.java | 8 +- .../regression/PropertyAccessPerfTest.java | 24 ++-- .../libcore/regression/ProviderPerfTest.java | 10 +- .../libcore/regression/RandomPerfTest.java | 14 +-- .../regression/RealToStringPerfTest.java | 40 +++--- .../regression/ReflectionPerfTest.java | 52 ++++---- .../regression/SSLLoopbackPerfTest.java | 8 +- .../regression/SSLSocketFactoryPerfTest.java | 8 +- .../regression/SchemePrefixPerfTest.java | 8 +- .../regression/SerializationPerfTest.java | 12 +- .../libcore/regression/SignaturePerfTest.java | 10 +- .../regression/SimpleDateFormatPerfTest.java | 22 ++-- .../regression/StrictMathPerfTest.java | 114 ++++++++--------- .../regression/StringBuilderPerfTest.java | 28 ++--- .../regression/StringEqualsPerfTest.java | 22 ++-- .../regression/StringIsEmptyPerfTest.java | 14 +-- .../regression/StringLengthPerfTest.java | 8 +- .../libcore/regression/StringPerfTest.java | 8 +- .../regression/StringReplaceAllPerfTest.java | 12 +- .../regression/StringReplacePerfTest.java | 18 +-- .../regression/StringSplitPerfTest.java | 18 +-- .../regression/StringToBytesPerfTest.java | 12 +- .../regression/StringToRealPerfTest.java | 10 +- .../regression/ThreadLocalPerfTest.java | 8 +- .../libcore/regression/TimeZonePerfTest.java | 18 +-- .../regression/XMLEntitiesPerfTest.java | 10 +- ...eflectGetFieldLittleEndianIntPerfTest.java | 15 +-- ...ectGetFieldLittleEndianStringPerfTest.java | 15 +-- ...GetStaticFieldLittleEndianIntPerfTest.java | 15 +-- ...StaticFieldLittleEndianStringPerfTest.java | 15 +-- ...eflectSetFieldLittleEndianIntPerfTest.java | 15 +-- ...ectSetFieldLittleEndianStringPerfTest.java | 15 +-- ...SetStaticFieldLittleEndianIntPerfTest.java | 15 +-- ...StaticFieldLittleEndianStringPerfTest.java | 15 +-- ...geAcquireFieldLittleEndianIntPerfTest.java | 12 +- ...cquireFieldLittleEndianStringPerfTest.java | 12 +- ...ireStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 15 ++- ...dexchangeFieldLittleEndianIntPerfTest.java | 12 +- ...changeFieldLittleEndianStringPerfTest.java | 12 +- ...geReleaseFieldLittleEndianIntPerfTest.java | 12 +- ...eleaseFieldLittleEndianStringPerfTest.java | 12 +- ...aseStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 15 ++- ...ngeStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 12 +- ...areandsetFieldLittleEndianIntPerfTest.java | 12 +- ...andsetFieldLittleEndianStringPerfTest.java | 12 +- ...setStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 12 +- ...etAcquireFieldLittleEndianIntPerfTest.java | 11 +- ...cquireFieldLittleEndianStringPerfTest.java | 11 +- ...ireStaticFieldLittleEndianIntPerfTest.java | 11 +- ...StaticFieldLittleEndianStringPerfTest.java | 11 +- ...HandleGetArrayLittleEndianIntPerfTest.java | 13 +- ...dleGetArrayLittleEndianStringPerfTest.java | 13 +- ...eGetByteArrayViewBigEndianIntPerfTest.java | 21 ++-- ...tByteArrayViewLittleEndianIntPerfTest.java | 21 ++-- ...HandleGetFieldLittleEndianIntPerfTest.java | 11 +- ...dleGetFieldLittleEndianStringPerfTest.java | 11 +- ...GetOpaqueFieldLittleEndianIntPerfTest.java | 11 +- ...OpaqueFieldLittleEndianStringPerfTest.java | 11 +- ...queStaticFieldLittleEndianIntPerfTest.java | 11 +- ...StaticFieldLittleEndianStringPerfTest.java | 11 +- ...GetStaticFieldLittleEndianIntPerfTest.java | 11 +- ...StaticFieldLittleEndianStringPerfTest.java | 11 +- ...tVolatileFieldLittleEndianIntPerfTest.java | 11 +- ...latileFieldLittleEndianStringPerfTest.java | 11 +- ...ileStaticFieldLittleEndianIntPerfTest.java | 11 +- ...StaticFieldLittleEndianStringPerfTest.java | 11 +- ...AcquireFieldLittleEndianFloatPerfTest.java | 12 +- ...ddAcquireFieldLittleEndianIntPerfTest.java | 12 +- ...eStaticFieldLittleEndianFloatPerfTest.java | 12 +- ...ireStaticFieldLittleEndianIntPerfTest.java | 12 +- ...tandaddFieldLittleEndianFloatPerfTest.java | 12 +- ...GetandaddFieldLittleEndianIntPerfTest.java | 12 +- ...ReleaseFieldLittleEndianFloatPerfTest.java | 12 +- ...ddReleaseFieldLittleEndianIntPerfTest.java | 12 +- ...eStaticFieldLittleEndianFloatPerfTest.java | 12 +- ...aseStaticFieldLittleEndianIntPerfTest.java | 12 +- ...dStaticFieldLittleEndianFloatPerfTest.java | 12 +- ...addStaticFieldLittleEndianIntPerfTest.java | 12 +- ...ndAcquireFieldLittleEndianIntPerfTest.java | 12 +- ...ireStaticFieldLittleEndianIntPerfTest.java | 12 +- ...itwiseAndFieldLittleEndianIntPerfTest.java | 12 +- ...ndReleaseFieldLittleEndianIntPerfTest.java | 12 +- ...aseStaticFieldLittleEndianIntPerfTest.java | 12 +- ...AndStaticFieldLittleEndianIntPerfTest.java | 12 +- ...OrAcquireFieldLittleEndianIntPerfTest.java | 12 +- ...ireStaticFieldLittleEndianIntPerfTest.java | 12 +- ...bitwiseOrFieldLittleEndianIntPerfTest.java | 12 +- ...OrReleaseFieldLittleEndianIntPerfTest.java | 12 +- ...aseStaticFieldLittleEndianIntPerfTest.java | 12 +- ...eOrStaticFieldLittleEndianIntPerfTest.java | 12 +- ...orAcquireFieldLittleEndianIntPerfTest.java | 12 +- ...ireStaticFieldLittleEndianIntPerfTest.java | 12 +- ...itwiseXorFieldLittleEndianIntPerfTest.java | 12 +- ...orReleaseFieldLittleEndianIntPerfTest.java | 12 +- ...aseStaticFieldLittleEndianIntPerfTest.java | 12 +- ...XorStaticFieldLittleEndianIntPerfTest.java | 12 +- ...etAcquireFieldLittleEndianIntPerfTest.java | 12 +- ...cquireFieldLittleEndianStringPerfTest.java | 12 +- ...ireStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 12 +- ...GetandsetFieldLittleEndianIntPerfTest.java | 12 +- ...andsetFieldLittleEndianStringPerfTest.java | 12 +- ...etReleaseFieldLittleEndianIntPerfTest.java | 12 +- ...eleaseFieldLittleEndianStringPerfTest.java | 12 +- ...aseStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 12 +- ...setStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 12 +- ...HandleSetArrayLittleEndianIntPerfTest.java | 13 +- ...dleSetArrayLittleEndianStringPerfTest.java | 13 +- ...eSetByteArrayViewBigEndianIntPerfTest.java | 33 +++-- ...tByteArrayViewLittleEndianIntPerfTest.java | 33 +++-- ...HandleSetFieldLittleEndianIntPerfTest.java | 11 +- ...dleSetFieldLittleEndianStringPerfTest.java | 11 +- ...SetOpaqueFieldLittleEndianIntPerfTest.java | 11 +- ...OpaqueFieldLittleEndianStringPerfTest.java | 11 +- ...queStaticFieldLittleEndianIntPerfTest.java | 11 +- ...StaticFieldLittleEndianStringPerfTest.java | 11 +- ...etReleaseFieldLittleEndianIntPerfTest.java | 11 +- ...eleaseFieldLittleEndianStringPerfTest.java | 11 +- ...aseStaticFieldLittleEndianIntPerfTest.java | 11 +- ...StaticFieldLittleEndianStringPerfTest.java | 11 +- ...SetStaticFieldLittleEndianIntPerfTest.java | 11 +- ...StaticFieldLittleEndianStringPerfTest.java | 11 +- ...tVolatileFieldLittleEndianIntPerfTest.java | 11 +- ...latileFieldLittleEndianStringPerfTest.java | 11 +- ...ileStaticFieldLittleEndianIntPerfTest.java | 11 +- ...StaticFieldLittleEndianStringPerfTest.java | 11 +- ...etAcquireFieldLittleEndianIntPerfTest.java | 12 +- ...cquireFieldLittleEndianStringPerfTest.java | 12 +- ...ireStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 15 ++- ...areandsetFieldLittleEndianIntPerfTest.java | 12 +- ...andsetFieldLittleEndianStringPerfTest.java | 12 +- ...dsetPlainFieldLittleEndianIntPerfTest.java | 12 +- ...tPlainFieldLittleEndianStringPerfTest.java | 12 +- ...ainStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 12 +- ...etReleaseFieldLittleEndianIntPerfTest.java | 12 +- ...eleaseFieldLittleEndianStringPerfTest.java | 12 +- ...aseStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 15 ++- ...setStaticFieldLittleEndianIntPerfTest.java | 12 +- ...StaticFieldLittleEndianStringPerfTest.java | 12 +- .../libcore/varhandles/generate_java.py | 19 +-- 215 files changed, 1541 insertions(+), 1770 deletions(-) diff --git a/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java index 237c747e3a6f..80cd86cf9a5b 100644 --- a/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -34,11 +34,11 @@ import org.junit.runner.RunWith; public class AdditionPerfTest { @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeAddConstantToLocalInt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); int result = 0; while (state.keepRunning()) { result += 123; @@ -46,7 +46,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalInts() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); int result = 0; int constant = 123; while (state.keepRunning()) { @@ -55,7 +55,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalLong() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); long result = 0; while (state.keepRunning()) { result += 123L; @@ -63,7 +63,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalLongs() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); long result = 0; long constant = 123L; while (state.keepRunning()) { @@ -72,7 +72,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalFloat() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); float result = 0.0f; while (state.keepRunning()) { result += 123.0f; @@ -80,7 +80,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalFloats() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); float result = 0.0f; float constant = 123.0f; while (state.keepRunning()) { @@ -89,7 +89,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalDouble() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); double result = 0.0; while (state.keepRunning()) { result += 123.0; @@ -97,7 +97,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalDoubles() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); double result = 0.0; double constant = 123.0; while (state.keepRunning()) { diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java index 1222bc242564..2f6c37832d04 100644 --- a/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -33,11 +33,11 @@ import java.util.Arrays; public class ArrayCopyPerfTest { @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeManualArrayCopy() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = new char[8192]; @@ -49,7 +49,7 @@ public class ArrayCopyPerfTest { @Test public void time_System_arrayCopy() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = new char[8192]; @@ -59,7 +59,7 @@ public class ArrayCopyPerfTest { @Test public void time_Arrays_copyOf() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = Arrays.copyOf(src, 8192); @@ -68,7 +68,7 @@ public class ArrayCopyPerfTest { @Test public void time_Arrays_copyOfRange() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = Arrays.copyOfRange(src, 0, 8192); diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java index 3f95e3e44f84..d17add767257 100644 --- a/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -38,7 +38,7 @@ public class ArrayIterationPerfTest { } @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Foo[] mArray = new Foo[27]; { @@ -46,7 +46,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIteration() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { int sum = 0; for (int i = 0; i < mArray.length; i++) { @@ -56,7 +56,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIterationCached() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { int sum = 0; Foo[] localArray = mArray; @@ -69,7 +69,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIterationForEach() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { int sum = 0; for (Foo a: mArray) { diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java index 1423a13b43dc..3a57db8f323f 100644 --- a/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -39,7 +39,7 @@ public class ArrayListIterationPerfTest { int mSplat; } @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); ArrayList mList = new ArrayList(); { @@ -47,7 +47,7 @@ public class ArrayListIterationPerfTest { } @Test public void timeArrayListIterationIndexed() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { int sum = 0; ArrayList list = mList; @@ -59,7 +59,7 @@ public class ArrayListIterationPerfTest { } @Test public void timeArrayListIterationForEach() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { int sum = 0; for (Foo a : mList) { diff --git a/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java index 02831055ff56..3fb3bc8c0ff2 100644 --- a/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -38,8 +38,7 @@ import java.math.BigInteger; @RunWith(AndroidJUnit4.class) @LargeTest public class BigIntegerPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); // A simple sum of products computation, mostly so we can check timing in the // absence of any division. Computes the sum from 1 to n of ((10^prec) << 30) + 1)^2, @@ -62,7 +61,7 @@ public class BigIntegerPerfTest { // Execute the above rep times, optionally timing it. @Test public void repeatInner() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { inner(100, i); @@ -86,7 +85,7 @@ public class BigIntegerPerfTest { // Check results for equality, and print one, to compaare against reference. @Test public void repeatHarmonic1000() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 5; i <= 5_000; i *= 10) { BigInteger refRes = harmonic1000(i); @@ -107,7 +106,7 @@ public class BigIntegerPerfTest { // us to time and check it for consistency as well. @Test public void repeatToString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 5; i <= 5_000; i *= 10) { BigInteger refRes = harmonic1000(i); @@ -147,7 +146,7 @@ public class BigIntegerPerfTest { // to compare to reference. @Test public void repeatEApprox() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { BigInteger refRes = eApprox(100_000, i); @@ -166,7 +165,7 @@ public class BigIntegerPerfTest { // Test / time modPow() @Test public void repeatModPow() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 5; i <= 500; i *= 10) { BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE); @@ -199,7 +198,7 @@ public class BigIntegerPerfTest { // Test / time modInverse() @Test public void repeatModInverse() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE); diff --git a/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java index 11ca73acd45b..2a1b5d1cc6ce 100644 --- a/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java @@ -16,9 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; - +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -40,8 +39,7 @@ import java.util.zip.ZipOutputStream; @RunWith(AndroidJUnit4.class) @LargeTest public final class BufferedZipFilePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); int[] mReadSize = new int[] {4, 32, 128}; int[] mCompressedSize = new int[] {128, 1024, 8192, 65536}; @@ -69,7 +67,7 @@ public final class BufferedZipFilePerfTest { @Test public void timeUnbufferedRead() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mCompressedSize.length; i++) { for (int j = 0; j < mReadSize.length; j++) { @@ -89,7 +87,7 @@ public final class BufferedZipFilePerfTest { @Test public void timeBufferedRead() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mCompressedSize.length; i++) { for (int j = 0; j < mReadSize.length; j++) { diff --git a/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java index 0abe194b6fdb..5f599ea85eb4 100644 --- a/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -30,8 +30,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class ClassLoaderResourcePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final String EXISTENT_RESOURCE = "java/util/logging/logging.properties"; private static final String MISSING_RESOURCE = "missing_entry"; @@ -41,7 +40,7 @@ public class ClassLoaderResourcePerfTest { ClassLoader currentClassLoader = getClass().getClassLoader(); Assert.assertNotNull(currentClassLoader.getResource(EXISTENT_RESOURCE)); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { currentClassLoader.getResource(EXISTENT_RESOURCE); } @@ -52,7 +51,7 @@ public class ClassLoaderResourcePerfTest { ClassLoader currentClassLoader = getClass().getClassLoader(); Assert.assertNull(currentClassLoader.getResource(MISSING_RESOURCE)); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { currentClassLoader.getResource(MISSING_RESOURCE); } diff --git a/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java index 52441d1d868e..ea249848daad 100644 --- a/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,8 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class ClonePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static class CloneableObject implements Cloneable { public Object clone() throws CloneNotSupportedException { @@ -1128,7 +1127,7 @@ public class ClonePerfTest { public void time_Object_clone() { try { CloneableObject o = new CloneableObject(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { o.clone(); } @@ -1141,7 +1140,7 @@ public class ClonePerfTest { public void time_Object_manyFieldClone() { try { CloneableManyFieldObject o = new CloneableManyFieldObject(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { o.clone(); } @@ -1154,7 +1153,7 @@ public class ClonePerfTest { public void time_Object_deepClone() { try { DeepCloneable o = new DeepCloneable(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { o.clone(); } @@ -1166,7 +1165,7 @@ public class ClonePerfTest { @Test public void time_Array_clone() { int[] o = new int[32]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { o.clone(); } @@ -1178,7 +1177,7 @@ public class ClonePerfTest { for (int i = 0; i < o.length / 2; ++i) { o[i] = new Object(); } - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { o.clone(); } @@ -1190,7 +1189,7 @@ public class ClonePerfTest { for (int i = 0; i < o.length / 2; ++i) { o[i] = new Object(); } - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { o.clone(); } diff --git a/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java index e6c5aca2c330..82247dcee772 100644 --- a/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -36,8 +36,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class DeepArrayOpsPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private Object[] mArray; private Object[] mArray2; @@ -100,7 +99,7 @@ public class DeepArrayOpsPerfTest { @Parameters(method = "getData") public void deepHashCode(int arrayLength) throws Exception { setUp(arrayLength); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Arrays.deepHashCode(mArray); } @@ -110,7 +109,7 @@ public class DeepArrayOpsPerfTest { @Parameters(method = "getData") public void deepEquals(int arrayLength) throws Exception { setUp(arrayLength); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Arrays.deepEquals(mArray, mArray2); } diff --git a/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java b/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java index 378137b417e9..0bebf04c6897 100644 --- a/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -30,8 +30,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class FieldAccessPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static class Inner { public int mPublicInnerIntVal; @@ -48,7 +47,7 @@ public class FieldAccessPerfTest { @Test public void timeField() { int result = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = mIntVal; } @@ -57,7 +56,7 @@ public class FieldAccessPerfTest { @Test public void timeFieldFinal() { int result = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = mFinalIntVal; } @@ -66,7 +65,7 @@ public class FieldAccessPerfTest { @Test public void timeFieldStatic() { int result = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = sStaticIntVal; } @@ -75,7 +74,7 @@ public class FieldAccessPerfTest { @Test public void timeFieldStaticFinal() { int result = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = FINAL_INT_VAL; } @@ -85,7 +84,7 @@ public class FieldAccessPerfTest { public void timeFieldCached() { int result = 0; int cachedIntVal = this.mIntVal; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = cachedIntVal; } @@ -95,7 +94,7 @@ public class FieldAccessPerfTest { public void timeFieldPrivateInnerClassPublicField() { int result = 0; Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = inner.mPublicInnerIntVal; } @@ -105,7 +104,7 @@ public class FieldAccessPerfTest { public void timeFieldPrivateInnerClassProtectedField() { int result = 0; Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = inner.mProtectedInnerIntVal; } @@ -115,7 +114,7 @@ public class FieldAccessPerfTest { public void timeFieldPrivateInnerClassPrivateField() { int result = 0; Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = inner.mPrivateInnerIntVal; } @@ -125,7 +124,7 @@ public class FieldAccessPerfTest { public void timeFieldPrivateInnerClassPackageField() { int result = 0; Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = inner.mPackageInnerIntVal; } diff --git a/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java index 610e8e56c951..55c1027e1add 100644 --- a/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -35,14 +35,13 @@ import java.util.concurrent.ConcurrentHashMap; @RunWith(AndroidJUnit4.class) @LargeTest public class HashedCollectionsPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeHashMapGet() { HashMap map = new HashMap(); map.put("hello", "world"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { map.get("hello"); } @@ -54,7 +53,7 @@ public class HashedCollectionsPerfTest { synchronized (map) { map.put("hello", "world"); } - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { synchronized (map) { map.get("hello"); @@ -66,7 +65,7 @@ public class HashedCollectionsPerfTest { public void timeHashtableGet() { Hashtable map = new Hashtable(); map.put("hello", "world"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { map.get("hello"); } @@ -76,7 +75,7 @@ public class HashedCollectionsPerfTest { public void timeLinkedHashMapGet() { LinkedHashMap map = new LinkedHashMap(); map.put("hello", "world"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { map.get("hello"); } @@ -86,7 +85,7 @@ public class HashedCollectionsPerfTest { public void timeConcurrentHashMapGet() { ConcurrentHashMap map = new ConcurrentHashMap(); map.put("hello", "world"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { map.get("hello"); } diff --git a/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java index 40c07e05bbde..da60a7773528 100644 --- a/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -41,8 +41,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class ImtConflictPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Before public void setup() { @@ -281,7 +280,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth01() { C0 c0 = new C0(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c0); callF0(c0); @@ -309,7 +308,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth02() { C1 c1 = new C1(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c1); callF19(c1); @@ -337,7 +336,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth03() { C2 c2 = new C2(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c2); callF19(c2); @@ -365,7 +364,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth04() { C3 c3 = new C3(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c3); callF19(c3); @@ -393,7 +392,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth05() { C4 c4 = new C4(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c4); callF19(c4); @@ -421,7 +420,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth06() { C5 c5 = new C5(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c5); callF19(c5); @@ -449,7 +448,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth07() { C6 c6 = new C6(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c6); callF19(c6); @@ -477,7 +476,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth08() { C7 c7 = new C7(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c7); callF19(c7); @@ -505,7 +504,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth09() { C8 c8 = new C8(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c8); callF19(c8); @@ -533,7 +532,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth10() { C9 c9 = new C9(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c9); callF19(c9); @@ -561,7 +560,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth11() { C10 c10 = new C10(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c10); callF19(c10); @@ -589,7 +588,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth12() { C11 c11 = new C11(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c11); callF19(c11); @@ -617,7 +616,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth13() { C12 c12 = new C12(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c12); callF19(c12); @@ -645,7 +644,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth14() { C13 c13 = new C13(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c13); callF19(c13); @@ -673,7 +672,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth15() { C14 c14 = new C14(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c14); callF19(c14); @@ -701,7 +700,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth16() { C15 c15 = new C15(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c15); callF19(c15); @@ -729,7 +728,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth17() { C16 c16 = new C16(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c16); callF19(c16); @@ -757,7 +756,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth18() { C17 c17 = new C17(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c17); callF19(c17); @@ -785,7 +784,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth19() { C18 c18 = new C18(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c18); callF19(c18); @@ -813,7 +812,7 @@ public class ImtConflictPerfTest { @Test public void timeConflictDepth20() { C19 c19 = new C19(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { callF0(c19); callF19(c19); diff --git a/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java index e1d0bf2f9491..6d9d0c92ff25 100644 --- a/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -30,8 +30,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class MethodInvocationPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); interface I { void emptyInterface(); @@ -66,12 +65,12 @@ public class MethodInvocationPerfTest { } public void timeInternalGetter() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); new C().timeInternalGetter(state); } public void timeInternalFieldAccess() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); new C().timeInternalFieldAccess(state); } @@ -79,7 +78,7 @@ public class MethodInvocationPerfTest { @Test public void timeStringLength() { int result = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = "hello, world!".length(); } @@ -88,7 +87,7 @@ public class MethodInvocationPerfTest { @Test public void timeEmptyStatic() { C c = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { c.emptyStatic(); } @@ -97,7 +96,7 @@ public class MethodInvocationPerfTest { @Test public void timeEmptyVirtual() { C c = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { c.emptyVirtual(); } @@ -106,7 +105,7 @@ public class MethodInvocationPerfTest { @Test public void timeEmptyInterface() { I c = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { c.emptyInterface(); } @@ -139,7 +138,7 @@ public class MethodInvocationPerfTest { @Test public void timePrivateInnerPublicMethod() { Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { inner.publicMethod(); } @@ -148,7 +147,7 @@ public class MethodInvocationPerfTest { @Test public void timePrivateInnerProtectedMethod() { Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { inner.protectedMethod(); } @@ -157,7 +156,7 @@ public class MethodInvocationPerfTest { @Test public void timePrivateInnerPrivateMethod() { Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { inner.privateMethod(); } @@ -166,7 +165,7 @@ public class MethodInvocationPerfTest { @Test public void timePrivateInnerPackageMethod() { Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { inner.packageMethod(); } @@ -175,7 +174,7 @@ public class MethodInvocationPerfTest { @Test public void timePrivateInnerFinalPackageMethod() { Inner inner = new Inner(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { inner.finalPackageMethod(); } diff --git a/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java index c5e9d1e1d5e4..09b09771e9de 100644 --- a/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -30,13 +30,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class MultiplicationPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeMultiplyIntByConstant10() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 10; } @@ -45,7 +44,7 @@ public class MultiplicationPerfTest { @Test public void timeMultiplyIntByConstant8() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 8; } @@ -55,7 +54,7 @@ public class MultiplicationPerfTest { public void timeMultiplyIntByVariable10() { int result = 1; int factor = 10; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= factor; } @@ -65,7 +64,7 @@ public class MultiplicationPerfTest { public void timeMultiplyIntByVariable8() { int result = 1; int factor = 8; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= factor; } diff --git a/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java index d073f9163f39..ba21ed33bdb2 100644 --- a/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -35,8 +35,7 @@ import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReferenceGetPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); boolean mIntrinsicDisabled; @@ -52,7 +51,7 @@ public class ReferenceGetPerfTest { @Test public void timeSoftReferenceGet() throws Exception { Reference soft = new SoftReference(mObj); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Object o = soft.get(); } @@ -61,7 +60,7 @@ public class ReferenceGetPerfTest { @Test public void timeWeakReferenceGet() throws Exception { Reference weak = new WeakReference(mObj); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Object o = weak.get(); } @@ -72,7 +71,7 @@ public class ReferenceGetPerfTest { Reference weak = new WeakReference(mObj); mObj = null; Runtime.getRuntime().gc(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Object o = weak.get(); } diff --git a/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java index af13773dd177..293752ee5dd1 100644 --- a/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -34,8 +34,7 @@ import java.util.concurrent.atomic.AtomicInteger; @RunWith(AndroidJUnit4.class) @LargeTest public class ReferencePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private Object mObject; @@ -43,7 +42,7 @@ public class ReferencePerfTest { @Test public void timeAlloc() { ReferenceQueue queue = new ReferenceQueue(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new PhantomReference(mObject, queue); } @@ -53,7 +52,7 @@ public class ReferencePerfTest { @Test public void timeAllocAndEnqueue() { ReferenceQueue queue = new ReferenceQueue(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { (new PhantomReference(mObject, queue)).enqueue(); } @@ -63,7 +62,7 @@ public class ReferencePerfTest { @Test public void timeAllocEnqueueAndPoll() { ReferenceQueue queue = new ReferenceQueue(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { (new PhantomReference(mObject, queue)).enqueue(); queue.poll(); @@ -74,7 +73,7 @@ public class ReferencePerfTest { @Test public void timeAllocEnqueueAndRemove() { ReferenceQueue queue = new ReferenceQueue(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { (new PhantomReference(mObject, queue)).enqueue(); try { @@ -103,7 +102,7 @@ public class ReferencePerfTest { // Allocate a bunch of finalizable objects. int n = 0; AtomicInteger count = new AtomicInteger(0); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { n++; new FinalizableObject(count); diff --git a/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java index cf573fa6f250..528b751d1551 100644 --- a/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -41,9 +41,7 @@ import java.util.Random; @RunWith(AndroidJUnit4.class) @LargeTest public class SmallBigIntegerPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); - + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); // We allocate about 2 1/3 BigIntegers per iteration. // Assuming 100 bytes/BigInteger, this gives us around 500MB total. static final BigInteger BIG_THREE = BigInteger.valueOf(3); @@ -53,7 +51,7 @@ public class SmallBigIntegerPerfTest { public void testSmallBigInteger() { final Random r = new Random(); BigInteger x = new BigInteger(20, r); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { // We know this converges, but the compiler doesn't. if (x.and(BigInteger.ONE).equals(BigInteger.ONE)) { diff --git a/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java b/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java index d28154c76067..1f301acd1dc6 100644 --- a/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -30,14 +30,13 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringDexCachePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeStringDexCacheAccess() { int v = 0; int count = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { // Deliberately obscured to make optimizations less likely. String s = (count >= 0) ? "hello, world!" : null; diff --git a/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java index 40a8db0c5903..4268325f8c64 100644 --- a/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -30,13 +30,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringIterationPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeStringIteration0() { String s = "hello, world!"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { char ch; for (int i = 0; i < s.length(); ++i) { @@ -48,7 +47,7 @@ public class StringIterationPerfTest { @Test public void timeStringIteration1() { String s = "hello, world!"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { char ch; for (int i = 0, length = s.length(); i < length; ++i) { @@ -60,7 +59,7 @@ public class StringIterationPerfTest { @Test public void timeStringIteration2() { String s = "hello, world!"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { char ch; char[] chars = s.toCharArray(); @@ -73,7 +72,7 @@ public class StringIterationPerfTest { @Test public void timeStringToCharArray() { String s = "hello, world!"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { char[] chars = s.toCharArray(); } diff --git a/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java b/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java index 147ea50f3a3c..cb3d3acb337f 100644 --- a/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -36,13 +36,12 @@ import java.util.Map; @RunWith(AndroidJUnit4.class) @LargeTest public class VirtualVersusInterfacePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeMapPut() { Map map = new HashMap(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { map.put("hello", "world"); } @@ -51,7 +50,7 @@ public class VirtualVersusInterfacePerfTest { @Test public void timeHashMapPut() { HashMap map = new HashMap(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { map.put("hello", "world"); } diff --git a/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java b/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java index bb1c298c67b2..5be8ee6e67e2 100644 --- a/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -36,8 +36,7 @@ import java.util.Random; @RunWith(JUnitParamsRunner.class) @LargeTest public class XmlSerializePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private Object[] getParams() { return new Object[][] { @@ -109,7 +108,7 @@ public class XmlSerializePerfTest { private void internalTimeSerializer(Constructor ctor, int seed) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { serializeRandomXml(ctor, seed); } diff --git a/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java index 9360a25fc86a..a37b89ddf033 100644 --- a/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import android.util.Xml; import androidx.test.filters.LargeTest; @@ -44,11 +44,11 @@ import java.nio.charset.StandardCharsets; public class XmlSerializerPerfTest { @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeFastSerializer_nonIndent_depth100() throws IOException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlSerializer serializer = Xml.newFastSerializer(); runTest(serializer, 100); @@ -57,7 +57,7 @@ public class XmlSerializerPerfTest { @Test public void timeFastSerializer_indent_depth100() throws IOException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlSerializer serializer = Xml.newFastSerializer(); serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); @@ -67,7 +67,7 @@ public class XmlSerializerPerfTest { @Test public void timeKXmlSerializer_nonIndent_depth100() throws IOException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlSerializer serializer = XmlObjectFactory.newXmlSerializer(); runTest(serializer, 100); @@ -76,7 +76,7 @@ public class XmlSerializerPerfTest { @Test public void timeKXmlSerializer_indent_depth100() throws IOException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlSerializer serializer = XmlObjectFactory.newXmlSerializer(); serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); diff --git a/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java index 03f183a01d11..ed669beae1ce 100644 --- a/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -42,8 +42,7 @@ import java.util.zip.ZipOutputStream; @RunWith(JUnitParamsRunner.class) @LargeTest public class ZipFilePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private File mFile; @@ -66,7 +65,7 @@ public class ZipFilePerfTest { @Parameters(method = "getData") public void timeZipFileOpen(int numEntries) throws Exception { setUp(numEntries); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ZipFile zf = new ZipFile(mFile); state.pauseTiming(); diff --git a/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java index 36140611c978..d239a054fac7 100644 --- a/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java @@ -16,8 +16,8 @@ package android.libcore; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -44,8 +44,7 @@ import java.util.zip.ZipOutputStream; @RunWith(JUnitParamsRunner.class) @LargeTest public class ZipFileReadPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList(new Object[][] {{1024}, {16384}, {65536}}); @@ -92,7 +91,7 @@ public class ZipFileReadPerfTest { @Parameters(method = "getData") public void timeZipFileRead(int readBufferSize) throws Exception { byte[] readBuffer = new byte[readBufferSize]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ZipFile zipFile = new ZipFile(mFile); for (Enumeration e = zipFile.entries(); e.hasMoreElements(); ) { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java index 8890f51fe5cd..487295c03c0e 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -35,8 +35,7 @@ import java.lang.reflect.Method; @RunWith(AndroidJUnit4.class) @LargeTest public class AnnotatedElementPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private Class mType; private Field mField; @@ -53,7 +52,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetTypeAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mType.getAnnotations(); } @@ -61,7 +60,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetFieldAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.getAnnotations(); } @@ -69,7 +68,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetMethodAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mMethod.getAnnotations(); } @@ -77,7 +76,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetParameterAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mMethod.getParameterAnnotations(); } @@ -85,7 +84,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetTypeAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mType.getAnnotation(Marker.class); } @@ -93,7 +92,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetFieldAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.getAnnotation(Marker.class); } @@ -101,7 +100,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetMethodAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mMethod.getAnnotation(Marker.class); } @@ -109,7 +108,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsTypeAnnotationPresent() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mType.isAnnotationPresent(Marker.class); } @@ -117,7 +116,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsFieldAnnotationPresent() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.isAnnotationPresent(Marker.class); } @@ -125,7 +124,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsMethodAnnotationPresent() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mMethod.isAnnotationPresent(Marker.class); } @@ -135,7 +134,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsLargeAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasLargeAnnotation.class.getAnnotations(); } @@ -143,7 +142,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsSmallAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.getAnnotations(); } @@ -151,7 +150,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsMarkerAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasMarkerAnnotation.class.getAnnotations(); } @@ -159,7 +158,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsNoAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasNoAnnotations.class.getAnnotations(); } @@ -167,7 +166,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsThreeAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasThreeAnnotations.class.getAnnotations(); } @@ -177,7 +176,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAnnotationsOnSubclass() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ExtendsHasThreeAnnotations.class.getAnnotations(); } @@ -185,7 +184,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaredAnnotationsOnSubclass() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ExtendsHasThreeAnnotations.class.getDeclaredAnnotations(); } @@ -195,7 +194,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaredClasses() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { AnnotatedElementPerfTest.class.getDeclaredClasses(); } @@ -203,7 +202,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaringClass() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.getDeclaringClass(); } @@ -212,7 +211,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetEnclosingClass() { Object anonymousClass = new Object() {}; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { anonymousClass.getClass().getEnclosingClass(); } @@ -221,7 +220,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetEnclosingConstructor() { Object anonymousClass = new Object() {}; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { anonymousClass.getClass().getEnclosingConstructor(); } @@ -230,7 +229,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetEnclosingMethod() { Object anonymousClass = new Object() {}; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { anonymousClass.getClass().getEnclosingMethod(); } @@ -238,7 +237,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetModifiers() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.getModifiers(); } @@ -246,7 +245,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetSimpleName() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.getSimpleName(); } @@ -255,7 +254,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsAnonymousClass() { Object anonymousClass = new Object() {}; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { anonymousClass.getClass().isAnonymousClass(); } @@ -263,7 +262,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsLocalClass() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.isLocalClass(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java index baab8602b265..adc5d8c2bb3e 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -34,14 +34,14 @@ import java.text.DecimalFormat; @RunWith(AndroidJUnit4.class) @LargeTest public class BidiPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final AttributedCharacterIterator CHAR_ITER = DecimalFormat.getInstance().formatToCharacterIterator(new BigDecimal(Math.PI)); @Test public void time_createBidiFromIter() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bidi = new Bidi(CHAR_ITER); } @@ -49,7 +49,7 @@ public class BidiPerfTest { @Test public void time_createBidiFromCharArray() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bd = new Bidi( @@ -64,7 +64,7 @@ public class BidiPerfTest { @Test public void time_createBidiFromString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bidi = new Bidi("Hello", Bidi.DIRECTION_LEFT_TO_RIGHT); } @@ -72,7 +72,7 @@ public class BidiPerfTest { @Test public void time_reorderVisually() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi.reorderVisually( new byte[] {2, 1, 3, 0, 4}, 0, new String[] {"H", "e", "l", "l", "o"}, 0, 5); @@ -81,7 +81,7 @@ public class BidiPerfTest { @Test public void time_hebrewBidi() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bd = new Bidi( @@ -104,7 +104,7 @@ public class BidiPerfTest { @Test public void time_complicatedOverrideBidi() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bd = new Bidi( @@ -119,7 +119,7 @@ public class BidiPerfTest { @Test public void time_requiresBidi() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi.requiresBidi("\u05D0".toCharArray(), 1, 1); // false. Bidi.requiresBidi("\u05D0".toCharArray(), 0, 1); // true. diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java index 8a539f89d3ca..286d70339c5f 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -32,14 +32,14 @@ import java.util.Random; @RunWith(AndroidJUnit4.class) @LargeTest public class BigIntegerPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeRandomDivision() throws Exception { Random r = new Random(); BigInteger x = new BigInteger(1024, r); BigInteger y = new BigInteger(1024, r); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x.divide(y); } @@ -50,7 +50,7 @@ public class BigIntegerPerfTest { Random r = new Random(); BigInteger x = new BigInteger(1024, r); BigInteger y = new BigInteger(1024, r); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x.gcd(y); } @@ -61,7 +61,7 @@ public class BigIntegerPerfTest { Random r = new Random(); BigInteger x = new BigInteger(1024, r); BigInteger y = new BigInteger(1024, r); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x.multiply(y); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java index 1b46ff4f433a..d6462024a380 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -35,7 +35,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class BitSetPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList(new Object[][] {{1000}, {10000}}); @@ -45,7 +45,7 @@ public class BitSetPerfTest { @Parameters(method = "getData") public void timeIsEmptyTrue(int size) { BitSet bitSet = new BitSet(size); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { if (!bitSet.isEmpty()) throw new RuntimeException(); } @@ -56,7 +56,7 @@ public class BitSetPerfTest { public void timeIsEmptyFalse(int size) { BitSet bitSet = new BitSet(size); bitSet.set(bitSet.size() - 1); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { if (bitSet.isEmpty()) throw new RuntimeException(); } @@ -66,7 +66,7 @@ public class BitSetPerfTest { @Parameters(method = "getData") public void timeGet(int size) { BitSet bitSet = new BitSet(size); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); int i = 1; while (state.keepRunning()) { bitSet.get(++i % size); @@ -77,7 +77,7 @@ public class BitSetPerfTest { @Parameters(method = "getData") public void timeClear(int size) { BitSet bitSet = new BitSet(size); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); int i = 1; while (state.keepRunning()) { bitSet.clear(++i % size); @@ -89,7 +89,7 @@ public class BitSetPerfTest { public void timeSet(int size) { BitSet bitSet = new BitSet(size); int i = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { bitSet.set(++i % size); } @@ -100,7 +100,7 @@ public class BitSetPerfTest { public void timeSetOn(int size) { BitSet bitSet = new BitSet(size); int i = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { bitSet.set(++i % size, true); } @@ -111,7 +111,7 @@ public class BitSetPerfTest { public void timeSetOff(int size) { BitSet bitSet = new BitSet(size); int i = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { bitSet.set(++i % size, false); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java index 3c5e4fd159c8..b887f4033462 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -36,7 +36,7 @@ import java.util.Locale; @RunWith(JUnitParamsRunner.class) @LargeTest public final class BreakIteratorPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public enum Text { LIPSUM( @@ -165,7 +165,7 @@ public final class BreakIteratorPerfTest { @Test @Parameters(method = "getData") public void timeBreakIterator(Text text) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { BreakIterator it = BreakIterator.getLineInstance(text.mLocale); it.setText(text.mText); @@ -179,7 +179,7 @@ public final class BreakIteratorPerfTest { @Test @Parameters(method = "getData") public void timeIcuBreakIterator(Text text) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { android.icu.text.BreakIterator it = android.icu.text.BreakIterator.getLineInstance(text.mLocale); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java index 6df67bccae06..e4eaf12e9dcb 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -39,7 +39,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class BulkPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -120,7 +120,7 @@ public class BulkPerfTest { throws Exception { ByteBuffer src = BulkPerfTest.newBuffer(align, sBuf, size); ByteBuffer data = BulkPerfTest.newBuffer(align, dBuf, size); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(align ? 0 : 1); data.position(align ? 0 : 1); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java index 4cf46e5364ea..cb2438e519da 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -46,7 +46,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class ByteBufferPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public enum MyByteOrder { BIG(ByteOrder.BIG_ENDIAN), @@ -121,7 +121,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getByte( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -136,7 +136,7 @@ public class ByteBufferPerfTest { MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); byte[] dst = new byte[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(aligned ? 0 : 1); @@ -150,7 +150,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getByte_indexed( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -164,7 +164,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getChar( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -180,7 +180,7 @@ public class ByteBufferPerfTest { CharBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asCharBuffer(); char[] dst = new char[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -194,7 +194,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getChar_indexed( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -208,7 +208,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getDouble( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -224,7 +224,7 @@ public class ByteBufferPerfTest { DoubleBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asDoubleBuffer(); double[] dst = new double[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -238,7 +238,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getFloat( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -254,7 +254,7 @@ public class ByteBufferPerfTest { FloatBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asFloatBuffer(); float[] dst = new float[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -268,7 +268,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getInt( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -283,7 +283,7 @@ public class ByteBufferPerfTest { MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { IntBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asIntBuffer(); int[] dst = new int[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -297,7 +297,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getLong( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -313,7 +313,7 @@ public class ByteBufferPerfTest { LongBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asLongBuffer(); long[] dst = new long[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -327,7 +327,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getShort( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -343,7 +343,7 @@ public class ByteBufferPerfTest { ShortBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asShortBuffer(); short[] dst = new short[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -361,7 +361,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putByte( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(0); for (int i = 0; i < 1024; ++i) { @@ -376,7 +376,7 @@ public class ByteBufferPerfTest { MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); byte[] src = new byte[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(aligned ? 0 : 1); @@ -390,7 +390,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putChar( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -406,7 +406,7 @@ public class ByteBufferPerfTest { CharBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asCharBuffer(); char[] src = new char[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -420,7 +420,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putDouble( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -436,7 +436,7 @@ public class ByteBufferPerfTest { DoubleBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asDoubleBuffer(); double[] src = new double[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -450,7 +450,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putFloat( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -466,7 +466,7 @@ public class ByteBufferPerfTest { FloatBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asFloatBuffer(); float[] src = new float[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -480,7 +480,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putInt( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -495,7 +495,7 @@ public class ByteBufferPerfTest { MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { IntBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asIntBuffer(); int[] src = new int[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -509,7 +509,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putLong( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -525,7 +525,7 @@ public class ByteBufferPerfTest { LongBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asLongBuffer(); long[] src = new long[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -539,7 +539,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putShort( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -555,7 +555,7 @@ public class ByteBufferPerfTest { ShortBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asShortBuffer(); short[] src = new short[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -567,7 +567,7 @@ public class ByteBufferPerfTest { @Test @Parameters(method = "getData") public void time_new_byteArray() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { byte[] bs = new byte[8192]; } @@ -576,7 +576,7 @@ public class ByteBufferPerfTest { @Test @Parameters(method = "getData") public void time_ByteBuffer_allocate() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ByteBuffer bs = ByteBuffer.allocate(8192); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java index 8c318cd0a298..9ee927cfc353 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -35,7 +35,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class ByteBufferScalarVersusVectorPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -112,7 +112,7 @@ public class ByteBufferScalarVersusVectorPerfTest { throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); ByteBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(0); dst.position(0); @@ -127,7 +127,7 @@ public class ByteBufferScalarVersusVectorPerfTest { public void timeByteBufferBulkGet(boolean aligned) throws Exception { ByteBuffer src = ByteBuffer.allocate(aligned ? 8192 : 8192 + 1); byte[] dst = new byte[8192]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); src.get(dst, 0, dst.length); @@ -139,7 +139,7 @@ public class ByteBufferScalarVersusVectorPerfTest { public void timeDirectByteBufferBulkGet(boolean aligned) throws Exception { ByteBuffer src = ByteBuffer.allocateDirect(aligned ? 8192 : 8192 + 1); byte[] dst = new byte[8192]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); src.get(dst, 0, dst.length); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java index 12c1f8cca0ec..e4a4db739235 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -38,7 +38,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class CharacterPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -84,7 +84,7 @@ public class CharacterPerfTest { public void timeIsSpace(CharacterSet characterSet, Overload overload) { setUp(characterSet); boolean fake = false; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -104,7 +104,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeDigit(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -124,7 +124,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeGetNumericValue(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -144,7 +144,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsDigit(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -164,7 +164,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsIdentifierIgnorable(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -184,7 +184,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsJavaIdentifierPart(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -204,7 +204,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsJavaIdentifierStart(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -224,7 +224,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsLetter(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -244,7 +244,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsLetterOrDigit(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -264,7 +264,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsLowerCase(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -284,7 +284,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsSpaceChar(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -304,7 +304,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsUpperCase(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -324,7 +324,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsWhitespace(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -344,7 +344,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeToLowerCase(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -364,7 +364,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeToUpperCase(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java index 4dd890ad2a45..858c101fc33e 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -33,7 +33,7 @@ import java.nio.charset.Charset; @RunWith(JUnitParamsRunner.class) @LargeTest public class CharsetForNamePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static String[] charsetNames() { return new String[] { @@ -52,7 +52,7 @@ public class CharsetForNamePerfTest { @Test @Parameters(method = "charsetNames") public void timeCharsetForName(String charsetName) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Charset.forName(charsetName); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java index 3a71ce9692bd..a2fb7d7f83d8 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class CharsetPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -91,7 +91,7 @@ public class CharsetPerfTest { @Parameters(method = "getData") public void time_new_String_BString(int length, String name) throws Exception { byte[] bytes = makeBytes(makeString(length)); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new String(bytes, name); } @@ -101,7 +101,7 @@ public class CharsetPerfTest { @Parameters(method = "getData") public void time_new_String_BII(int length, String name) throws Exception { byte[] bytes = makeBytes(makeString(length)); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new String(bytes, 0, bytes.length); } @@ -111,7 +111,7 @@ public class CharsetPerfTest { @Parameters(method = "getData") public void time_new_String_BIIString(int length, String name) throws Exception { byte[] bytes = makeBytes(makeString(length)); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new String(bytes, 0, bytes.length, name); } @@ -121,7 +121,7 @@ public class CharsetPerfTest { @Parameters(method = "getData") public void time_String_getBytes(int length, String name) throws Exception { String string = makeString(length); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { string.getBytes(name); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java index 6c30a163f519..2047444a7f52 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; import android.icu.lang.UCharacter; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -35,7 +35,7 @@ import java.nio.charset.Charset; @RunWith(AndroidJUnit4.class) @LargeTest public class CharsetUtf8PerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private void makeUnicodeRange(int startingCodePoint, int endingCodePoint) { StringBuilder builder = new StringBuilder(); @@ -46,7 +46,7 @@ public class CharsetUtf8PerfTest { } String str = builder.toString(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder builder2 = new StringBuilder(); builder2.append(str); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java index dcdfd371e7f6..4ce8b41de403 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -32,13 +32,13 @@ import java.util.zip.CRC32; @RunWith(AndroidJUnit4.class) @LargeTest public class ChecksumPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeAdler_block() throws Exception { byte[] bytes = new byte[10000]; Adler32 adler = new Adler32(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { adler.update(bytes); } @@ -47,7 +47,7 @@ public class ChecksumPerfTest { @Test public void timeAdler_byte() throws Exception { Adler32 adler = new Adler32(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { adler.update(1); } @@ -57,7 +57,7 @@ public class ChecksumPerfTest { public void timeCrc_block() throws Exception { byte[] bytes = new byte[10000]; CRC32 crc = new CRC32(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { crc.update(bytes); } @@ -66,7 +66,7 @@ public class ChecksumPerfTest { @Test public void timeCrc_byte() throws Exception { CRC32 crc = new CRC32(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { crc.update(1); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java index 6c175b191429..6a7ec1ad62e9 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -41,7 +41,7 @@ import javax.crypto.spec.IvParameterSpec; @RunWith(AndroidJUnit4.class) @LargeTest public class CipherInputStreamPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final int DATA_SIZE = 1024 * 1024; private static final byte[] DATA = new byte[DATA_SIZE]; @@ -80,7 +80,7 @@ public class CipherInputStreamPerfTest { @Test public void timeEncrypt() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mCipherEncrypt.init(Cipher.ENCRYPT_MODE, mKey, mSpec); InputStream is = new CipherInputStream(new ByteArrayInputStream(DATA), mCipherEncrypt); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java index 136822ec7002..238c028fa0cf 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -47,7 +47,7 @@ import javax.crypto.spec.IvParameterSpec; @RunWith(JUnitParamsRunner.class) @LargeTest public class CipherPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getCases() { int[] keySizes = new int[] {128, 192, 256}; @@ -180,7 +180,7 @@ public class CipherPerfTest { Mode mode, Padding padding, int keySize, int inputSize, Implementation implementation) throws Exception { setUp(mode, padding, keySize, implementation); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mCipherEncrypt.doFinal(DATA, 0, inputSize, mOutput); } @@ -192,7 +192,7 @@ public class CipherPerfTest { Mode mode, Padding padding, int keySize, int inputSize, Implementation implementation) throws Exception { setUp(mode, padding, keySize, implementation); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mCipherDecrypt.doFinal(DATA, 0, inputSize, mOutput); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java index 9efb7ce7c2d0..7e5566055fb4 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -33,7 +33,7 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class CollatorPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final RuleBasedCollator COLLATOR = (RuleBasedCollator) Collator.getInstance(Locale.US); @@ -41,7 +41,7 @@ public class CollatorPerfTest { @Test public void timeCollatorPrimary() { COLLATOR.setStrength(Collator.PRIMARY); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { COLLATOR.compare("abcde", "abcdf"); COLLATOR.compare("abcde", "abcde"); @@ -52,7 +52,7 @@ public class CollatorPerfTest { @Test public void timeCollatorSecondary() { COLLATOR.setStrength(Collator.SECONDARY); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { COLLATOR.compare("abcdÂ", "abcdÄ"); COLLATOR.compare("abcdÂ", "abcdÂ"); @@ -63,7 +63,7 @@ public class CollatorPerfTest { @Test public void timeCollatorTertiary() { COLLATOR.setStrength(Collator.TERTIARY); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { COLLATOR.compare("abcdE", "abcde"); COLLATOR.compare("abcde", "abcde"); @@ -74,7 +74,7 @@ public class CollatorPerfTest { @Test public void timeCollatorIdentical() { COLLATOR.setStrength(Collator.IDENTICAL); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { COLLATOR.compare("abcdȪ", "abcdȫ"); COLLATOR.compare("abcdȪ", "abcdȪ"); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java index 4e5ceaf12403..100798a7957b 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -40,7 +40,7 @@ import java.util.Vector; @RunWith(JUnitParamsRunner.class) @LargeTest public class CollectionsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList(new Object[][] {{4}, {16}, {64}, {256}, {1024}}); @@ -60,7 +60,7 @@ public class CollectionsPerfTest { @Parameters(method = "getData") public void timeSort_arrayList(int arrayListLength) throws Exception { List input = buildList(arrayListLength, ArrayList.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collections.sort(input); } @@ -70,7 +70,7 @@ public class CollectionsPerfTest { @Parameters(method = "getData") public void timeSortWithComparator_arrayList(int arrayListLength) throws Exception { List input = buildList(arrayListLength, ArrayList.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collections.sort(input, REVERSE); } @@ -80,7 +80,7 @@ public class CollectionsPerfTest { @Parameters(method = "getData") public void timeSort_vector(int arrayListLength) throws Exception { List input = buildList(arrayListLength, Vector.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collections.sort(input); } @@ -90,7 +90,7 @@ public class CollectionsPerfTest { @Parameters(method = "getData") public void timeSortWithComparator_vector(int arrayListLength) throws Exception { List input = buildList(arrayListLength, Vector.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collections.sort(input, REVERSE); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java index b0ccd9925d83..b6784a8d3867 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -33,7 +33,7 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public final class DateFormatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private Locale mLocale1; private Locale mLocale2; @@ -50,7 +50,7 @@ public final class DateFormatPerfTest { @Test public void timeGetDateTimeInstance() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DateFormat.getDateTimeInstance(); } @@ -58,7 +58,7 @@ public final class DateFormatPerfTest { @Test public void timeGetDateTimeInstance_multiple() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, mLocale1); DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, mLocale2); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java index 3a2f6fab5460..52f98738481f 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -34,7 +34,7 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class DecimalFormatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final String EXP_PATTERN = "##E0"; @@ -58,7 +58,7 @@ public class DecimalFormatPerfTest { public void formatWithGrouping(Object obj) { DF.setGroupingSize(3); DF.setGroupingUsed(true); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF.format(obj); } @@ -66,21 +66,21 @@ public class DecimalFormatPerfTest { public void format(String pattern, Object obj) { PATTERN_INSTANCE.applyPattern(pattern); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { PATTERN_INSTANCE.format(obj); } } public void format(Object obj) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF.format(obj); } } public void formatToCharacterIterator(Object obj) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF.formatToCharacterIterator(obj); } @@ -88,14 +88,14 @@ public class DecimalFormatPerfTest { public void formatCurrencyUS(Object obj) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF_CURRENCY_US.format(obj); } } public void formatCurrencyFR(Object obj) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF_CURRENCY_FR.format(obj); } @@ -213,7 +213,7 @@ public class DecimalFormatPerfTest { @Test public void time_instantiation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new DecimalFormat(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java index 4bc550ebb9f1..610542061107 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java @@ -15,8 +15,8 @@ */ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -31,13 +31,13 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class DecimalFormatSymbolsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static Locale sLocale = Locale.getDefault(Locale.Category.FORMAT); @Test public void time_instantiation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new DecimalFormatSymbols(sLocale); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java index 597447bef90e..fae74a5e8620 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -31,11 +31,11 @@ import java.nio.charset.Charset; @RunWith(AndroidJUnit4.class) @LargeTest public class DefaultCharsetPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void time_defaultCharset() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Charset.defaultCharset(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java index b17d0f4194d8..2915363786f3 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -32,7 +32,7 @@ import java.net.UnknownHostException; @RunWith(AndroidJUnit4.class) @LargeTest public class DnsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeDns() throws Exception { @@ -53,7 +53,7 @@ public class DnsPerfTest { "www.cnn.com", "bad.host.mtv.corp.google.com", }; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); int i = 0; while (state.keepRunning()) { try { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java index 4c8a8eaea8c6..dd7e5cc1057b 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -32,11 +32,11 @@ import java.security.PrivilegedAction; @RunWith(AndroidJUnit4.class) @LargeTest public class DoPrivilegedPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeDirect() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String lineSeparator = System.getProperty("line.separator"); } @@ -44,7 +44,7 @@ public class DoPrivilegedPerfTest { @Test public void timeFastAndSlow() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String lineSeparator; if (System.getSecurityManager() == null) { @@ -61,7 +61,7 @@ public class DoPrivilegedPerfTest { @Test public void timeNewAction() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String lineSeparator = AccessController.doPrivileged(new PrivilegedAction() { public String run() { @@ -74,7 +74,7 @@ public class DoPrivilegedPerfTest { @Test public void timeReusedAction() throws Exception { final PrivilegedAction action = new ReusableAction("line.separator"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String lineSeparator = AccessController.doPrivileged(action); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java index 4ff65b197947..e034a47e79d2 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class DoublePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private double mD = 1.2; private long mL = 4608083138725491507L; @@ -37,7 +37,7 @@ public class DoublePerfTest { @Test public void timeDoubleToLongBits() { long result = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Double.doubleToLongBits(mD); } @@ -49,7 +49,7 @@ public class DoublePerfTest { @Test public void timeDoubleToRawLongBits() { long result = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Double.doubleToRawLongBits(mD); } @@ -61,7 +61,7 @@ public class DoublePerfTest { @Test public void timeLongBitsToDouble() { double result = 123.0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Double.longBitsToDouble(mL); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java index aacdcee13e8d..fe1b599cc5ad 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -37,7 +37,7 @@ import java.util.List; @RunWith(JUnitParamsRunner.class) @LargeTest public final class EqualsHashCodePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private enum Type { URI() { @@ -82,7 +82,7 @@ public final class EqualsHashCodePerfTest { mA2 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox"); mB1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); mB2 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mA1.equals(mB1); mA1.equals(mA2); @@ -95,7 +95,7 @@ public final class EqualsHashCodePerfTest { public void timeHashCode(Type type) throws Exception { mA1 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox"); mB1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mA1.hashCode(); mB1.hashCode(); @@ -112,7 +112,7 @@ public final class EqualsHashCodePerfTest { "http://developer.android.com/query?q=" + QUERY.substring(0, QUERY.length() - 3) + "%AF"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mC1.equals(mC2); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java index 9a6864ea5f66..ecbfc7169945 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -41,11 +41,11 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class ExpensiveObjectsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeNewDateFormatTimeInstance() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT); df.format(System.currentTimeMillis()); @@ -55,7 +55,7 @@ public class ExpensiveObjectsPerfTest { @Test(timeout = 900000) public void timeClonedDateFormatTimeInstance() { DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ((DateFormat) df.clone()).format(System.currentTimeMillis()); } @@ -64,7 +64,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeReusedDateFormatTimeInstance() { DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { synchronized (df) { df.format(System.currentTimeMillis()); @@ -74,7 +74,7 @@ public class ExpensiveObjectsPerfTest { @Test(timeout = 900000) public void timeNewCollator() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collator.getInstance(Locale.US); } @@ -83,7 +83,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedCollator() { Collator c = Collator.getInstance(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { c.clone(); } @@ -91,7 +91,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewDateFormatSymbols() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new DateFormatSymbols(Locale.US); } @@ -100,7 +100,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedDateFormatSymbols() { DateFormatSymbols dfs = new DateFormatSymbols(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { dfs.clone(); } @@ -108,7 +108,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewDecimalFormatSymbols() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new DecimalFormatSymbols(Locale.US); } @@ -117,7 +117,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedDecimalFormatSymbols() { DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { dfs.clone(); } @@ -125,7 +125,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewNumberFormat() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { NumberFormat.getInstance(Locale.US); } @@ -134,7 +134,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedNumberFormat() { NumberFormat nf = NumberFormat.getInstance(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { nf.clone(); } @@ -142,7 +142,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeLongToString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Long.toString(1024L); } @@ -151,7 +151,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNumberFormatTrivialFormatDouble() { NumberFormat nf = NumberFormat.getInstance(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { nf.format(1024.0); } @@ -159,7 +159,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewSimpleDateFormat() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new SimpleDateFormat(); } @@ -167,7 +167,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewGregorianCalendar() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new GregorianCalendar(); } @@ -176,7 +176,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedGregorianCalendar() { GregorianCalendar gc = new GregorianCalendar(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { gc.clone(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java index cef7e8c739d7..0c14d64c27a9 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -31,11 +31,11 @@ import java.io.File; @RunWith(AndroidJUnit4.class) @LargeTest public final class FilePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeFileCreationWithEmptyChild() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new File("/foo", "/"); } @@ -43,7 +43,7 @@ public final class FilePerfTest { @Test public void timeFileCreationWithNormalizationNecessary() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new File("/foo//bar//baz//bag", "/baz/"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java index 645c02357970..7d7d83b3fdbf 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class FloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private float mFloat = 1.2f; private int mInt = 1067030938; @@ -37,7 +37,7 @@ public class FloatPerfTest { @Test public void timeFloatToIntBits() { int result = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Float.floatToIntBits(mFloat); } @@ -49,7 +49,7 @@ public class FloatPerfTest { @Test public void timeFloatToRawIntBits() { int result = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Float.floatToRawIntBits(mFloat); } @@ -61,7 +61,7 @@ public class FloatPerfTest { @Test public void timeIntBitsToFloat() { float result = 123.0f; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Float.intBitsToFloat(mInt); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java index cf76137d5ec3..08dda5314eac 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -35,11 +35,11 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class FormatterPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeFormatter_NoFormatting() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that doesn't actually need any formatting"); @@ -48,7 +48,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_NoFormatting() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that doesn't actually need formatting"); @@ -58,7 +58,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneInt() { Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has an int %d in it", value); @@ -69,7 +69,7 @@ public class FormatterPerfTest { public void timeFormatter_OneIntArabic() { Locale arabic = new Locale("ar"); Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format(arabic, "this is a reasonably short string that has an int %d in it", value); @@ -78,7 +78,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_OneInt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that has an int "); @@ -90,7 +90,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneHexInt() { Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has an int %x in it", value); @@ -99,7 +99,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_OneHexInt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that has an int "); @@ -111,7 +111,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneFloat() { Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has a float %f in it", value); @@ -121,7 +121,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneFloat_dot2f() { Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has a float %.2f in it", value); @@ -131,7 +131,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_TwoFloats() { Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a short string that has two floats %f and %f in it", value, value); @@ -140,7 +140,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_OneFloat() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that has a float "); @@ -151,7 +151,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has a string %s in it", "hello"); @@ -160,7 +160,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_OneString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that has a string "); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java index 833575afe8dc..a09ad809a6a2 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -31,11 +31,11 @@ import java.net.IDN; @RunWith(AndroidJUnit4.class) @LargeTest public class IdnPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeToUnicode() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { IDN.toASCII("fass.de"); IDN.toASCII("faß.de"); @@ -51,7 +51,7 @@ public class IdnPerfTest { @Test public void timeToAscii() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { IDN.toUnicode("xn--fss-qla.de"); IDN.toUnicode("xn--n00d.com"); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java index 1c901c867fe7..be22814ef8f4 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class IntConstantDivisionPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeDivideIntByConstant2() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 2; } @@ -43,7 +43,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant8() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 8; } @@ -52,7 +52,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant10() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 10; } @@ -61,7 +61,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant100() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 100; } @@ -70,7 +70,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant100_HandOptimized() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = (int) ((0x51eb851fL * result) >>> 37); } @@ -79,7 +79,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant2048() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 2048; } @@ -89,7 +89,7 @@ public class IntConstantDivisionPerfTest { public void timeDivideIntByVariable2() { int result = 1; int factor = 2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= factor; } @@ -99,7 +99,7 @@ public class IntConstantDivisionPerfTest { public void timeDivideIntByVariable10() { int result = 1; int factor = 10; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= factor; } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java index 3d3af4cdb04c..4337c903ecd6 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class IntConstantMultiplicationPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeMultiplyIntByConstant6() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 6; } @@ -43,7 +43,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant7() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 7; } @@ -52,7 +52,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant8() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 8; } @@ -61,7 +61,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant8_Shift() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result <<= 3; } @@ -70,7 +70,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant10() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 10; } @@ -79,7 +79,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant10_Shift() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = (result + (result << 2)) << 1; } @@ -88,7 +88,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant2047() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 2047; } @@ -97,7 +97,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant2048() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 2048; } @@ -106,7 +106,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant2049() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 2049; } @@ -116,7 +116,7 @@ public class IntConstantMultiplicationPerfTest { public void timeMultiplyIntByVariable10() { int result = 1; int factor = 10; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= factor; } @@ -126,7 +126,7 @@ public class IntConstantMultiplicationPerfTest { public void timeMultiplyIntByVariable8() { int result = 1; int factor = 8; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= factor; } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java index 7c86633accdc..1b6c5026e1f6 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class IntConstantRemainderPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeRemainderIntByConstant2() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 2; } @@ -43,7 +43,7 @@ public class IntConstantRemainderPerfTest { @Test public void timeRemainderIntByConstant8() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 8; } @@ -52,7 +52,7 @@ public class IntConstantRemainderPerfTest { @Test public void timeRemainderIntByConstant10() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 10; } @@ -61,7 +61,7 @@ public class IntConstantRemainderPerfTest { @Test public void timeRemainderIntByConstant100() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 100; } @@ -70,7 +70,7 @@ public class IntConstantRemainderPerfTest { @Test public void timeRemainderIntByConstant2048() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 2048; } @@ -80,7 +80,7 @@ public class IntConstantRemainderPerfTest { public void timeRemainderIntByVariable2() { int result = 1; int factor = 2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= factor; } @@ -90,7 +90,7 @@ public class IntConstantRemainderPerfTest { public void timeRemainderIntByVariable10() { int result = 1; int factor = 10; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= factor; } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java index e2a9dcc8f93d..170bb58c46ed 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java @@ -16,20 +16,20 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import org.junit.Rule; import org.junit.Test; public class IntegerPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeLongSignumBranch() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += signum1(-(++i)); t += signum1(0); @@ -41,7 +41,7 @@ public class IntegerPerfTest { public void timeLongSignumBranchFree() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += signum2(-(++i)); t += signum2(0); @@ -61,7 +61,7 @@ public class IntegerPerfTest { public void timeLongBitCount_BitSet() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += pop((long) ++i); } @@ -89,7 +89,7 @@ public class IntegerPerfTest { public void timeLongBitCount_2Int() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += pop2((long) ++i); } @@ -105,7 +105,7 @@ public class IntegerPerfTest { public void timeLongBitCount_Long() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += Long.bitCount((long) ++i); } @@ -140,7 +140,7 @@ public class IntegerPerfTest { public void timeNumberOfTrailingZerosHD() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += numberOfTrailingZerosHD(++i); } @@ -150,7 +150,7 @@ public class IntegerPerfTest { public void timeNumberOfTrailingZerosOL() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += numberOfTrailingZerosOL(++i); } @@ -163,7 +163,7 @@ public class IntegerPerfTest { "0", "1", "12", "123", "1234", "12345", "123456", "1234567", "12345678" }; int t = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int j = 0; j < intStrings.length; ++j) { t += Integer.valueOf(intStrings[j]); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java index 669bfbfb2b8d..0aa854ecfa80 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class IntegralToStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final int SMALL = 12; private static final int MEDIUM = 12345; @@ -37,7 +37,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(SMALL); } @@ -45,7 +45,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(MEDIUM); } @@ -53,7 +53,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(LARGE); } @@ -61,7 +61,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString2_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(SMALL, 2); } @@ -69,7 +69,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString2_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(MEDIUM, 2); } @@ -77,7 +77,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString2_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(LARGE, 2); } @@ -85,7 +85,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString10_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(SMALL, 10); } @@ -93,7 +93,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString10_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(MEDIUM, 10); } @@ -101,7 +101,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString10_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(LARGE, 10); } @@ -109,7 +109,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString16_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(SMALL, 16); } @@ -117,7 +117,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString16_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(MEDIUM, 16); } @@ -125,7 +125,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString16_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(LARGE, 16); } @@ -133,7 +133,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToBinaryString_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toBinaryString(SMALL); } @@ -141,7 +141,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToBinaryString_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toBinaryString(MEDIUM); } @@ -149,7 +149,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToBinaryString_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toBinaryString(LARGE); } @@ -157,7 +157,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToHexString_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toHexString(SMALL); } @@ -165,7 +165,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToHexString_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toHexString(MEDIUM); } @@ -173,7 +173,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToHexString_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toHexString(LARGE); } @@ -181,7 +181,7 @@ public class IntegralToStringPerfTest { @Test public void time_StringBuilder_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(SMALL); } @@ -189,7 +189,7 @@ public class IntegralToStringPerfTest { @Test public void time_StringBuilder_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(MEDIUM); } @@ -197,7 +197,7 @@ public class IntegralToStringPerfTest { @Test public void time_StringBuilder_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(LARGE); } @@ -205,7 +205,7 @@ public class IntegralToStringPerfTest { @Test public void time_Formatter_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%d", SMALL); } @@ -213,7 +213,7 @@ public class IntegralToStringPerfTest { @Test public void time_Formatter_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%d", MEDIUM); } @@ -221,7 +221,7 @@ public class IntegralToStringPerfTest { @Test public void time_Formatter_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%d", LARGE); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java index cda8512ad6af..9b3d7a044720 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -36,7 +36,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class KeyPairGeneratorPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -78,7 +78,7 @@ public class KeyPairGeneratorPerfTest { @Parameters(method = "getData") public void time(Algorithm algorithm, Implementation implementation) throws Exception { setUp(algorithm, implementation); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { KeyPair keyPair = mGenerator.generateKeyPair(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java index 8b062d390dbb..1a9e19aeb78d 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -39,7 +39,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class LoopingBackwardsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList(new Object[][] {{2}, {20}, {2000}, {20000000}}); @@ -49,7 +49,7 @@ public class LoopingBackwardsPerfTest { @Parameters(method = "getData") public void timeForwards(int max) { int fake = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int j = 0; j < max; j++) { fake += j; @@ -61,7 +61,7 @@ public class LoopingBackwardsPerfTest { @Parameters(method = "getData") public void timeBackwards(int max) { int fake = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int j = max - 1; j >= 0; j--) { fake += j; diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java index bcf556c26716..a8a704c09d6d 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -33,7 +33,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class MathPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private final double mDouble = 1.2; private final float mFloat = 1.2f; @@ -48,7 +48,7 @@ public class MathPerfTest { @Test public void timeAbsD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.abs(mDouble); } @@ -57,7 +57,7 @@ public class MathPerfTest { @Test public void timeAbsF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.abs(mFloat); } @@ -66,7 +66,7 @@ public class MathPerfTest { @Test public void timeAbsI() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.abs(mInt); } @@ -75,7 +75,7 @@ public class MathPerfTest { @Test public void timeAbsL() { long result = mLong; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.abs(mLong); } @@ -84,7 +84,7 @@ public class MathPerfTest { @Test public void timeAcos() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.acos(mDouble); } @@ -93,7 +93,7 @@ public class MathPerfTest { @Test public void timeAsin() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.asin(mDouble); } @@ -102,7 +102,7 @@ public class MathPerfTest { @Test public void timeAtan() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.atan(mDouble); } @@ -111,7 +111,7 @@ public class MathPerfTest { @Test public void timeAtan2() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.atan2(3, 4); } @@ -120,7 +120,7 @@ public class MathPerfTest { @Test public void timeCbrt() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.cbrt(mDouble); } @@ -129,7 +129,7 @@ public class MathPerfTest { @Test public void timeCeil() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.ceil(mDouble); } @@ -138,7 +138,7 @@ public class MathPerfTest { @Test public void timeCopySignD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.copySign(mDouble, mDouble); } @@ -147,7 +147,7 @@ public class MathPerfTest { @Test public void timeCopySignF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.copySign(mFloat, mFloat); } @@ -156,7 +156,7 @@ public class MathPerfTest { @Test public void timeCopySignD_strict() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = StrictMath.copySign(mDouble, mDouble); } @@ -165,7 +165,7 @@ public class MathPerfTest { @Test public void timeCopySignF_strict() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = StrictMath.copySign(mFloat, mFloat); } @@ -174,7 +174,7 @@ public class MathPerfTest { @Test public void timeCos() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.cos(mDouble); } @@ -183,7 +183,7 @@ public class MathPerfTest { @Test public void timeCosh() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.cosh(mDouble); } @@ -192,7 +192,7 @@ public class MathPerfTest { @Test public void timeExp() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.exp(mDouble); } @@ -201,7 +201,7 @@ public class MathPerfTest { @Test public void timeExpm1() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.expm1(mDouble); } @@ -210,7 +210,7 @@ public class MathPerfTest { @Test public void timeFloor() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.floor(mDouble); } @@ -219,7 +219,7 @@ public class MathPerfTest { @Test public void timeGetExponentD() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.getExponent(mDouble); } @@ -228,7 +228,7 @@ public class MathPerfTest { @Test public void timeGetExponentF() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.getExponent(mFloat); } @@ -237,7 +237,7 @@ public class MathPerfTest { @Test public void timeHypot() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.hypot(mDouble, mDouble); } @@ -246,7 +246,7 @@ public class MathPerfTest { @Test public void timeIEEEremainder() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.IEEEremainder(mDouble, mDouble); } @@ -255,7 +255,7 @@ public class MathPerfTest { @Test public void timeLog() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.log(mDouble); } @@ -264,7 +264,7 @@ public class MathPerfTest { @Test public void timeLog10() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.log10(mDouble); } @@ -273,7 +273,7 @@ public class MathPerfTest { @Test public void timeLog1p() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.log1p(mDouble); } @@ -282,7 +282,7 @@ public class MathPerfTest { @Test public void timeMaxD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.max(mDouble, mDouble); } @@ -291,7 +291,7 @@ public class MathPerfTest { @Test public void timeMaxF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.max(mFloat, mFloat); } @@ -300,7 +300,7 @@ public class MathPerfTest { @Test public void timeMaxI() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.max(mInt, mInt); } @@ -309,7 +309,7 @@ public class MathPerfTest { @Test public void timeMaxL() { long result = mLong; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.max(mLong, mLong); } @@ -318,7 +318,7 @@ public class MathPerfTest { @Test public void timeMinD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.min(mDouble, mDouble); } @@ -327,7 +327,7 @@ public class MathPerfTest { @Test public void timeMinF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.min(mFloat, mFloat); } @@ -336,7 +336,7 @@ public class MathPerfTest { @Test public void timeMinI() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.min(mInt, mInt); } @@ -345,7 +345,7 @@ public class MathPerfTest { @Test public void timeMinL() { long result = mLong; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.min(mLong, mLong); } @@ -354,7 +354,7 @@ public class MathPerfTest { @Test public void timeNextAfterD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.nextAfter(mDouble, mDouble); } @@ -363,7 +363,7 @@ public class MathPerfTest { @Test public void timeNextAfterF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.nextAfter(mFloat, mFloat); } @@ -372,7 +372,7 @@ public class MathPerfTest { @Test public void timeNextUpD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.nextUp(mDouble); } @@ -381,7 +381,7 @@ public class MathPerfTest { @Test public void timeNextUpF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.nextUp(mFloat); } @@ -390,7 +390,7 @@ public class MathPerfTest { @Test public void timePow() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.pow(mDouble, mDouble); } @@ -399,7 +399,7 @@ public class MathPerfTest { @Test public void timeRandom() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.random(); } @@ -408,7 +408,7 @@ public class MathPerfTest { @Test public void timeRint() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.rint(mDouble); } @@ -417,7 +417,7 @@ public class MathPerfTest { @Test public void timeRoundD() { long result = mLong; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.round(mDouble); } @@ -426,7 +426,7 @@ public class MathPerfTest { @Test public void timeRoundF() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.round(mFloat); } @@ -435,7 +435,7 @@ public class MathPerfTest { @Test public void timeScalbD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.scalb(mDouble, 5); } @@ -444,7 +444,7 @@ public class MathPerfTest { @Test public void timeScalbF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.scalb(mFloat, 5); } @@ -453,7 +453,7 @@ public class MathPerfTest { @Test public void timeSignumD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.signum(mDouble); } @@ -462,7 +462,7 @@ public class MathPerfTest { @Test public void timeSignumF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.signum(mFloat); } @@ -471,7 +471,7 @@ public class MathPerfTest { @Test public void timeSin() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.sin(mDouble); } @@ -480,7 +480,7 @@ public class MathPerfTest { @Test public void timeSinh() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.sinh(mDouble); } @@ -489,7 +489,7 @@ public class MathPerfTest { @Test public void timeSqrt() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.sqrt(mDouble); } @@ -498,7 +498,7 @@ public class MathPerfTest { @Test public void timeTan() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.tan(mDouble); } @@ -507,7 +507,7 @@ public class MathPerfTest { @Test public void timeTanh() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.tanh(mDouble); } @@ -516,7 +516,7 @@ public class MathPerfTest { @Test public void timeToDegrees() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.toDegrees(mDouble); } @@ -525,7 +525,7 @@ public class MathPerfTest { @Test public void timeToRadians() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.toRadians(mDouble); } @@ -534,7 +534,7 @@ public class MathPerfTest { @Test public void timeUlpD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.ulp(mDouble); } @@ -543,7 +543,7 @@ public class MathPerfTest { @Test public void timeUlpF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.ulp(mFloat); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java index 8325dae67797..6da9666db23b 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -36,7 +36,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class MessageDigestPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -97,7 +97,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void time(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); digest.update(DATA, 0, DATA_SIZE); @@ -108,7 +108,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeLargeArray(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); digest.update(LARGE_DATA, 0, LARGE_DATA_SIZE); @@ -119,7 +119,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallChunkOfLargeArray(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); digest.update(LARGE_DATA, LARGE_DATA_SIZE / 2, DATA_SIZE); @@ -130,7 +130,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); SMALL_BUFFER.position(0); @@ -143,7 +143,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallDirectByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); SMALL_DIRECT_BUFFER.position(0); @@ -156,7 +156,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeLargeByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); LARGE_BUFFER.position(0); @@ -169,7 +169,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeLargeDirectByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); LARGE_DIRECT_BUFFER.position(0); @@ -182,7 +182,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallChunkOfLargeByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); LARGE_BUFFER.position(LARGE_BUFFER.capacity() / 2); @@ -195,7 +195,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallChunkOfLargeDirectByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); LARGE_DIRECT_BUFFER.position(LARGE_DIRECT_BUFFER.capacity() / 2); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java index 266d42cba6f0..060d18fb3de3 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger; @RunWith(JUnitParamsRunner.class) @LargeTest public final class MutableIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum Kind { ARRAY() { @@ -105,21 +105,21 @@ public final class MutableIntPerfTest { @Test @Parameters(method = "getData") public void timeCreate(Kind kind) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); kind.timeCreate(state); } @Test @Parameters(method = "getData") public void timeIncrement(Kind kind) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); kind.timeIncrement(state); } @Test @Parameters(method = "getData") public void timeGet(Kind kind) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); kind.timeGet(state); } } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java index c2f84fb71405..7cb3b2283779 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -32,13 +32,13 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class NumberFormatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static Locale sLocale = Locale.getDefault(Locale.Category.FORMAT); @Test public void time_instantiation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { NumberFormat.getInstance(sLocale); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java index cdf0911c74ab..272b45a3affe 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -36,12 +36,12 @@ import java.util.Locale; @LargeTest public class NumberFormatTrivialFormatLongPerfTest { @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeNumberFormatTrivialFormatLong() { NumberFormat nf = NumberFormat.getInstance(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { nf.format(1024L); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java index 51f47bb60ac7..c3a09662fd1f 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -39,7 +39,7 @@ import java.util.Random; @RunWith(JUnitParamsRunner.class) @LargeTest public class PriorityQueuePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -108,7 +108,7 @@ public class PriorityQueuePerfTest { // At most allow the queue to empty 10%. int resizingThreshold = queueSize / 10; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { // Reset queue every so often. This will be called more often for smaller // queueSizes, but since a copy is linear, it will also cost proportionally diff --git a/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java index 1f20cae0c162..2ac56bed1910 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -33,7 +33,7 @@ import java.lang.reflect.Method; @RunWith(AndroidJUnit4.class) @LargeTest public final class PropertyAccessPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private View mView = new View(); private Method mSetX; @@ -50,7 +50,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectSetter() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mView.mSetX(0.1f); } @@ -58,7 +58,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectFieldSet() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mView.mX = 0.1f; } @@ -66,7 +66,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectSetterAndBomXing() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float value = 0.1f; mView.mSetX(value); @@ -75,7 +75,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectFieldSetAndBomXing() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float value = 0.1f; mView.mX = value; @@ -84,7 +84,7 @@ public final class PropertyAccessPerfTest { @Test public void timeReflectionSetterAndTwoBomXes() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mSetX.invoke(mView, 0.1f); } @@ -92,7 +92,7 @@ public final class PropertyAccessPerfTest { @Test public void timeReflectionSetterAndOneBomX() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mArgsBomX[0] = 0.1f; mSetX.invoke(mView, mArgsBomX); @@ -101,7 +101,7 @@ public final class PropertyAccessPerfTest { @Test public void timeReflectionFieldSet() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mX.setFloat(mView, 0.1f); } @@ -109,7 +109,7 @@ public final class PropertyAccessPerfTest { @Test public void timeGeneratedSetter() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mGeneratedSetter.setFloat(mView, 0.1f); } @@ -117,7 +117,7 @@ public final class PropertyAccessPerfTest { @Test public void timeGeneratedFieldSet() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mGeneratedField.setFloat(mView, 0.1f); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java index 0c16265fa6f7..7ad0141c8471 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -34,11 +34,11 @@ import javax.crypto.Cipher; @RunWith(AndroidJUnit4.class) @LargeTest public class ProviderPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeStableProviders() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Cipher c = Cipher.getInstance("RSA"); } @@ -46,7 +46,7 @@ public class ProviderPerfTest { @Test public void timeWithNewProvider() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Security.addProvider(new MockProvider()); try { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java index 5f1bfc29129e..c7b6cb5a190c 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -32,11 +32,11 @@ import java.util.Random; @RunWith(AndroidJUnit4.class) @LargeTest public class RandomPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeNewRandom() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Random rng = new Random(); rng.nextInt(); @@ -46,7 +46,7 @@ public class RandomPerfTest { @Test public void timeReusedRandom() throws Exception { Random rng = new Random(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { rng.nextInt(); } @@ -55,7 +55,7 @@ public class RandomPerfTest { @Test public void timeReusedSecureRandom() throws Exception { SecureRandom rng = new SecureRandom(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { rng.nextInt(); } @@ -63,7 +63,7 @@ public class RandomPerfTest { @Test public void timeNewSecureRandom() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SecureRandom rng = new SecureRandom(); rng.nextInt(); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java index 008c94c52492..44e5f227b00a 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class RealToStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final float SMALL = -123.45f; private static final float MEDIUM = -123.45e8f; @@ -37,7 +37,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_NaN() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(Float.NaN); } @@ -45,7 +45,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_NEGATIVE_INFINITY() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(Float.NEGATIVE_INFINITY); } @@ -53,7 +53,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_POSITIVE_INFINITY() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(Float.POSITIVE_INFINITY); } @@ -61,7 +61,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_zero() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(0.0f); } @@ -69,7 +69,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_minusZero() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(-0.0f); } @@ -77,7 +77,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(SMALL); } @@ -85,7 +85,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(MEDIUM); } @@ -93,7 +93,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(LARGE); } @@ -101,7 +101,7 @@ public class RealToStringPerfTest { @Test public void timeStringBuilder_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(SMALL); } @@ -109,7 +109,7 @@ public class RealToStringPerfTest { @Test public void timeStringBuilder_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(MEDIUM); } @@ -117,7 +117,7 @@ public class RealToStringPerfTest { @Test public void timeStringBuilder_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(LARGE); } @@ -125,7 +125,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%f", SMALL); } @@ -133,7 +133,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%f", MEDIUM); } @@ -141,7 +141,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%f", LARGE); } @@ -149,7 +149,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_dot2f_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%.2f", SMALL); } @@ -157,7 +157,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_dot2f_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%.2f", MEDIUM); } @@ -165,7 +165,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_dot2f_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%.2f", LARGE); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java index 45b623d740ee..6e00b10838a6 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -33,12 +33,12 @@ import java.lang.reflect.Method; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectionPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeObject_getClass() throws Exception { C c = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { c.getClass(); } @@ -47,7 +47,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getField() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getField("f"); } @@ -56,7 +56,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getDeclaredField() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getDeclaredField("f"); } @@ -65,7 +65,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getConstructor() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getConstructor(); } @@ -75,7 +75,7 @@ public class ReflectionPerfTest { public void timeClass_newInstance() throws Exception { Class klass = C.class; Constructor constructor = klass.getConstructor(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { constructor.newInstance(); } @@ -84,7 +84,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getMethod() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getMethod("m"); } @@ -93,7 +93,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getDeclaredMethod() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getDeclaredMethod("m"); } @@ -104,7 +104,7 @@ public class ReflectionPerfTest { Class klass = C.class; Field f = klass.getDeclaredField("f"); C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { f.setInt(instance, 1); } @@ -115,7 +115,7 @@ public class ReflectionPerfTest { Class klass = C.class; Field f = klass.getDeclaredField("f"); C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { f.getInt(instance); } @@ -126,7 +126,7 @@ public class ReflectionPerfTest { Class klass = C.class; Method m = klass.getDeclaredMethod("m"); C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(instance); } @@ -136,7 +136,7 @@ public class ReflectionPerfTest { public void timeMethod_invokeStaticV() throws Exception { Class klass = C.class; Method m = klass.getDeclaredMethod("sm"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(null); } @@ -147,7 +147,7 @@ public class ReflectionPerfTest { Class klass = C.class; Method m = klass.getDeclaredMethod("setField", int.class); C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(instance, 1); } @@ -159,7 +159,7 @@ public class ReflectionPerfTest { Method m = klass.getDeclaredMethod("setField", int.class); C instance = new C(); Integer one = Integer.valueOf(1); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(instance, one); } @@ -169,7 +169,7 @@ public class ReflectionPerfTest { public void timeMethod_invokeStaticI() throws Exception { Class klass = C.class; Method m = klass.getDeclaredMethod("setStaticField", int.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(null, 1); } @@ -180,7 +180,7 @@ public class ReflectionPerfTest { Class klass = C.class; Method m = klass.getDeclaredMethod("setStaticField", int.class); Integer one = Integer.valueOf(1); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(null, one); } @@ -189,7 +189,7 @@ public class ReflectionPerfTest { @Test public void timeRegularMethodInvocation() throws Exception { C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { instance.setField(1); } @@ -197,7 +197,7 @@ public class ReflectionPerfTest { @Test public void timeRegularConstructor() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new C(); } @@ -206,7 +206,7 @@ public class ReflectionPerfTest { @Test public void timeClass_classNewInstance() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.newInstance(); } @@ -216,7 +216,7 @@ public class ReflectionPerfTest { public void timeClass_isInstance() throws Exception { D d = new D(); Class klass = IC.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.isInstance(d); } @@ -224,7 +224,7 @@ public class ReflectionPerfTest { @Test public void timeGetInstanceField() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { // TODO: Write a test script that generates both the classes we're // reflecting on and the test case for each of its fields. @@ -234,7 +234,7 @@ public class ReflectionPerfTest { @Test public void timeGetStaticField() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { R.class.getField("WEEK_NUMBER_COLOR"); } @@ -242,7 +242,7 @@ public class ReflectionPerfTest { @Test public void timeGetInterfaceStaticField() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { F.class.getField("SF"); } @@ -250,7 +250,7 @@ public class ReflectionPerfTest { @Test public void timeGetSuperClassField() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { G.class.getField("f"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java index da69f9fc9fcf..5a9b5c36d0d3 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -35,11 +35,11 @@ import javax.net.ssl.SSLSocket; @RunWith(AndroidJUnit4.class) @LargeTest public class SSLLoopbackPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void time() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TestSSLContext context = TestSSLContext.create(TestKeyStore.getClient(), TestKeyStore.getServer()); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java index 9f2c312f33ee..6d48cf26c971 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -31,11 +31,11 @@ import javax.net.ssl.SSLSocketFactory; @RunWith(AndroidJUnit4.class) @LargeTest public class SSLSocketFactoryPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void time() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SSLSocketFactory.getDefault(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java index 7c60c05ef679..86416291f26d 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -37,7 +37,7 @@ import java.util.regex.Pattern; @RunWith(JUnitParamsRunner.class) @LargeTest public final class SchemePrefixPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum Strategy { JAVA() { @@ -94,7 +94,7 @@ public final class SchemePrefixPerfTest { @Test @Parameters(method = "getData") public void timeSchemePrefix(Strategy strategy) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { strategy.execute("http://android.com"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java index 181298305cb5..afd1191a07fa 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -37,7 +37,7 @@ import java.util.ArrayList; @RunWith(AndroidJUnit4.class) @LargeTest public class SerializationPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static byte[] bytes(Object o) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); @@ -110,7 +110,7 @@ public class SerializationPerfTest { public void timeWriteNoObjects() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); ObjectOutputStream out = new ObjectOutputStream(baos); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { out.reset(); baos.reset(); @@ -121,7 +121,7 @@ public class SerializationPerfTest { private void readSingleObject(Object object) throws Exception { byte[] bytes = bytes(object); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ObjectInputStream in = new ObjectInputStream(bais); in.readObject(); @@ -133,7 +133,7 @@ public class SerializationPerfTest { private void writeSingleObject(Object o) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); ObjectOutputStream out = new ObjectOutputStream(baos); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { out.writeObject(o); out.reset(); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java index 34e9bfb84813..6c261332aa99 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java @@ -15,8 +15,8 @@ */ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -41,7 +41,7 @@ import java.util.Map; @RunWith(JUnitParamsRunner.class) @LargeTest public class SignaturePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -117,7 +117,7 @@ public class SignaturePerfTest { @Parameters(method = "getData") public void timeSign(Algorithm algorithm, Implementation implementation) throws Exception { setUp(algorithm); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Signature signer; switch (implementation) { @@ -140,7 +140,7 @@ public class SignaturePerfTest { @Parameters(method = "getData") public void timeVerify(Algorithm algorithm, Implementation implementation) throws Exception { setUp(algorithm); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Signature verifier; switch (implementation) { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java index 2fe67985d205..274b51f6fae4 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -37,11 +37,11 @@ import java.util.Date; @RunWith(AndroidJUnit4.class) @LargeTest public class SimpleDateFormatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void time_createFormatWithTimeZone() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z"); } @@ -50,7 +50,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_parseWithTimeZoneShort() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.parse("2000.01.01 PST"); } @@ -59,7 +59,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_parseWithTimeZoneLong() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.parse("2000.01.01 Pacific Standard Time"); } @@ -68,7 +68,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_parseWithoutTimeZone() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.parse("2000.01.01"); } @@ -76,7 +76,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_createAndParseWithTimeZoneShort() throws ParseException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z"); sdf.parse("2000.01.01 PST"); @@ -85,7 +85,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_createAndParseWithTimeZoneLong() throws ParseException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz"); sdf.parse("2000.01.01 Pacific Standard Time"); @@ -95,7 +95,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_formatWithTimeZoneShort() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.format(new Date()); } @@ -104,7 +104,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_formatWithTimeZoneLong() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.format(new Date()); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java index fbe3cefff776..b4c427beac65 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -33,7 +33,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StrictMathPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private final double mDouble = 1.2; private final float mFloat = 1.2f; @@ -74,7 +74,7 @@ public class StrictMathPerfTest { @Test public void timeAbsD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.abs(mDouble); } @@ -82,7 +82,7 @@ public class StrictMathPerfTest { @Test public void timeAbsF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.abs(mFloat); } @@ -90,7 +90,7 @@ public class StrictMathPerfTest { @Test public void timeAbsI() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.abs(mInt); } @@ -98,7 +98,7 @@ public class StrictMathPerfTest { @Test public void timeAbsL() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.abs(mLong); } @@ -106,7 +106,7 @@ public class StrictMathPerfTest { @Test public void timeAcos() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.acos(mDouble); } @@ -114,7 +114,7 @@ public class StrictMathPerfTest { @Test public void timeAsin() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.asin(mDouble); } @@ -122,7 +122,7 @@ public class StrictMathPerfTest { @Test public void timeAtan() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.atan(mDouble); } @@ -130,7 +130,7 @@ public class StrictMathPerfTest { @Test public void timeAtan2() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.atan2(3, 4); } @@ -138,7 +138,7 @@ public class StrictMathPerfTest { @Test public void timeCbrt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.cbrt(mDouble); } @@ -146,7 +146,7 @@ public class StrictMathPerfTest { @Test public void timeCeilOverInterestingValues() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < CEIL_DOUBLES.length; ++i) { StrictMath.ceil(CEIL_DOUBLES[i]); @@ -156,7 +156,7 @@ public class StrictMathPerfTest { @Test public void timeCopySignD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.copySign(mDouble, mDouble); } @@ -164,7 +164,7 @@ public class StrictMathPerfTest { @Test public void timeCopySignF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.copySign(mFloat, mFloat); } @@ -172,7 +172,7 @@ public class StrictMathPerfTest { @Test public void timeCos() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.cos(mDouble); } @@ -180,7 +180,7 @@ public class StrictMathPerfTest { @Test public void timeCosh() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.cosh(mDouble); } @@ -188,7 +188,7 @@ public class StrictMathPerfTest { @Test public void timeExp() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.exp(mDouble); } @@ -196,7 +196,7 @@ public class StrictMathPerfTest { @Test public void timeExpm1() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.expm1(mDouble); } @@ -204,7 +204,7 @@ public class StrictMathPerfTest { @Test public void timeFloorOverInterestingValues() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < FLOOR_DOUBLES.length; ++i) { StrictMath.floor(FLOOR_DOUBLES[i]); @@ -214,7 +214,7 @@ public class StrictMathPerfTest { @Test public void timeGetExponentD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.getExponent(mDouble); } @@ -222,7 +222,7 @@ public class StrictMathPerfTest { @Test public void timeGetExponentF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.getExponent(mFloat); } @@ -230,7 +230,7 @@ public class StrictMathPerfTest { @Test public void timeHypot() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.hypot(mDouble, mDouble); } @@ -238,7 +238,7 @@ public class StrictMathPerfTest { @Test public void timeIEEEremainder() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.IEEEremainder(mDouble, mDouble); } @@ -246,7 +246,7 @@ public class StrictMathPerfTest { @Test public void timeLog() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.log(mDouble); } @@ -254,7 +254,7 @@ public class StrictMathPerfTest { @Test public void timeLog10() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.log10(mDouble); } @@ -262,7 +262,7 @@ public class StrictMathPerfTest { @Test public void timeLog1p() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.log1p(mDouble); } @@ -270,7 +270,7 @@ public class StrictMathPerfTest { @Test public void timeMaxD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.max(mDouble, mDouble); } @@ -278,7 +278,7 @@ public class StrictMathPerfTest { @Test public void timeMaxF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.max(mFloat, mFloat); } @@ -286,7 +286,7 @@ public class StrictMathPerfTest { @Test public void timeMaxI() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.max(mInt, mInt); } @@ -294,7 +294,7 @@ public class StrictMathPerfTest { @Test public void timeMaxL() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.max(mLong, mLong); } @@ -302,7 +302,7 @@ public class StrictMathPerfTest { @Test public void timeMinD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.min(mDouble, mDouble); } @@ -310,7 +310,7 @@ public class StrictMathPerfTest { @Test public void timeMinF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.min(mFloat, mFloat); } @@ -318,7 +318,7 @@ public class StrictMathPerfTest { @Test public void timeMinI() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.min(mInt, mInt); } @@ -326,7 +326,7 @@ public class StrictMathPerfTest { @Test public void timeMinL() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.min(mLong, mLong); } @@ -334,7 +334,7 @@ public class StrictMathPerfTest { @Test public void timeNextAfterD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.nextAfter(mDouble, mDouble); } @@ -342,7 +342,7 @@ public class StrictMathPerfTest { @Test public void timeNextAfterF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.nextAfter(mFloat, mFloat); } @@ -350,7 +350,7 @@ public class StrictMathPerfTest { @Test public void timeNextUpD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.nextUp(mDouble); } @@ -358,7 +358,7 @@ public class StrictMathPerfTest { @Test public void timeNextUpF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.nextUp(mFloat); } @@ -366,7 +366,7 @@ public class StrictMathPerfTest { @Test public void timePow() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.pow(mDouble, mDouble); } @@ -374,7 +374,7 @@ public class StrictMathPerfTest { @Test public void timeRandom() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.random(); } @@ -382,7 +382,7 @@ public class StrictMathPerfTest { @Test public void timeRint() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.rint(mDouble); } @@ -390,7 +390,7 @@ public class StrictMathPerfTest { @Test public void timeRoundD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.round(mDouble); } @@ -398,7 +398,7 @@ public class StrictMathPerfTest { @Test public void timeRoundF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.round(mFloat); } @@ -406,7 +406,7 @@ public class StrictMathPerfTest { @Test public void timeScalbD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.scalb(mDouble, 5); } @@ -414,7 +414,7 @@ public class StrictMathPerfTest { @Test public void timeScalbF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.scalb(mFloat, 5); } @@ -422,7 +422,7 @@ public class StrictMathPerfTest { @Test public void timeSignumD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.signum(mDouble); } @@ -430,7 +430,7 @@ public class StrictMathPerfTest { @Test public void timeSignumF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.signum(mFloat); } @@ -438,7 +438,7 @@ public class StrictMathPerfTest { @Test public void timeSin() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.sin(mDouble); } @@ -446,7 +446,7 @@ public class StrictMathPerfTest { @Test public void timeSinh() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.sinh(mDouble); } @@ -454,7 +454,7 @@ public class StrictMathPerfTest { @Test public void timeSqrt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.sqrt(mDouble); } @@ -462,7 +462,7 @@ public class StrictMathPerfTest { @Test public void timeTan() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.tan(mDouble); } @@ -470,7 +470,7 @@ public class StrictMathPerfTest { @Test public void timeTanh() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.tanh(mDouble); } @@ -478,7 +478,7 @@ public class StrictMathPerfTest { @Test public void timeToDegrees() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.toDegrees(mDouble); } @@ -486,7 +486,7 @@ public class StrictMathPerfTest { @Test public void timeToRadians() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.toRadians(mDouble); } @@ -494,7 +494,7 @@ public class StrictMathPerfTest { @Test public void timeUlpD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.ulp(mDouble); } @@ -502,7 +502,7 @@ public class StrictMathPerfTest { @Test public void timeUlpF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.ulp(mFloat); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java index 0155154037df..2235cc5611a4 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -30,13 +30,13 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringBuilderPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public int mLength = 100; @Test public void timeAppendBoolean() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -47,7 +47,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendChar() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -59,7 +59,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendCharArray() { char[] chars = "chars".toCharArray(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -71,7 +71,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendCharSequence() { CharSequence cs = "chars"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -83,7 +83,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendSubCharSequence() { CharSequence cs = "chars"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -95,7 +95,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendDouble() { double d = 1.2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -107,7 +107,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendFloat() { float f = 1.2f; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -119,7 +119,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendInt() { int n = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -131,7 +131,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendLong() { long l = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -150,7 +150,7 @@ public class StringBuilderPerfTest { return "constant"; } }; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -162,7 +162,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendString() { String s = "chars"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java index 55337452611b..9ab50005e62a 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -38,7 +38,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringEqualsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private final String mLong1 = "Ahead-of-time compilation is possible as the compiler may just convert an instruction" @@ -226,7 +226,7 @@ public class StringEqualsPerfTest { // Benchmark cases of String.equals(null) @Test public void timeEqualsNull() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mMediumStrings.length; i++) { mMediumStrings[i][0].equals(null); @@ -237,7 +237,7 @@ public class StringEqualsPerfTest { // Benchmark cases with very short (<5 character) Strings @Test public void timeEqualsShort() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mShortStrings.length; i++) { mShortStrings[i][0].equals(mShortStrings[i][1]); @@ -248,7 +248,7 @@ public class StringEqualsPerfTest { // Benchmark cases with medium length (10-15 character) Strings @Test public void timeEqualsMedium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mMediumStrings.length; i++) { mMediumStrings[i][0].equals(mMediumStrings[i][1]); @@ -259,7 +259,7 @@ public class StringEqualsPerfTest { // Benchmark cases with long (>100 character) Strings @Test public void timeEqualsLong() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mLongStrings.length; i++) { mLongStrings[i][0].equals(mLongStrings[i][1]); @@ -270,7 +270,7 @@ public class StringEqualsPerfTest { // Benchmark cases with very long (>1000 character) Strings @Test public void timeEqualsVeryLong() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mVeryLongStrings.length; i++) { mVeryLongStrings[i][0].equals(mVeryLongStrings[i][1]); @@ -281,7 +281,7 @@ public class StringEqualsPerfTest { // Benchmark cases with non-word aligned Strings @Test public void timeEqualsNonWordAligned() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mNonalignedStrings.length; i++) { mNonalignedStrings[i][0].equals(mNonalignedStrings[i][1]); @@ -292,7 +292,7 @@ public class StringEqualsPerfTest { // Benchmark cases with slight differences in the endings @Test public void timeEqualsEnd() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mEndStrings.length; i++) { mEndStrings[i][0].equals(mEndStrings[i][1]); @@ -303,7 +303,7 @@ public class StringEqualsPerfTest { // Benchmark cases of comparing a string to a non-string object @Test public void timeEqualsNonString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mMediumStrings.length; i++) { mMediumStrings[i][0].equals(mObjects[i]); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java index a5662b0a33bd..b1e749cc538c 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringIsEmptyPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeIsEmpty_NonEmpty() { boolean result = true; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result &= !("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".isEmpty()); } @@ -44,7 +44,7 @@ public class StringIsEmptyPerfTest { @Test public void timeIsEmpty_Empty() { boolean result = true; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result &= ("".isEmpty()); } @@ -54,7 +54,7 @@ public class StringIsEmptyPerfTest { @Test public void timeLengthEqualsZero() { boolean result = true; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result &= !("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".length() == 0); } @@ -64,7 +64,7 @@ public class StringIsEmptyPerfTest { @Test public void timeEqualsEmpty() { boolean result = true; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result &= !"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".equals(""); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java index 41e64f2810c3..9e5759171a6f 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringLengthPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeLength() { int length = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { length = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".length(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java index 2cd2a0976451..a80514c72e95 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum StringLengths { EMPTY(""), @@ -69,7 +69,7 @@ public class StringPerfTest { @Test @Parameters(method = "getData") public void timeHashCode(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.hashCode(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java index 219dccf6901b..78ae3952719b 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringReplaceAllPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); // NOTE: These estimates of MOVEABLE / NON_MOVEABLE are based on a knowledge of // ART implementation details. They make a difference here because JNI calls related @@ -86,7 +86,7 @@ public class StringReplaceAllPerfTest { @Test @Parameters(method = "getData") public void timeReplaceAllTrivialPatternNonExistent(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replaceAll("fish", "0"); } @@ -95,7 +95,7 @@ public class StringReplaceAllPerfTest { @Test @Parameters(method = "getData") public void timeReplaceTrivialPatternAllRepeated(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replaceAll("jklm", "0"); } @@ -104,7 +104,7 @@ public class StringReplaceAllPerfTest { @Test @Parameters(method = "getData") public void timeReplaceAllTrivialPatternSingleOccurrence(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replaceAll("qrst", "0"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java index d6fef5ed84e7..73911c71c351 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringReplacePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum StringLengths { EMPTY(""), @@ -80,7 +80,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceCharNonExistent(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace('z', '0'); } @@ -89,7 +89,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceCharRepeated(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace('a', '0'); } @@ -98,7 +98,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceSingleChar(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace('q', '0'); } @@ -107,7 +107,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceSequenceNonExistent(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace("fish", "0"); } @@ -116,7 +116,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceSequenceRepeated(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace("jklm", "0"); } @@ -125,7 +125,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceSingleSequence(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace("qrst", "0"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java index 9d0ec2f368c9..1539271c2b3c 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -31,11 +31,11 @@ import java.util.regex.Pattern; @RunWith(AndroidJUnit4.class) @LargeTest public class StringSplitPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeStringSplitComma() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { "this,is,a,simple,example".split(","); } @@ -43,7 +43,7 @@ public class StringSplitPerfTest { @Test public void timeStringSplitLiteralDot() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { "this.is.a.simple.example".split("\\."); } @@ -51,7 +51,7 @@ public class StringSplitPerfTest { @Test public void timeStringSplitNewline() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { "this\nis\na\nsimple\nexample\n".split("\n"); } @@ -60,7 +60,7 @@ public class StringSplitPerfTest { @Test public void timePatternSplitComma() { Pattern p = Pattern.compile(","); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { p.split("this,is,a,simple,example"); } @@ -69,7 +69,7 @@ public class StringSplitPerfTest { @Test public void timePatternSplitLiteralDot() { Pattern p = Pattern.compile("\\."); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { p.split("this.is.a.simple.example"); } @@ -77,7 +77,7 @@ public class StringSplitPerfTest { @Test public void timeStringSplitHard() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { "this,is,a,harder,example".split("[,]"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java index 11950b70ab3d..0d5e62b4268c 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -35,7 +35,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringToBytesPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum StringLengths { EMPTY(""), @@ -89,7 +89,7 @@ public class StringToBytesPerfTest { @Test @Parameters(method = "getData") public void timeGetBytesUtf8(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.getBytes(StandardCharsets.UTF_8); } @@ -98,7 +98,7 @@ public class StringToBytesPerfTest { @Test @Parameters(method = "getData") public void timeGetBytesIso88591(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.getBytes(StandardCharsets.ISO_8859_1); } @@ -107,7 +107,7 @@ public class StringToBytesPerfTest { @Test @Parameters(method = "getData") public void timeGetBytesAscii(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.getBytes(StandardCharsets.US_ASCII); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java index 4b27a16538ab..ecdf809f1610 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringToRealPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -53,7 +53,7 @@ public class StringToRealPerfTest { @Test @Parameters(method = "getData") public void timeFloat_parseFloat(String string) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.parseFloat(string); } @@ -62,7 +62,7 @@ public class StringToRealPerfTest { @Test @Parameters(method = "getData") public void timeDouble_parseDouble(String string) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Double.parseDouble(string); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java index 0ab012dc2871..2b2a6b5727de 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class ThreadLocalPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final ThreadLocal BUFFER = new ThreadLocal() { @@ -41,7 +41,7 @@ public class ThreadLocalPerfTest { @Test public void timeThreadLocal_get() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { BUFFER.get(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java index ddf410eccbcb..6eb8fccf5b2a 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -31,11 +31,11 @@ import java.util.TimeZone; @RunWith(AndroidJUnit4.class) @LargeTest public class TimeZonePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeTimeZone_getDefault() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getDefault(); } @@ -43,7 +43,7 @@ public class TimeZonePerfTest { @Test public void timeTimeZone_getTimeZoneUTC() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone("UTC"); } @@ -52,7 +52,7 @@ public class TimeZonePerfTest { @Test public void timeTimeZone_getTimeZone_default() throws Exception { String defaultId = TimeZone.getDefault().getID(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone(defaultId); } @@ -61,7 +61,7 @@ public class TimeZonePerfTest { // A time zone with relatively few transitions. @Test public void timeTimeZone_getTimeZone_America_Caracas() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone("America/Caracas"); } @@ -70,7 +70,7 @@ public class TimeZonePerfTest { // A time zone with a lot of transitions. @Test public void timeTimeZone_getTimeZone_America_Santiago() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone("America/Santiago"); } @@ -78,7 +78,7 @@ public class TimeZonePerfTest { @Test public void timeTimeZone_getTimeZone_GMT_plus_10() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone("GMT+10"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java index a38763b6ffad..288c646ec67d 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -42,7 +42,7 @@ import javax.xml.parsers.DocumentBuilderFactory; @RunWith(JUnitParamsRunner.class) @LargeTest public final class XMLEntitiesPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -85,7 +85,7 @@ public final class XMLEntitiesPerfTest { @Parameters(method = "getData") public void timeXmlParser(int length, float entityFraction) throws Exception { setUp(length, entityFraction); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlPullParser parser = mXmlPullParserFactory.newPullParser(); parser.setInput(new StringReader(mXml)); @@ -99,7 +99,7 @@ public final class XMLEntitiesPerfTest { @Parameters(method = "getData") public void timeDocumentBuilder(int length, float entityFraction) throws Exception { setUp(length, entityFraction); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DocumentBuilder documentBuilder = mDocumentBuilderFactory.newDocumentBuilder(); documentBuilder.parse(new InputSource(new StringReader(mXml))); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java index 4076c9d18e57..003c957d894f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectGetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; int mValue; @@ -47,7 +42,7 @@ public class ReflectGetFieldLittleEndianIntPerfTest { @Test public void run() throws Throwable { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mField.getInt(this); x = (int) mField.getInt(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java index 2c65dd4a90f3..4f216181d5e3 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectGetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; String mValue; @@ -47,7 +42,7 @@ public class ReflectGetFieldLittleEndianStringPerfTest { @Test public void run() throws Throwable { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mField.get(this); x = (String) mField.get(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java index dcd25db01f18..210014ad3f6e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectGetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; static int sValue; @@ -47,7 +42,7 @@ public class ReflectGetStaticFieldLittleEndianIntPerfTest { @Test public void run() throws Throwable { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mField.getInt(null); x = (int) mField.getInt(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java index c938a4cda5a0..22c68273bf12 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectGetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; static String sValue; @@ -47,7 +42,7 @@ public class ReflectGetStaticFieldLittleEndianStringPerfTest { @Test public void run() throws Throwable { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mField.get(null); x = (String) mField.get(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java index 618e1b5f5b41..5b391091253b 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectSetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; int mValue; @@ -46,7 +41,7 @@ public class ReflectSetFieldLittleEndianIntPerfTest { @Test public void run() throws Throwable { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.setInt(this, 42); mField.setInt(this, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java index 8c2e3ca8d586..883e8a76586b 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectSetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; String mValue; @@ -46,7 +41,7 @@ public class ReflectSetFieldLittleEndianStringPerfTest { @Test public void run() throws Throwable { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.set(this, "qwerty"); mField.set(this, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java index e888cc68d471..50bc85c31280 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectSetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; static int sValue; @@ -46,7 +41,7 @@ public class ReflectSetStaticFieldLittleEndianIntPerfTest { @Test public void run() throws Throwable { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.setInt(null, 42); mField.setInt(null, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java index 7016611a1b1d..13fa2bf7d230 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectSetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; static String sValue; @@ -46,7 +41,7 @@ public class ReflectSetStaticFieldLittleEndianStringPerfTest { @Test public void run() throws Throwable { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.set(null, "qwerty"); mField.set(null, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java index 65c82cca87be..85c9bae9a9d9 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchangeAcquire(this, mField, ~42); x = (int) mVh.compareAndExchangeAcquire(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java index a350b61da20b..2b8f430440f5 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchangeAcquire(this, mField, null); x = (String) mVh.compareAndExchangeAcquire(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java index 34f596eea6aa..246fa43d0dca 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTes @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchangeAcquire(sField, ~42); x = (int) mVh.compareAndExchangeAcquire(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java index 2216d7b2a507..d12ffae25c5e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; - public VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest() throws Throwable { + public VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest() + throws Throwable { mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); } @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchangeAcquire(sField, null); x = (String) mVh.compareAndExchangeAcquire(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java index bda551fd9069..5ced1157cb73 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchange(this, mField, ~42); x = (int) mVh.compareAndExchange(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java index f4d7893a64c2..b955d506fe85 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchange(this, mField, null); x = (String) mVh.compareAndExchange(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java index f4380870f7fc..601ff3461f5b 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchangeRelease(this, mField, ~42); x = (int) mVh.compareAndExchangeRelease(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java index 78df5c0eaf07..0e567f9568e6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchangeRelease(this, mField, null); x = (String) mVh.compareAndExchangeRelease(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java index f45cc6247fc0..6be287006f42 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTes @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchangeRelease(sField, ~42); x = (int) mVh.compareAndExchangeRelease(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java index 08aa7e254dcb..84c186bd24e6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; - public VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest() throws Throwable { + public VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest() + throws Throwable { mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); } @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchangeRelease(sField, null); x = (String) mVh.compareAndExchangeRelease(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java index 5d4b2e0978f3..b093234b2bc5 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchange(sField, ~42); x = (int) mVh.compareAndExchange(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java index ba4f2c8a8d7d..0d2037b4ab27 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchange(sField, null); x = (String) mVh.compareAndExchange(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java index 7fca4504b2c6..ee31973c308a 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandsetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandsetFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.compareAndSet(this, mField, ~42); success = mVh.compareAndSet(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java index 7eb7ac026517..0571fefe2a43 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandsetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandsetFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.compareAndSet(this, mField, null); success = mVh.compareAndSet(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java index ddfd407eda11..f619dabdd50a 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.compareAndSet(sField, ~42); success = mVh.compareAndSet(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java index f1f39681dce0..fc443fa362bc 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.compareAndSet(sField, null); success = mVh.compareAndSet(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java index 09127c4eed7b..bf3d58b68692 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAcquire(this); x = (int) mVh.getAcquire(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java index 87be4a66aa52..1f4bc31f24c6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetAcquireFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetAcquireFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAcquire(this); x = (String) mVh.getAcquire(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java index 5d5fc110cbaf..2085552e91dd 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAcquire(); x = (int) mVh.getAcquire(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java index c7034b80a008..d9c7d7b7695e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAcquire(); x = (String) mVh.getAcquire(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java index f22865b01009..acd2533a38e4 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetArrayLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int ELEMENT_VALUE = 42; - int[] mArray = { ELEMENT_VALUE }; + int[] mArray = {ELEMENT_VALUE}; VarHandle mVh; public VarHandleGetArrayLittleEndianIntPerfTest() throws Throwable { @@ -55,7 +54,7 @@ public class VarHandleGetArrayLittleEndianIntPerfTest { public void run() { int[] a = mArray; int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(a, 0); x = (int) mVh.get(a, 0); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java index fdb9e84fa847..de9944a8c274 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetArrayLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String ELEMENT_VALUE = "qwerty"; - String[] mArray = { ELEMENT_VALUE }; + String[] mArray = {ELEMENT_VALUE}; VarHandle mVh; public VarHandleGetArrayLittleEndianStringPerfTest() throws Throwable { @@ -55,7 +54,7 @@ public class VarHandleGetArrayLittleEndianStringPerfTest { public void run() { String[] a = mArray; String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.get(a, 0); x = (String) mVh.get(a, 0); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java index 347b0cf4effb..a8639292cbb3 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -30,22 +29,22 @@ import org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; - -import java.util.Arrays; import java.nio.ByteOrder; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetByteArrayViewBigEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int VALUE = 42; - byte[] mArray1 = { (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE }; - byte[] mArray2 = { (byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE }; + byte[] mArray1 = { + (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE + }; + byte[] mArray2 = {(byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE}; VarHandle mVh; public VarHandleGetByteArrayViewBigEndianIntPerfTest() throws Throwable { mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN); - } + } @Before public void setup() { @@ -59,7 +58,7 @@ public class VarHandleGetByteArrayViewBigEndianIntPerfTest { public void run() { byte[] a = mArray1; int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(a, 0); x = (int) mVh.get(a, 0); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java index dedc94f278bf..4999b9bf6850 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -30,22 +29,22 @@ import org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; - -import java.util.Arrays; import java.nio.ByteOrder; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetByteArrayViewLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int VALUE = 42; - byte[] mArray1 = { (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) }; - byte[] mArray2 = { (byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24) }; + byte[] mArray1 = { + (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) + }; + byte[] mArray2 = {(byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24)}; VarHandle mVh; public VarHandleGetByteArrayViewLittleEndianIntPerfTest() throws Throwable { mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN); - } + } @Before public void setup() { @@ -59,7 +58,7 @@ public class VarHandleGetByteArrayViewLittleEndianIntPerfTest { public void run() { byte[] a = mArray1; int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(a, 0); x = (int) mVh.get(a, 0); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java index 3f0f624dfccb..ee80a6f72c93 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(this); x = (int) mVh.get(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java index 9db6328ea4c5..ec29f7a33b39 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.get(this); x = (String) mVh.get(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java index 17b74a8d807e..ee6a669f2f83 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getOpaque(this); x = (int) mVh.getOpaque(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java index 5df13800365b..1702b84e703b 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getOpaque(this); x = (String) mVh.getOpaque(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java index f656ef239625..514ddb9c4b11 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getOpaque(); x = (int) mVh.getOpaque(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java index 1087df3d11c5..fbcee6906bd7 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getOpaque(); x = (String) mVh.getOpaque(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java index 004345187c96..2c5658810b05 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(); x = (int) mVh.get(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java index 0162637f7a64..8fce69e62033 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.get(); x = (String) mVh.get(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java index b0c4631574e8..ef530607bb56 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetVolatileFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetVolatileFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getVolatile(this); x = (int) mVh.getVolatile(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java index 5cbbc08521ad..64c08983a063 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetVolatileFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetVolatileFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getVolatile(this); x = (String) mVh.getVolatile(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java index 368ae69ab8f5..939100c47c05 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getVolatile(); x = (int) mVh.getVolatile(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java index 3387a8da60c1..728b1995ff52 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getVolatile(); x = (String) mVh.getVolatile(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java index 781e04f6b818..bf5ef99ff456 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; float mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAddAcquire(this, 2.17f); x = (float) mVh.getAndAddAcquire(this, 2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java index 97f29ba38bc1..d15705e9106d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAddAcquire(this, ~42); x = (int) mVh.getAndAddAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java index e108f7f4edbc..222a60da3550 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; static float sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAddAcquire(2.17f); x = (float) mVh.getAndAddAcquire(2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java index d0ae322987f3..7436476b5329 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAddAcquire(~42); x = (int) mVh.getAndAddAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java index 1b80c4064741..cca97f42e4b7 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; float mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAdd(this, 2.17f); x = (float) mVh.getAndAdd(this, 2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java index edacf181149b..170ee7313891 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAdd(this, ~42); x = (int) mVh.getAndAdd(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java index 0e86b0d6f76b..184f796ad61c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; float mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAddRelease(this, 2.17f); x = (float) mVh.getAndAddRelease(this, 2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java index 83446ff85b9a..7e75c44089ff 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAddRelease(this, ~42); x = (int) mVh.getAndAddRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java index c1f1e6f44c80..39c386b645d8 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; static float sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAddRelease(2.17f); x = (float) mVh.getAndAddRelease(2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java index 1b154a157622..04ab5310655c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAddRelease(~42); x = (int) mVh.getAndAddRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java index 7de128d7a5a5..b71351fca81c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; static float sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAdd(2.17f); x = (float) mVh.getAndAdd(2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java index c9a0926db637..e3955c051890 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAdd(~42); x = (int) mVh.getAndAdd(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java index fd9d9b13e9b2..adf05a6befb1 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAndAcquire(this, ~42); x = (int) mVh.getAndBitwiseAndAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java index c3c367f80c26..4d657d9a3511 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAndAcquire(~42); x = (int) mVh.getAndBitwiseAndAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java index e073d28a820f..dc6417416917 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAnd(this, ~42); x = (int) mVh.getAndBitwiseAnd(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java index ca78f5ac53ec..25d5631308ef 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAndRelease(this, ~42); x = (int) mVh.getAndBitwiseAndRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java index 599f18669695..de2d5489dbcc 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAndRelease(~42); x = (int) mVh.getAndBitwiseAndRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java index 71fc0ae08196..36544c6f8f50 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAnd(~42); x = (int) mVh.getAndBitwiseAnd(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java index 8fc4eabbaccc..fb36d0cb495f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOrAcquire(this, ~42); x = (int) mVh.getAndBitwiseOrAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java index 33689533d565..4194b12a4a6e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOrAcquire(~42); x = (int) mVh.getAndBitwiseOrAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java index 583a3a029059..355c6e823803 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOr(this, ~42); x = (int) mVh.getAndBitwiseOr(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java index 1592fa6b9a8c..401079d0bece 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOrRelease(this, ~42); x = (int) mVh.getAndBitwiseOrRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java index d496083416a3..322dcbf7453e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOrRelease(~42); x = (int) mVh.getAndBitwiseOrRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java index 87276a591699..c98281416012 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOr(~42); x = (int) mVh.getAndBitwiseOr(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java index f7a372fc806f..0b1cb32528ff 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXorAcquire(this, ~42); x = (int) mVh.getAndBitwiseXorAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java index 22726fcaa151..473707201782 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXorAcquire(~42); x = (int) mVh.getAndBitwiseXorAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java index d071d6ead1ef..204cd70b2f9e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXor(this, ~42); x = (int) mVh.getAndBitwiseXor(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java index be2aa9cf61b4..b3ffed7de91a 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXorRelease(this, ~42); x = (int) mVh.getAndBitwiseXorRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java index b0a7dcf2e7d3..d0ab8de4502d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXorRelease(~42); x = (int) mVh.getAndBitwiseXorRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java index c5f99deff29c..b378b684114e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXor(~42); x = (int) mVh.getAndBitwiseXor(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java index 572e0c8dc57b..c7c66fe20513 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSetAcquire(this, ~42); x = (int) mVh.getAndSetAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java index 09be6d9d3204..98d6bd71c610 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSetAcquire(this, null); x = (String) mVh.getAndSetAcquire(this, null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java index 4e0554a541b2..206358f21c1d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSetAcquire(~42); x = (int) mVh.getAndSetAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java index 5491522b0122..0532e73c9d66 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSetAcquire(null); x = (String) mVh.getAndSetAcquire(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java index a9303c6cff57..f192d7153fce 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSet(this, ~42); x = (int) mVh.getAndSet(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java index bd4703f6a5d6..0a8909c6c7b5 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSet(this, null); x = (String) mVh.getAndSet(this, null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java index d9aee0037a0c..bfcb0f410256 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSetRelease(this, ~42); x = (int) mVh.getAndSetRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java index 2c79ca2634b3..c6b0509d619b 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSetRelease(this, null); x = (String) mVh.getAndSetRelease(this, null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java index ceff81634f62..45a01eda2fd5 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSetRelease(~42); x = (int) mVh.getAndSetRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java index 9b83504b94d6..30472811d5d6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSetRelease(null); x = (String) mVh.getAndSetRelease(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java index 638da6fd37b6..6f1f1a016039 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSet(~42); x = (int) mVh.getAndSet(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java index 25d411417fb8..c4d279f37a4c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSet(null); x = (String) mVh.getAndSet(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java index 64ea9f32b698..c4f600593067 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetArrayLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int ELEMENT_VALUE = 42; - int[] mArray = { ELEMENT_VALUE }; + int[] mArray = {ELEMENT_VALUE}; VarHandle mVh; public VarHandleSetArrayLittleEndianIntPerfTest() throws Throwable { @@ -54,7 +53,7 @@ public class VarHandleSetArrayLittleEndianIntPerfTest { public void run() { int[] a = mArray; int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(a, 0, ~42); mVh.set(a, 0, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java index 989d682f1b9f..a6858c261eb0 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetArrayLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String ELEMENT_VALUE = "qwerty"; - String[] mArray = { ELEMENT_VALUE }; + String[] mArray = {ELEMENT_VALUE}; VarHandle mVh; public VarHandleSetArrayLittleEndianStringPerfTest() throws Throwable { @@ -54,7 +53,7 @@ public class VarHandleSetArrayLittleEndianStringPerfTest { public void run() { String[] a = mArray; String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(a, 0, null); mVh.set(a, 0, null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java index 9d6d6b8c0963..a994cbeaf02c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java @@ -13,52 +13,59 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; - -import java.util.Arrays; import java.nio.ByteOrder; +import java.util.Arrays; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetByteArrayViewBigEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int VALUE = 42; - byte[] mArray1 = { (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE }; - byte[] mArray2 = { (byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE }; + byte[] mArray1 = { + (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE + }; + byte[] mArray2 = {(byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE}; VarHandle mVh; public VarHandleSetByteArrayViewBigEndianIntPerfTest() throws Throwable { mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN); - } + } @After public void teardown() { if (!Arrays.equals(mArray2, mArray1)) { - throw new RuntimeException("array has unexpected values: " + - mArray2[0] + " " + mArray2[1] + " " + mArray2[2] + " " + mArray2[3]); + throw new RuntimeException( + "array has unexpected values: " + + mArray2[0] + + " " + + mArray2[1] + + " " + + mArray2[2] + + " " + + mArray2[3]); } } @Test public void run() { byte[] a = mArray2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(a, 0, VALUE); mVh.set(a, 0, VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java index e8c3fa3cd01b..65412ec84aa4 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java @@ -13,52 +13,59 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; - -import java.util.Arrays; import java.nio.ByteOrder; +import java.util.Arrays; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetByteArrayViewLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int VALUE = 42; - byte[] mArray1 = { (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) }; - byte[] mArray2 = { (byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24) }; + byte[] mArray1 = { + (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) + }; + byte[] mArray2 = {(byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24)}; VarHandle mVh; public VarHandleSetByteArrayViewLittleEndianIntPerfTest() throws Throwable { mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN); - } + } @After public void teardown() { if (!Arrays.equals(mArray2, mArray1)) { - throw new RuntimeException("array has unexpected values: " + - mArray2[0] + " " + mArray2[1] + " " + mArray2[2] + " " + mArray2[3]); + throw new RuntimeException( + "array has unexpected values: " + + mArray2[0] + + " " + + mArray2[1] + + " " + + mArray2[2] + + " " + + mArray2[3]); } } @Test public void run() { byte[] a = mArray2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(a, 0, VALUE); mVh.set(a, 0, VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java index 08294c06d438..573b0ff277cc 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(this, FIELD_VALUE); mVh.set(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java index 1e8a5bfd2a53..fe3c0fc04a84 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(this, FIELD_VALUE); mVh.set(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java index 2e5fb1815b4b..f398899880ce 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setOpaque(this, FIELD_VALUE); mVh.setOpaque(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java index 86a771f75b73..74931205fd3e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setOpaque(this, FIELD_VALUE); mVh.setOpaque(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java index 903b31003510..5e7326985c9d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setOpaque(FIELD_VALUE); mVh.setOpaque(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java index 63cf7d25d0fd..9a217d1fd142 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setOpaque(FIELD_VALUE); mVh.setOpaque(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java index d1a358dc662e..1ce2270ecc58 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setRelease(this, FIELD_VALUE); mVh.setRelease(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java index b65832469685..ed84528fe869 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetReleaseFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetReleaseFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setRelease(this, FIELD_VALUE); mVh.setRelease(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java index 47cb77959f2e..aeb96404a223 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setRelease(FIELD_VALUE); mVh.setRelease(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java index e48374e2224a..8959a0c3d50c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setRelease(FIELD_VALUE); mVh.setRelease(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java index 0470d67180c9..400772231d48 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(FIELD_VALUE); mVh.set(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java index 00abb0bab6bb..732315862eb2 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(FIELD_VALUE); mVh.set(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java index c66b23b19938..f4119c28b826 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetVolatileFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetVolatileFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setVolatile(this, FIELD_VALUE); mVh.setVolatile(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java index 1b364504d1d5..9b9c2612fe25 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetVolatileFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetVolatileFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setVolatile(this, FIELD_VALUE); mVh.setVolatile(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java index 75f927494f88..f125384706ca 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setVolatile(FIELD_VALUE); mVh.setVolatile(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java index 8289d4fdc0aa..2ad605d83d04 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setVolatile(FIELD_VALUE); mVh.setVolatile(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java index 9fac8427eacf..5ef3bf00204b 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetAcquire(this, mField, ~42); success = mVh.weakCompareAndSetAcquire(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java index 2f601273076e..0c4ed66fc6b7 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetAcquire(this, mField, null); success = mVh.weakCompareAndSetAcquire(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java index 4efbd3e50637..db6bd2429e26 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetAcquire(sField, ~42); success = mVh.weakCompareAndSetAcquire(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java index 099640c624e1..d2b0bf76158f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; - public VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest() throws Throwable { + public VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest() + throws Throwable { mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); } @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetAcquire(sField, null); success = mVh.weakCompareAndSetAcquire(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java index ce8f0f0ac269..3cd5ae6533b6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSet(this, mField, ~42); success = mVh.weakCompareAndSet(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java index c4119dc5411b..6ddfc25deca9 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSet(this, mField, null); success = mVh.weakCompareAndSet(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java index abd981c78f41..375f0bc08027 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetPlain(this, mField, ~42); success = mVh.weakCompareAndSetPlain(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java index c71e65f77983..7e2492ace1dd 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetPlain(this, mField, null); success = mVh.weakCompareAndSetPlain(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java index f3c8f3ac0656..190118c551e6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetPlain(sField, ~42); success = mVh.weakCompareAndSetPlain(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java index 5c943a46cedc..484ba1b88183 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTes @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetPlain(sField, null); success = mVh.weakCompareAndSetPlain(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java index 1755a15aae76..80e4e153a41f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetRelease(this, mField, ~42); success = mVh.weakCompareAndSetRelease(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java index 77175b007af9..fa26c59304f9 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetRelease(this, mField, null); success = mVh.weakCompareAndSetRelease(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java index 985519e890af..16bf2a208870 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetRelease(sField, ~42); success = mVh.weakCompareAndSetRelease(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java index 69e6ca7cce9c..e1716dede024 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; - public VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest() throws Throwable { + public VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest() + throws Throwable { mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); } @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetRelease(sField, null); success = mVh.weakCompareAndSetRelease(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java index 88df5ff60341..dc6f2adfe951 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSet(sField, ~42); success = mVh.weakCompareAndSet(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java index c296f66814a4..d1096c629ed8 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSet(sField, null); success = mVh.weakCompareAndSet(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py index bea4008fdf2f..f3a1fff52205 100755 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py @@ -31,6 +31,7 @@ from pathlib import Path import io import sys + class MemLoc(Enum): FIELD = 0 ARRAY = 1 @@ -41,7 +42,7 @@ def to_camel_case(word): return ''.join(c for c in word.title() if not c == '_') -LOOP ="final BenchmarkState state = mBenchmarkRule.getState();\n while (state.keepRunning())" +LOOP ="BenchmarkState state = mPerfStatusReporter.getBenchmarkState();\n while (state.keepRunning())" class Benchmark: def __init__(self, code, static, vartype, flavour, klass, method, memloc, @@ -157,10 +158,10 @@ BANNER = """/* VH_IMPORTS = """ package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; -import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; @@ -178,7 +179,7 @@ VH_START = BANNER + VH_IMPORTS + """ @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final {vartype} FIELD_VALUE = {value1}; {static_kwd}{vartype} {static_prefix}Field = FIELD_VALUE; VarHandle mVh; @@ -272,7 +273,7 @@ VH_START_ARRAY = BANNER + VH_IMPORTS + """ @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final {vartype} ELEMENT_VALUE = {value1}; {vartype}[] mArray = {{ ELEMENT_VALUE }}; VarHandle mVh; @@ -323,7 +324,7 @@ import java.nio.ByteOrder; @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final {vartype} VALUE = {value1}; byte[] mArray1 = {value1_byte_array}; byte[] mArray2 = {value2_byte_array}; @@ -374,7 +375,7 @@ import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; {static_kwd}{vartype} {static_prefix}Value; @@ -406,7 +407,7 @@ import jdk.internal.misc.Unsafe; @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); long mOffset; public {static_kwd}{vartype} {static_prefix}Value = {value1}; -- GitLab From a7c0a2685820bb8151c852bd2f3110d7af044858 Mon Sep 17 00:00:00 2001 From: Shinru Han Date: Wed, 4 Sep 2024 03:22:52 +0000 Subject: [PATCH 099/492] Support carrier config for NI SUPL message injection Test: on-device 1. Insert SIM 2. Enable flag android.location.flags.enable_ni_supl_message_injection_by_carrier_config 3. adb shell cmd phone cc set-value gps.enable_ni_supl_message_injection_bool true 4. Enable NFW lock 5. atest SmsNiSuplTest 6. Confirm the SUPL message is injected to HAL 7. adb shell cmd phone cc set-value gps.enable_ni_supl_message_injection_bool false 8. atest SmsNiSuplTest 9. Confirm no SUPL message is injected to HAL Bug: 242105192 Flag: android.location.flags.enable_ni_supl_message_injection_by_carrier_config Change-Id: I86a86517db139137a16e76bff2b820aad447a734 --- core/api/current.txt | 1 + .../android/location/flags/location.aconfig | 8 ++ .../location/gnss/GnssConfiguration.java | 7 +- .../location/gnss/GnssLocationProvider.java | 89 ++++++++++++++----- .../telephony/CarrierConfigManager.java | 15 ++++ 5 files changed, 95 insertions(+), 25 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index c7df6623e36d..2816f59001da 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -44068,6 +44068,7 @@ package android.telephony { } public static final class CarrierConfigManager.Gps { + field @FlaggedApi("android.location.flags.enable_ni_supl_message_injection_by_carrier_config") public static final String KEY_ENABLE_NI_SUPL_MESSAGE_INJECTION_BOOL = "gps.enable_ni_supl_message_injection_bool"; field public static final String KEY_PERSIST_LPP_MODE_BOOL = "gps.persist_lpp_mode_bool"; field public static final String KEY_PREFIX = "gps."; } diff --git a/location/java/android/location/flags/location.aconfig b/location/java/android/location/flags/location.aconfig index 0edaaefbd75d..ec33eb5155e4 100644 --- a/location/java/android/location/flags/location.aconfig +++ b/location/java/android/location/flags/location.aconfig @@ -102,3 +102,11 @@ flag { description: "Flag for GNSS configuration from resource" bug: "317734846" } + +flag { + name: "enable_ni_supl_message_injection_by_carrier_config" + namespace: "location" + description: "Flag for enabling NI SUPL message injection by carrier config" + bug: "242105192" + is_fixed_read_only: true +} diff --git a/services/core/java/com/android/server/location/gnss/GnssConfiguration.java b/services/core/java/com/android/server/location/gnss/GnssConfiguration.java index a439f16e6d97..1740010a8d5f 100644 --- a/services/core/java/com/android/server/location/gnss/GnssConfiguration.java +++ b/services/core/java/com/android/server/location/gnss/GnssConfiguration.java @@ -80,8 +80,8 @@ public class GnssConfiguration { "ENABLE_PSDS_PERIODIC_DOWNLOAD"; private static final String CONFIG_ENABLE_ACTIVE_SIM_EMERGENCY_SUPL = "ENABLE_ACTIVE_SIM_EMERGENCY_SUPL"; - private static final String CONFIG_ENABLE_NI_SUPL_MESSAGE_INJECTION = - "ENABLE_NI_SUPL_MESSAGE_INJECTION"; + private static final String CONFIG_ENABLE_NI_SUPL_MESSAGE_INJECTION_BOOL = + "ENABLE_NI_SUPL_MESSAGE_INJECTION_BOOL"; static final String CONFIG_LONGTERM_PSDS_SERVER_1 = "LONGTERM_PSDS_SERVER_1"; static final String CONFIG_LONGTERM_PSDS_SERVER_2 = "LONGTERM_PSDS_SERVER_2"; static final String CONFIG_LONGTERM_PSDS_SERVER_3 = "LONGTERM_PSDS_SERVER_3"; @@ -230,7 +230,8 @@ public class GnssConfiguration { * Default false if not set. */ boolean isNiSuplMessageInjectionEnabled() { - return getBooleanConfig(CONFIG_ENABLE_NI_SUPL_MESSAGE_INJECTION, false); + return getBooleanConfig(CONFIG_ENABLE_NI_SUPL_MESSAGE_INJECTION_BOOL, + false); } /** diff --git a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java index 19381509c7fe..4b2c12abe5bb 100644 --- a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java +++ b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java @@ -68,6 +68,7 @@ import android.location.LocationManager; import android.location.LocationRequest; import android.location.LocationResult; import android.location.LocationResult.BadLocationException; +import android.location.flags.Flags; import android.location.provider.ProviderProperties; import android.location.provider.ProviderRequest; import android.location.util.identity.CallerIdentity; @@ -310,6 +311,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements private String mC2KServerHost; private int mC2KServerPort; private boolean mSuplEsEnabled = false; + private boolean mNiSuplMessageListenerRegistered = false; private final LocationExtras mLocationExtras = new LocationExtras(); private final NetworkTimeHelper mNetworkTimeHelper; @@ -387,6 +389,10 @@ public class GnssLocationProvider extends AbstractLocationProvider implements // Reload gnss config for no SIM case mGnssConfiguration.reloadGpsProperties(); } + if (Flags.enableNiSuplMessageInjectionByCarrierConfig()) { + updateNiSuplMessageListenerRegistration( + mGnssConfiguration.isNiSuplMessageInjectionEnabled()); + } } private void reloadGpsProperties() { @@ -532,28 +538,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements intentFilter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED); mContext.registerReceiver(mIntentReceiver, intentFilter, null, mHandler); - if (mNetworkConnectivityHandler.isNativeAgpsRilSupported() - && mGnssConfiguration.isNiSuplMessageInjectionEnabled()) { - // Listen to WAP PUSH NI SUPL message. - // See User Plane Location Protocol Candidate Version 3.0, - // OMA-TS-ULP-V3_0-20110920-C, Section 8.3 OMA Push. - intentFilter = new IntentFilter(); - intentFilter.addAction(Intents.WAP_PUSH_RECEIVED_ACTION); - try { - intentFilter.addDataType("application/vnd.omaloc-supl-init"); - } catch (IntentFilter.MalformedMimeTypeException e) { - Log.w(TAG, "Malformed SUPL init mime type"); - } - mContext.registerReceiver(mIntentReceiver, intentFilter, null, mHandler); - - // Listen to MT SMS NI SUPL message. - // See User Plane Location Protocol Candidate Version 3.0, - // OMA-TS-ULP-V3_0-20110920-C, Section 8.4 MT SMS. - intentFilter = new IntentFilter(); - intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION); - intentFilter.addDataScheme("sms"); - intentFilter.addDataAuthority("localhost", "7275"); - mContext.registerReceiver(mIntentReceiver, intentFilter, null, mHandler); + if (!Flags.enableNiSuplMessageInjectionByCarrierConfig()) { + updateNiSuplMessageListenerRegistration( + mGnssConfiguration.isNiSuplMessageInjectionEnabled()); } mNetworkConnectivityHandler.registerNetworkCallbacks(); @@ -592,6 +579,20 @@ public class GnssLocationProvider extends AbstractLocationProvider implements case TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED: subscriptionOrCarrierConfigChanged(); break; + } + } + }; + + private BroadcastReceiver mNiSuplIntentReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (DEBUG) Log.d(TAG, "receive broadcast intent, action: " + action); + if (action == null) { + return; + } + + switch (action) { case Intents.WAP_PUSH_RECEIVED_ACTION: case Intents.DATA_SMS_RECEIVED_ACTION: injectSuplInit(intent); @@ -1442,6 +1443,46 @@ public class GnssLocationProvider extends AbstractLocationProvider implements mGnssMetrics.logSvStatus(gnssStatus); } + private void updateNiSuplMessageListenerRegistration(boolean shouldRegister) { + if (!mNetworkConnectivityHandler.isNativeAgpsRilSupported()) { + return; + } + if (mNiSuplMessageListenerRegistered == shouldRegister) { + return; + } + + // WAP PUSH NI SUPL message intent filter. + // See User Plane Location Protocol Candidate Version 3.0, + // OMA-TS-ULP-V3_0-20110920-C, Section 8.3 OMA Push. + IntentFilter wapPushNiIntentFilter = new IntentFilter(); + wapPushNiIntentFilter.addAction(Intents.WAP_PUSH_RECEIVED_ACTION); + try { + wapPushNiIntentFilter + .addDataType("application/vnd.omaloc-supl-init"); + } catch (IntentFilter.MalformedMimeTypeException e) { + Log.w(TAG, "Malformed SUPL init mime type"); + } + + // MT SMS NI SUPL message intent filter. + // See User Plane Location Protocol Candidate Version 3.0, + // OMA-TS-ULP-V3_0-20110920-C, Section 8.4 MT SMS. + IntentFilter mtSmsNiIntentFilter = new IntentFilter(); + mtSmsNiIntentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION); + mtSmsNiIntentFilter.addDataScheme("sms"); + mtSmsNiIntentFilter.addDataAuthority("localhost", "7275"); + + if (shouldRegister) { + mContext.registerReceiver(mNiSuplIntentReceiver, + wapPushNiIntentFilter, null, mHandler); + mContext.registerReceiver(mNiSuplIntentReceiver, + mtSmsNiIntentFilter, null, mHandler); + mNiSuplMessageListenerRegistered = true; + } else { + mContext.unregisterReceiver(mNiSuplIntentReceiver); + mNiSuplMessageListenerRegistered = false; + } + } + private void restartLocationRequest() { if (DEBUG) Log.d(TAG, "restartLocationRequest"); setStarted(false); @@ -1631,6 +1672,10 @@ public class GnssLocationProvider extends AbstractLocationProvider implements if (dumpAll) { mNetworkTimeHelper.dump(pw); pw.println("mSupportsPsds=" + mSupportsPsds); + if (Flags.enableNiSuplMessageInjectionByCarrierConfig()) { + pw.println("mNiSuplMessageListenerRegistered=" + + mNiSuplMessageListenerRegistered); + } pw.println( "PsdsServerConfigured=" + mGnssConfiguration.isLongTermPsdsServerConfigured()); pw.println("native internal state: "); diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index afd5720d9264..287c87f5c143 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -5029,6 +5029,18 @@ public class CarrierConfigManager { public static final String KEY_ES_SUPL_DATA_PLANE_ONLY_ROAMING_PLMN_STRING_ARRAY = KEY_PREFIX + "es_supl_data_plane_only_roaming_plmn_string_array"; + /** + * Determine whether to enable Net Initiated SUPL (NI SUPL) message injection. + * If enabled, the GnssLocationProvider will monitor for WAP PUSH or MT SMS NI SUPL intents + * and subsequently inject the NI SUPL packet into the GNSS HAL. + * {@code false} - Disable NI SUPL message injection. This is default. + * {@code true} - Enable NI SUPL message injection. + */ + @FlaggedApi(android.location.flags.Flags + .FLAG_ENABLE_NI_SUPL_MESSAGE_INJECTION_BY_CARRIER_CONFIG) + public static final String KEY_ENABLE_NI_SUPL_MESSAGE_INJECTION_BOOL = + KEY_PREFIX + "enable_ni_supl_message_injection_bool"; + private static PersistableBundle getDefaults() { PersistableBundle defaults = new PersistableBundle(); defaults.putBoolean(KEY_PERSIST_LPP_MODE_BOOL, true); @@ -5046,6 +5058,9 @@ public class CarrierConfigManager { defaults.putInt(KEY_ES_SUPL_CONTROL_PLANE_SUPPORT_INT, SUPL_EMERGENCY_MODE_TYPE_CP_ONLY); defaults.putStringArray(KEY_ES_SUPL_DATA_PLANE_ONLY_ROAMING_PLMN_STRING_ARRAY, null); + if (android.location.flags.Flags.enableNiSuplMessageInjectionByCarrierConfig()) { + defaults.putBoolean(KEY_ENABLE_NI_SUPL_MESSAGE_INJECTION_BOOL, false); + } return defaults; } } -- GitLab From 42e5746a77a5480021dc7de5f87091f375e5d416 Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Mon, 9 Sep 2024 10:40:42 +0000 Subject: [PATCH 100/492] Remove base observer Context: AppSearch does not support polymorphism with the observer API yet Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: Ie7fe97737bbae8ae43aef26ce65a99c83415759f --- .../FutureGlobalSearchSessionTest.kt | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureGlobalSearchSessionTest.kt b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureGlobalSearchSessionTest.kt index 8817a66c734e..1fa55c7090aa 100644 --- a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureGlobalSearchSessionTest.kt +++ b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureGlobalSearchSessionTest.kt @@ -18,7 +18,6 @@ package com.android.server.appfunctions import android.app.appfunctions.AppFunctionRuntimeMetadata import android.app.appfunctions.AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema import android.app.appfunctions.AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema -import android.app.appfunctions.AppFunctionStaticMetadataHelper import android.app.appsearch.AppSearchManager import android.app.appsearch.AppSearchManager.SearchContext import android.app.appsearch.PutDocumentsRequest @@ -55,10 +54,6 @@ class FutureGlobalSearchSessionTest { @Test fun registerDocumentChangeObserverCallback() { - val baseObserverSpec: ObserverSpec = - ObserverSpec.Builder() - .addFilterSchemas(AppFunctionStaticMetadataHelper.STATIC_SCHEMA_TYPE) - .build() val packageObserverSpec: ObserverSpec = ObserverSpec.Builder() .addFilterSchemas( @@ -76,15 +71,6 @@ class FutureGlobalSearchSessionTest { } val futureGlobalSearchSession = FutureGlobalSearchSession(appSearchManager, testExecutor) - val registerBaseObserver: Void? = - futureGlobalSearchSession - .registerObserverCallbackAsync( - TEST_TARGET_PKG_NAME, - baseObserverSpec, - testExecutor, - observer, - ) - .get() val registerPackageObserver: Void? = futureGlobalSearchSession .registerObserverCallbackAsync( @@ -94,8 +80,6 @@ class FutureGlobalSearchSessionTest { observer, ) .get() - - assertThat(registerBaseObserver).isNull() assertThat(registerPackageObserver).isNull() // Trigger document change val searchContext = SearchContext.Builder(TEST_DB).build() -- GitLab From ccd994ca054bdd98f81a670ff47ece9fd080c6d7 Mon Sep 17 00:00:00 2001 From: Ibrahim Yilmaz Date: Mon, 9 Sep 2024 10:52:07 +0000 Subject: [PATCH 101/492] Use bool1 instead of isEnabled Bug:356768397 Change-Id: I3ccf6f98a8badbf202c699eff14380c491418a42 Test: presubmit Flag: com.android.systemui.notification_avalanche_suppression --- .../interruption/VisualInterruptionDecisionLogger.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionLogger.kt index 37ac7c4330af..38cab820c133 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionLogger.kt @@ -108,7 +108,7 @@ constructor(@NotificationInterruptLog val buffer: LogBuffer) { TAG, INFO, { bool1 = isEnabled }, - { "Cooldown enabled: $isEnabled" } + { "Cooldown enabled: $bool1" } ) } } -- GitLab From afcbf60ca2034caafc9db8615d8b7cb6d833f448 Mon Sep 17 00:00:00 2001 From: Harry Cutts Date: Mon, 9 Sep 2024 10:56:05 +0000 Subject: [PATCH 102/492] Note that View.onTouchEvent is called for touchpad events too Bug: 352413658 Change-Id: Ic93055fd295c13964fcdfc2343b3e1af226cfe64 Test: none Flag: DOCS_ONLY --- core/java/android/view/View.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index f50dc8ddd262..8fa00587e6bb 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -328,7 +328,7 @@ import java.util.function.Predicate; * * * {@link #onTouchEvent(MotionEvent)} - * Called when a touch screen motion event occurs. + * Called when a motion event occurs with pointers down on the view. * * * @@ -16410,7 +16410,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Implement this method to handle touch screen motion events. + * Implement this method to handle pointer events. + *

+ * This method is called to handle motion events where pointers are down on + * the view. For example, this could include touchscreen touches, stylus + * touches, or click-and-drag events from a mouse. However, it is not called + * for motion events that do not involve pointers being down, such as hover + * events or mouse scroll wheel movements. *

* If this method is used to detect click actions, it is recommended that * the actions be performed by implementing and calling -- GitLab From cdf10953f4e35ac1e8f8882df1e833395c7d5911 Mon Sep 17 00:00:00 2001 From: Johannes Gallmann Date: Mon, 9 Sep 2024 11:17:57 +0000 Subject: [PATCH 103/492] Revert "[flexiglass] Add bouncer predictive back motion test" This reverts commit 89c13d712e1b903124eae492898ccf0f2ecc1a3f. Reason for revert: test build breakage Change-Id: I8c22237e5e8ce518ebc82c15b64a19977faf55ce --- packages/SystemUI/Android.bp | 1 - .../bouncer/ui/composable/BouncerScene.kt | 4 +- .../goldens/bouncerPredictiveBackMotion.json | 831 ------------------ .../composable/BouncerPredictiveBackTest.kt | 344 -------- 4 files changed, 2 insertions(+), 1178 deletions(-) delete mode 100644 packages/SystemUI/tests/goldens/bouncerPredictiveBackMotion.json delete mode 100644 packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerPredictiveBackTest.kt diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index a9e81c77acad..d26a9066e075 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -756,7 +756,6 @@ android_library { "notification_flags_lib", "PlatformComposeCore", "PlatformComposeSceneTransitionLayout", - "PlatformComposeSceneTransitionLayoutTestsUtils", "androidx.compose.runtime_runtime", "androidx.compose.material3_material3", "androidx.compose.material_material-icons-extended", diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt index ae92d259d62b..7fb88e8d1fcc 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt @@ -99,8 +99,8 @@ private fun SceneScope.BouncerScene( BouncerContent( viewModel, dialogFactory, - Modifier.element(Bouncer.Elements.Content) - .sysuiResTag(Bouncer.TestTags.Root) + Modifier.sysuiResTag(Bouncer.TestTags.Root) + .element(Bouncer.Elements.Content) .fillMaxSize() ) } diff --git a/packages/SystemUI/tests/goldens/bouncerPredictiveBackMotion.json b/packages/SystemUI/tests/goldens/bouncerPredictiveBackMotion.json deleted file mode 100644 index f37580dd47d4..000000000000 --- a/packages/SystemUI/tests/goldens/bouncerPredictiveBackMotion.json +++ /dev/null @@ -1,831 +0,0 @@ -{ - "frame_ids": [ - "before", - 0, - 16, - 32, - 48, - 64, - 80, - 96, - 112, - 128, - 144, - 160, - 176, - 192, - 208, - 224, - 240, - 256, - 272, - 288, - 304, - 320, - 336, - 352, - 368, - 384, - 400, - 416, - 432, - 448, - 464, - 480, - 496, - 512, - 528, - 544, - 560, - 576, - 592, - 608, - 624, - 640, - 656, - 672, - 688, - 704, - 720, - 736, - 752, - 768, - 784, - 800, - 816, - 832, - 848, - 864, - 880, - 896, - 912, - 928, - 944, - 960, - 976, - 992, - 1008, - 1024, - "after" - ], - "features": [ - { - "name": "content_alpha", - "type": "float", - "data_points": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0.9954499, - 0.9805035, - 0.9527822, - 0.9092045, - 0.84588075, - 0.7583043, - 0.6424476, - 0.49766344, - 0.33080608, - 0.15650165, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - { - "type": "not_found" - } - ] - }, - { - "name": "content_scale", - "type": "scale", - "data_points": [ - "default", - { - "x": 0.9995097, - "y": 0.9995097, - "pivot": "unspecified" - }, - { - "x": 0.997352, - "y": 0.997352, - "pivot": "unspecified" - }, - { - "x": 0.990635, - "y": 0.990635, - "pivot": "unspecified" - }, - { - "x": 0.97249764, - "y": 0.97249764, - "pivot": "unspecified" - }, - { - "x": 0.94287145, - "y": 0.94287145, - "pivot": "unspecified" - }, - { - "x": 0.9128026, - "y": 0.9128026, - "pivot": "unspecified" - }, - { - "x": 0.8859569, - "y": 0.8859569, - "pivot": "unspecified" - }, - { - "x": 0.8629254, - "y": 0.8629254, - "pivot": "unspecified" - }, - { - "x": 0.8442908, - "y": 0.8442908, - "pivot": "unspecified" - }, - { - "x": 0.8303209, - "y": 0.8303209, - "pivot": "unspecified" - }, - { - "x": 0.8205137, - "y": 0.8205137, - "pivot": "unspecified" - }, - { - "x": 0.81387186, - "y": 0.81387186, - "pivot": "unspecified" - }, - { - "x": 0.80941653, - "y": 0.80941653, - "pivot": "unspecified" - }, - { - "x": 0.80641484, - "y": 0.80641484, - "pivot": "unspecified" - }, - { - "x": 0.80437464, - "y": 0.80437464, - "pivot": "unspecified" - }, - { - "x": 0.80297637, - "y": 0.80297637, - "pivot": "unspecified" - }, - { - "x": 0.80201286, - "y": 0.80201286, - "pivot": "unspecified" - }, - { - "x": 0.8013477, - "y": 0.8013477, - "pivot": "unspecified" - }, - { - "x": 0.8008894, - "y": 0.8008894, - "pivot": "unspecified" - }, - { - "x": 0.8005756, - "y": 0.8005756, - "pivot": "unspecified" - }, - { - "x": 0.80036324, - "y": 0.80036324, - "pivot": "unspecified" - }, - { - "x": 0.8002219, - "y": 0.8002219, - "pivot": "unspecified" - }, - { - "x": 0.80012995, - "y": 0.80012995, - "pivot": "unspecified" - }, - { - "x": 0.8000721, - "y": 0.8000721, - "pivot": "unspecified" - }, - { - "x": 0.80003715, - "y": 0.80003715, - "pivot": "unspecified" - }, - { - "x": 0.8000173, - "y": 0.8000173, - "pivot": "unspecified" - }, - { - "x": 0.800007, - "y": 0.800007, - "pivot": "unspecified" - }, - { - "x": 0.8000022, - "y": 0.8000022, - "pivot": "unspecified" - }, - { - "x": 0.8000004, - "y": 0.8000004, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.79999995, - "y": 0.79999995, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "x": 0.8, - "y": 0.8, - "pivot": "unspecified" - }, - { - "type": "not_found" - } - ] - }, - { - "name": "content_offset", - "type": "dpOffset", - "data_points": [ - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0 - }, - { - "x": 0, - "y": 0.5714286 - }, - { - "x": 0, - "y": 2.857143 - }, - { - "x": 0, - "y": 7.142857 - }, - { - "x": 0, - "y": 13.714286 - }, - { - "x": 0, - "y": 23.142857 - }, - { - "x": 0, - "y": 36.285713 - }, - { - "x": 0, - "y": 53.714287 - }, - { - "x": 0, - "y": 75.42857 - }, - { - "x": 0, - "y": 100.28571 - }, - { - "x": 0, - "y": 126.57143 - }, - { - "x": 0, - "y": 151.42857 - }, - { - "x": 0, - "y": 174 - }, - { - "x": 0, - "y": 193.42857 - }, - { - "x": 0, - "y": 210.28572 - }, - { - "x": 0, - "y": 224.85715 - }, - { - "x": 0, - "y": 237.14285 - }, - { - "x": 0, - "y": 247.71428 - }, - { - "x": 0, - "y": 256.85715 - }, - { - "x": 0, - "y": 264.57144 - }, - { - "x": 0, - "y": 271.42856 - }, - { - "x": 0, - "y": 277.14285 - }, - { - "x": 0, - "y": 282 - }, - { - "x": 0, - "y": 286.2857 - }, - { - "x": 0, - "y": 289.7143 - }, - { - "x": 0, - "y": 292.57144 - }, - { - "x": 0, - "y": 294.85715 - }, - { - "x": 0, - "y": 296.85715 - }, - { - "x": 0, - "y": 298.2857 - }, - { - "x": 0, - "y": 299.14285 - }, - { - "x": 0, - "y": 299.7143 - }, - { - "x": 0, - "y": 300 - }, - { - "x": 0, - "y": 0 - }, - { - "type": "not_found" - } - ] - }, - { - "name": "background_alpha", - "type": "float", - "data_points": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0.9900334, - 0.8403853, - 0.71002257, - 0.5979084, - 0.50182605, - 0.41945767, - 0.34874845, - 0.28797746, - 0.23573697, - 0.19087732, - 0.1524564, - 0.11970067, - 0.091962695, - 0.068702936, - 0.049464583, - 0.033859253, - 0.021552086, - 0.012255073, - 0.005717635, - 0.0017191172, - 6.711483e-05, - 0, - { - "type": "not_found" - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerPredictiveBackTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerPredictiveBackTest.kt deleted file mode 100644 index 02a5c46c0f0a..000000000000 --- a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerPredictiveBackTest.kt +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.systemui.bouncer.ui.composable - -import android.app.AlertDialog -import android.platform.test.annotations.MotionTest -import android.testing.TestableLooper.RunWithLooper -import androidx.activity.BackEventCompat -import androidx.compose.animation.core.Animatable -import androidx.compose.animation.core.tween -import androidx.compose.foundation.layout.Box -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.remember -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.geometry.isFinite -import androidx.compose.ui.geometry.isUnspecified -import androidx.compose.ui.semantics.SemanticsNode -import androidx.compose.ui.test.junit4.AndroidComposeTestRule -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.filters.LargeTest -import com.android.compose.animation.scene.ObservableTransitionState -import com.android.compose.animation.scene.Scale -import com.android.compose.animation.scene.SceneKey -import com.android.compose.animation.scene.SceneScope -import com.android.compose.animation.scene.UserAction -import com.android.compose.animation.scene.UserActionResult -import com.android.compose.animation.scene.isElement -import com.android.compose.animation.scene.testing.lastAlphaForTesting -import com.android.compose.animation.scene.testing.lastScaleForTesting -import com.android.compose.theme.PlatformTheme -import com.android.systemui.SysuiTestCase -import com.android.systemui.bouncer.domain.interactor.bouncerInteractor -import com.android.systemui.bouncer.ui.BouncerDialogFactory -import com.android.systemui.bouncer.ui.viewmodel.BouncerSceneContentViewModel -import com.android.systemui.bouncer.ui.viewmodel.BouncerUserActionsViewModel -import com.android.systemui.bouncer.ui.viewmodel.bouncerSceneContentViewModel -import com.android.systemui.classifier.domain.interactor.falsingInteractor -import com.android.systemui.flags.EnableSceneContainer -import com.android.systemui.kosmos.Kosmos -import com.android.systemui.kosmos.Kosmos.Fixture -import com.android.systemui.lifecycle.ExclusiveActivatable -import com.android.systemui.lifecycle.rememberViewModel -import com.android.systemui.motion.createSysUiComposeMotionTestRule -import com.android.systemui.power.domain.interactor.powerInteractor -import com.android.systemui.scene.domain.interactor.sceneInteractor -import com.android.systemui.scene.domain.startable.sceneContainerStartable -import com.android.systemui.scene.shared.logger.sceneLogger -import com.android.systemui.scene.shared.model.SceneContainerConfig -import com.android.systemui.scene.shared.model.Scenes -import com.android.systemui.scene.shared.model.sceneDataSourceDelegator -import com.android.systemui.scene.ui.composable.Scene -import com.android.systemui.scene.ui.composable.SceneContainer -import com.android.systemui.scene.ui.viewmodel.SceneContainerViewModel -import com.android.systemui.testKosmos -import kotlinx.coroutines.awaitCancellation -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.flowOf -import org.json.JSONObject -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import platform.test.motion.compose.ComposeFeatureCaptures.positionInRoot -import platform.test.motion.compose.ComposeRecordingSpec -import platform.test.motion.compose.MotionControl -import platform.test.motion.compose.feature -import platform.test.motion.compose.recordMotion -import platform.test.motion.compose.runTest -import platform.test.motion.golden.DataPoint -import platform.test.motion.golden.DataPointType -import platform.test.motion.golden.DataPointTypes -import platform.test.motion.golden.FeatureCapture -import platform.test.motion.golden.UnknownTypeException -import platform.test.screenshot.DeviceEmulationSpec -import platform.test.screenshot.Displays.Phone - -/** MotionTest for the Bouncer Predictive Back animation */ -@LargeTest -@RunWith(AndroidJUnit4::class) -@RunWithLooper -@EnableSceneContainer -@MotionTest -class BouncerPredictiveBackTest : SysuiTestCase() { - - private val deviceSpec = DeviceEmulationSpec(Phone) - private val kosmos = testKosmos() - - @get:Rule val motionTestRule = createSysUiComposeMotionTestRule(kosmos, deviceSpec) - private val androidComposeTestRule = - motionTestRule.toolkit.composeContentTestRule as AndroidComposeTestRule<*, *> - - private val sceneInteractor by lazy { kosmos.sceneInteractor } - private val Kosmos.sceneKeys by Fixture { listOf(Scenes.Lockscreen, Scenes.Bouncer) } - private val Kosmos.initialSceneKey by Fixture { Scenes.Bouncer } - private val Kosmos.sceneContainerConfig by Fixture { - val navigationDistances = - mapOf( - Scenes.Lockscreen to 1, - Scenes.Bouncer to 0, - ) - SceneContainerConfig(sceneKeys, initialSceneKey, emptyList(), navigationDistances) - } - - private val transitionState by lazy { - MutableStateFlow( - ObservableTransitionState.Idle(kosmos.sceneContainerConfig.initialSceneKey) - ) - } - private val sceneContainerViewModel by lazy { - SceneContainerViewModel( - sceneInteractor = kosmos.sceneInteractor, - falsingInteractor = kosmos.falsingInteractor, - powerInteractor = kosmos.powerInteractor, - logger = kosmos.sceneLogger, - motionEventHandlerReceiver = {}, - ) - .apply { setTransitionState(transitionState) } - } - - private val bouncerDialogFactory = - object : BouncerDialogFactory { - override fun invoke(): AlertDialog { - throw AssertionError() - } - } - private val bouncerSceneActionsViewModelFactory = - object : BouncerUserActionsViewModel.Factory { - override fun create() = BouncerUserActionsViewModel(kosmos.bouncerInteractor) - } - private lateinit var bouncerSceneContentViewModel: BouncerSceneContentViewModel - private val bouncerSceneContentViewModelFactory = - object : BouncerSceneContentViewModel.Factory { - override fun create() = bouncerSceneContentViewModel - } - private val bouncerScene = - BouncerScene( - bouncerSceneActionsViewModelFactory, - bouncerSceneContentViewModelFactory, - bouncerDialogFactory - ) - - @Before - fun setUp() { - MockitoAnnotations.initMocks(this) - - bouncerSceneContentViewModel = kosmos.bouncerSceneContentViewModel - - val startable = kosmos.sceneContainerStartable - startable.start() - } - - @Test - fun bouncerPredictiveBackMotion() = - motionTestRule.runTest { - val motion = - recordMotion( - content = { play -> - PlatformTheme { - BackGestureAnimation(play) - SceneContainer( - viewModel = - rememberViewModel("BouncerPredictiveBackTest") { - sceneContainerViewModel - }, - sceneByKey = - mapOf( - Scenes.Lockscreen to FakeLockscreen(), - Scenes.Bouncer to bouncerScene - ), - initialSceneKey = Scenes.Bouncer, - overlayByKey = emptyMap(), - dataSourceDelegator = kosmos.sceneDataSourceDelegator - ) - } - }, - ComposeRecordingSpec( - MotionControl( - delayRecording = { - awaitCondition { - sceneInteractor.transitionState.value.isTransitioning() - } - } - ) { - awaitCondition { - sceneInteractor.transitionState.value.isIdle(Scenes.Lockscreen) - } - } - ) { - feature(isElement(Bouncer.Elements.Content), elementAlpha, "content_alpha") - feature(isElement(Bouncer.Elements.Content), elementScale, "content_scale") - feature( - isElement(Bouncer.Elements.Content), - positionInRoot, - "content_offset" - ) - feature( - isElement(Bouncer.Elements.Background), - elementAlpha, - "background_alpha" - ) - } - ) - - assertThat(motion).timeSeriesMatchesGolden() - } - - @Composable - private fun BackGestureAnimation(play: Boolean) { - val backProgress = remember { Animatable(0f) } - - LaunchedEffect(play) { - if (play) { - val dispatcher = androidComposeTestRule.activity.onBackPressedDispatcher - androidComposeTestRule.runOnUiThread { - dispatcher.dispatchOnBackStarted(backEvent()) - } - backProgress.animateTo( - targetValue = 1f, - animationSpec = tween(durationMillis = 500) - ) { - androidComposeTestRule.runOnUiThread { - dispatcher.dispatchOnBackProgressed( - backEvent(progress = backProgress.value) - ) - if (backProgress.value == 1f) { - dispatcher.onBackPressed() - } - } - } - } - } - } - - private fun backEvent(progress: Float = 0f): BackEventCompat { - return BackEventCompat( - touchX = 0f, - touchY = 0f, - progress = progress, - swipeEdge = BackEventCompat.EDGE_LEFT, - ) - } - - private class FakeLockscreen : ExclusiveActivatable(), Scene { - override val key: SceneKey = Scenes.Lockscreen - override val userActions: Flow> = flowOf() - - @Composable - override fun SceneScope.Content(modifier: Modifier) { - Box(modifier = modifier, contentAlignment = Alignment.Center) { - Text(text = "Fake Lockscreen") - } - } - - override suspend fun onActivated() = awaitCancellation() - } - - companion object { - private val elementAlpha = - FeatureCapture("alpha") { - DataPoint.of(it.lastAlphaForTesting, DataPointTypes.float) - } - - private val elementScale = - FeatureCapture("scale") { - DataPoint.of(it.lastScaleForTesting, scale) - } - - private val scale: DataPointType = - DataPointType( - "scale", - jsonToValue = { - when (it) { - "unspecified" -> Scale.Unspecified - "default" -> Scale.Default - "zero" -> Scale.Zero - is JSONObject -> { - val pivot = it.get("pivot") - Scale( - scaleX = it.getDouble("x").toFloat(), - scaleY = it.getDouble("y").toFloat(), - pivot = - when (pivot) { - "unspecified" -> Offset.Unspecified - "infinite" -> Offset.Infinite - is JSONObject -> - Offset( - pivot.getDouble("x").toFloat(), - pivot.getDouble("y").toFloat() - ) - else -> throw UnknownTypeException() - } - ) - } - else -> throw UnknownTypeException() - } - }, - valueToJson = { - when (it) { - Scale.Unspecified -> "unspecified" - Scale.Default -> "default" - Scale.Zero -> "zero" - else -> { - JSONObject().apply { - put("x", it.scaleX) - put("y", it.scaleY) - put( - "pivot", - when { - it.pivot.isUnspecified -> "unspecified" - !it.pivot.isFinite -> "infinite" - else -> - JSONObject().apply { - put("x", it.pivot.x) - put("y", it.pivot.y) - } - } - ) - } - } - } - } - ) - } -} -- GitLab From 8dddab919911ce5fa7b394b1f72b000a82b6dae7 Mon Sep 17 00:00:00 2001 From: Ioana Alexandru Date: Wed, 4 Sep 2024 18:03:15 +0200 Subject: [PATCH 104/492] [flexiglass] Replace the two footer vis flows with only one This distinction is no longer necessary in flexiglass, so let's simplify things. I didn't want to duplicate a ton of tests, so instead I'm just collecting from the correct flow depending on the state of SceneContainerFlag. Bug: 364028944 Test: manually verified that the QS bug that required this distinction (b/329432313) doesn't happen in flexiglass Flag: com.android.systemui.scene_container Change-Id: I04a2e19f3fd27367ec3e375d510238e876c01778 --- .../NotificationListViewModelTest.kt | 53 ++++++++++---- .../stack/StackScrollAlgorithm.java | 6 +- .../viewbinder/NotificationListViewBinder.kt | 25 +++++-- .../ui/viewmodel/NotificationListViewModel.kt | 73 +++++++++++++++++++ 4 files changed, 135 insertions(+), 22 deletions(-) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt index 840aa92548c8..26e1a4d9e961 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt @@ -26,6 +26,7 @@ import androidx.test.filters.SmallTest import com.android.settingslib.notification.data.repository.updateNotificationPolicy import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue +import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.flags.Flags import com.android.systemui.flags.andSceneContainer @@ -36,6 +37,7 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.power.data.repository.fakePowerRepository import com.android.systemui.power.shared.model.WakefulnessState import com.android.systemui.res.R +import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.shadeTestUtil import com.android.systemui.statusbar.data.repository.fakeRemoteInputRepository import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository @@ -51,6 +53,7 @@ import com.android.systemui.util.ui.isAnimating import com.android.systemui.util.ui.value import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -153,7 +156,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas fun shouldShowEmptyShadeView_trueWhenNoNotifs() = testScope.runTest { val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) - val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) + val shouldIncludeFooterView by collectFooterViewVisibility() // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) @@ -196,7 +199,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas fun shouldShowEmptyShadeView_trueWhenQsExpandedInSplitShade() = testScope.runTest { val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) - val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) + val shouldIncludeFooterView by collectFooterViewVisibility() // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) @@ -217,7 +220,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas fun shouldShowEmptyShadeView_trueWhenLockedShade() = testScope.runTest { val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) - val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) + val shouldIncludeFooterView by collectFooterViewVisibility() // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) @@ -315,7 +318,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_trueWhenShade() = testScope.runTest { - val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) + val shouldIncludeFooterView by collectFooterViewVisibility() val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs @@ -333,7 +336,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_trueWhenLockedShade() = testScope.runTest { - val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) + val shouldIncludeFooterView by collectFooterViewVisibility() val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs @@ -351,7 +354,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_falseWhenKeyguard() = testScope.runTest { - val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) + val shouldInclude by collectFooterViewVisibility() // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) @@ -366,7 +369,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_falseWhenUserNotSetUp() = testScope.runTest { - val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) + val shouldInclude by collectFooterViewVisibility() // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) @@ -384,7 +387,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_falseWhenStartingToSleep() = testScope.runTest { - val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) + val shouldInclude by collectFooterViewVisibility() // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) @@ -402,7 +405,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_falseWhenQsExpandedDefault() = testScope.runTest { - val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) + val shouldInclude by collectFooterViewVisibility() // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) @@ -421,7 +424,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_trueWhenQsExpandedSplitShade() = testScope.runTest { - val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) + val shouldIncludeFooterView by collectFooterViewVisibility() val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs @@ -444,7 +447,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_falseWhenRemoteInputActive() = testScope.runTest { - val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) + val shouldInclude by collectFooterViewVisibility() // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) @@ -462,7 +465,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_animatesWhenShade() = testScope.runTest { - val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) + val shouldInclude by collectFooterViewVisibility() // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) @@ -478,7 +481,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_notAnimatingOnKeyguard() = testScope.runTest { - val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) + val shouldInclude by collectFooterViewVisibility() // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) @@ -492,6 +495,22 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas } @Test + @EnableSceneContainer + fun shouldShowFooterView_falseWhenShadeIsClosed() = + testScope.runTest { + val shouldShow by collectLastValue(underTest.shouldShowFooterView) + + // WHEN shade is closed + fakeKeyguardRepository.setStatusBarState(StatusBarState.SHADE) + shadeTestUtil.setShadeExpansion(0f) + runCurrent() + + // THEN footer is hidden + assertThat(shouldShow?.value).isFalse() + } + + @Test + @DisableSceneContainer fun shouldHideFooterView_trueWhenShadeIsClosed() = testScope.runTest { val shouldHide by collectLastValue(underTest.shouldHideFooterView) @@ -506,6 +525,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas } @Test + @DisableSceneContainer fun shouldHideFooterView_falseWhenShadeIsOpen() = testScope.runTest { val shouldHide by collectLastValue(underTest.shouldHideFooterView) @@ -520,6 +540,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas } @Test + @DisableSceneContainer fun shouldHideFooterView_falseWhenQSPartiallyOpen() = testScope.runTest { val shouldHide by collectLastValue(underTest.shouldHideFooterView) @@ -642,4 +663,10 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas assertThat(animationsEnabled).isTrue() } + + private fun TestScope.collectFooterViewVisibility() = + collectLastValue( + if (SceneContainerFlag.isEnabled) underTest.shouldShowFooterView + else underTest.shouldIncludeFooterView + ) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index ef1bcfc45879..cccac4b479dd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -682,7 +682,10 @@ public class StackScrollAlgorithm { // doesn't get updated quickly enough and can cause the footer to flash when // closing the shade. As such, we temporarily also check the ambientState directly. if (((FooterView) view).shouldBeHidden() || !ambientState.isShadeExpanded()) { - viewState.hidden = true; + // Note: This is no longer necessary in flexiglass. + if (!SceneContainerFlag.isEnabled()) { + viewState.hidden = true; + } } else { final float footerEnd = algorithmState.mCurrentExpandedYPosition + view.getIntrinsicHeight(); @@ -691,7 +694,6 @@ public class StackScrollAlgorithm { noSpaceForFooter || (ambientState.isClearAllInProgress() && !hasNonClearableNotifs(algorithmState)); } - } else { final boolean shadeClosed = !ambientState.isShadeExpanded(); final boolean isShelfShowing = algorithmState.firstViewInShelf != null; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationListViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationListViewBinder.kt index d770b2003f3b..dc9615c25ada 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationListViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationListViewBinder.kt @@ -188,15 +188,26 @@ constructor( .startHistoryIntent(view, /* showHistory= */ true) }, ) - launch { - viewModel.shouldIncludeFooterView.collect { animatedVisibility -> - footerView.setVisible( - /* visible = */ animatedVisibility.value, - /* animate = */ animatedVisibility.isAnimating, - ) + if (SceneContainerFlag.isEnabled) { + launch { + viewModel.shouldShowFooterView.collect { animatedVisibility -> + footerView.setVisible( + /* visible = */ animatedVisibility.value, + /* animate = */ animatedVisibility.isAnimating, + ) + } + } + } else { + launch { + viewModel.shouldIncludeFooterView.collect { animatedVisibility -> + footerView.setVisible( + /* visible = */ animatedVisibility.value, + /* animate = */ animatedVisibility.isAnimating, + ) + } } + launch { viewModel.shouldHideFooterView.collect { footerView.setShouldBeHidden(it) } } } - launch { viewModel.shouldHideFooterView.collect { footerView.setShouldBeHidden(it) } } disposableHandle.awaitCancellationThenDispose() } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt index e55492e67d02..4e2a46d78a5d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt @@ -32,6 +32,7 @@ import com.android.systemui.statusbar.notification.stack.domain.interactor.Notif import com.android.systemui.statusbar.policy.domain.interactor.UserSetupInteractor import com.android.systemui.statusbar.policy.domain.interactor.ZenModeInteractor import com.android.systemui.util.kotlin.FlowDumperImpl +import com.android.systemui.util.kotlin.combine import com.android.systemui.util.kotlin.sample import com.android.systemui.util.ui.AnimatableEvent import com.android.systemui.util.ui.AnimatedValue @@ -120,6 +121,7 @@ constructor( * This essentially corresponds to having the view set to INVISIBLE. */ val shouldHideFooterView: Flow by lazy { + SceneContainerFlag.assertInLegacyMode() if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { @@ -143,6 +145,7 @@ constructor( * be hidden by another condition (see [shouldHideFooterView] above). */ val shouldIncludeFooterView: Flow> by lazy { + SceneContainerFlag.assertInLegacyMode() if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(AnimatedValue.NotAnimating(false)) } else { @@ -207,6 +210,76 @@ constructor( } } + // This flow replaces shouldHideFooterView+shouldIncludeFooterView in flexiglass. + val shouldShowFooterView: Flow> by lazy { + if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) { + flowOf(AnimatedValue.NotAnimating(false)) + } else { + combine( + activeNotificationsInteractor.areAnyNotificationsPresent, + userSetupInteractor.isUserSetUp, + notificationStackInteractor.isShowingOnLockscreen, + shadeInteractor.isQsFullscreen, + remoteInputInteractor.isRemoteInputActive, + shadeInteractor.shadeExpansion.map { it < 0.5f }.distinctUntilChanged(), + ) { + hasNotifications, + isUserSetUp, + isShowingOnLockscreen, + qsFullScreen, + isRemoteInputActive, + shadeLessThanHalfwayExpanded -> + when { + !hasNotifications -> VisibilityChange.DISAPPEAR_WITH_ANIMATION + // Hide the footer until the user setup is complete, to prevent access + // to settings (b/193149550). + !isUserSetUp -> VisibilityChange.DISAPPEAR_WITH_ANIMATION + // Do not show the footer if the lockscreen is visible (incl. AOD), + // except if the shade is opened on top. See also b/219680200. + // Do not animate, as that makes the footer appear briefly when + // transitioning between the shade and keyguard. + isShowingOnLockscreen -> VisibilityChange.DISAPPEAR_WITHOUT_ANIMATION + // Do not show the footer if quick settings are fully expanded (except + // for the foldable split shade view). See b/201427195 && b/222699879. + qsFullScreen -> VisibilityChange.DISAPPEAR_WITH_ANIMATION + // Hide the footer if remote input is active (i.e. user is replying to a + // notification). See b/75984847. + isRemoteInputActive -> VisibilityChange.DISAPPEAR_WITH_ANIMATION + // If the shade is not expanded enough, the footer shouldn't be visible. + shadeLessThanHalfwayExpanded -> VisibilityChange.DISAPPEAR_WITH_ANIMATION + else -> VisibilityChange.APPEAR_WITH_ANIMATION + } + } + .distinctUntilChanged( + // Equivalent unless visibility changes + areEquivalent = { a: VisibilityChange, b: VisibilityChange -> + a.visible == b.visible + } + ) + // Should we animate the visibility change? + .sample( + // TODO(b/322167853): This check is currently duplicated in FooterViewModel, + // but instead it should be a field in ShadeAnimationInteractor. + combine( + shadeInteractor.isShadeFullyExpanded, + shadeInteractor.isShadeTouchable, + ::Pair + ) + .onStart { emit(Pair(false, false)) } + ) { visibilityChange, (isShadeFullyExpanded, animationsEnabled) -> + // Animate if the shade is interactive, but NOT on the lockscreen. Having + // animations enabled while on the lockscreen makes the footer appear briefly + // when transitioning between the shade and keyguard. + val shouldAnimate = + isShadeFullyExpanded && animationsEnabled && visibilityChange.canAnimate + AnimatableEvent(visibilityChange.visible, shouldAnimate) + } + .toAnimatedValueFlow() + .dumpWhileCollecting("shouldShowFooterView") + .flowOn(bgDispatcher) + } + } + enum class VisibilityChange(val visible: Boolean, val canAnimate: Boolean) { DISAPPEAR_WITHOUT_ANIMATION(visible = false, canAnimate = false), DISAPPEAR_WITH_ANIMATION(visible = false, canAnimate = true), -- GitLab From 06daf89920f1be0c1e54e83bffca7c83bd597073 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Fri, 6 Sep 2024 08:11:58 +0000 Subject: [PATCH 105/492] Use sync transaction for prepare open transition. Make transaction synchronized when animation happen. Bug: 347168362 Flag: com.android.window.flags.migrate_predictive_back_transition Test: verify PB back-to-home animation apply with start transation Change-Id: Ia918568af83b90397d1627355a2f5279860015a3 --- .../server/wm/BackNavigationController.java | 83 ++++++++++++------- 1 file changed, 51 insertions(+), 32 deletions(-) diff --git a/services/core/java/com/android/server/wm/BackNavigationController.java b/services/core/java/com/android/server/wm/BackNavigationController.java index 4e4616dcaa3f..0646fb74ddfd 100644 --- a/services/core/java/com/android/server/wm/BackNavigationController.java +++ b/services/core/java/com/android/server/wm/BackNavigationController.java @@ -1072,8 +1072,10 @@ class BackNavigationController { return close.asWindowState() != null; } - private void initiate(@NonNull WindowContainer close, @NonNull WindowContainer[] open, + private void initiate(ScheduleAnimationBuilder builder, @NonNull ActivityRecord[] openingActivities) { + WindowContainer close = builder.mCloseTarget; + WindowContainer[] open = builder.mOpenTargets; if (isActivitySwitch(close, open)) { mSwitchType = ACTIVITY_SWITCH; if (Flags.migratePredictiveBackTransition()) { @@ -1091,9 +1093,17 @@ class BackNavigationController { return; } - mCloseAdaptor = createAdaptor(close, false, mSwitchType); + final Transition prepareTransition = builder.prepareTransitionIfNeeded( + openingActivities); + final SurfaceControl.Transaction st = openingActivities[0].getSyncTransaction(); + final SurfaceControl.Transaction ct = prepareTransition != null + ? st : close.getPendingTransaction(); + mCloseAdaptor = createAdaptor(close, false, mSwitchType, ct); if (mCloseAdaptor.mAnimationTarget == null) { Slog.w(TAG, "composeNewAnimations fail, skip"); + if (prepareTransition != null) { + prepareTransition.abort(); + } clearBackAnimateTarget(true /* cancel */); return; } @@ -1110,12 +1120,17 @@ class BackNavigationController { next.getWindowConfiguration().getRotation()); } } - mOpenAnimAdaptor = new BackWindowAnimationAdaptorWrapper(true, mSwitchType, open); + mOpenAnimAdaptor = new BackWindowAnimationAdaptorWrapper( + true, mSwitchType, st, open); if (!mOpenAnimAdaptor.isValid()) { Slog.w(TAG, "compose animations fail, skip"); + if (prepareTransition != null) { + prepareTransition.abort(); + } clearBackAnimateTarget(true /* cancel */); return; } + mOpenAnimAdaptor.mPreparedOpenTransition = prepareTransition; mOpenActivities = openingActivities; } @@ -1147,19 +1162,21 @@ class BackNavigationController { return new Pair<>(replaceClose, replaceOpen); } - private boolean composeAnimations(@NonNull WindowContainer close, - @NonNull WindowContainer[] open, @NonNull ActivityRecord[] openingActivities) { + private boolean composeAnimations(@NonNull ScheduleAnimationBuilder builder, + @NonNull ActivityRecord[] openingActivities) { if (mComposed || mWaitTransition) { Slog.e(TAG, "Previous animation is running " + this); return false; } clearBackAnimateTarget(true /* cancel */); - if (close == null || open == null || open.length == 0 || open.length > 2) { + final WindowContainer[] open = builder.mOpenTargets; + if (builder.mCloseTarget == null || open == null || open.length == 0 + || open.length > 2) { Slog.e(TAG, "reset animation with null target close: " - + close + " open: " + Arrays.toString(open)); + + builder.mCloseTarget + " open: " + Arrays.toString(open)); return false; } - initiate(close, open, openingActivities); + initiate(builder, openingActivities); if (mSwitchType == UNKNOWN) { return false; } @@ -1384,10 +1401,10 @@ class BackNavigationController { } @NonNull private static BackWindowAnimationAdaptor createAdaptor( - @NonNull WindowContainer target, boolean isOpen, int switchType) { + @NonNull WindowContainer target, boolean isOpen, int switchType, + SurfaceControl.Transaction st) { final BackWindowAnimationAdaptor adaptor = new BackWindowAnimationAdaptor(target, isOpen, switchType); - final SurfaceControl.Transaction pt = target.getPendingTransaction(); // Workaround to show TaskFragment which can be hide in Transitions and won't show // during isAnimating. if (isOpen && target.asActivityRecord() != null) { @@ -1395,10 +1412,10 @@ class BackNavigationController { if (fragment != null) { // Ensure task fragment surface has updated, in case configuration has changed. fragment.updateOrganizedTaskFragmentSurface(); - pt.show(fragment.mSurfaceControl); + st.show(fragment.mSurfaceControl); } } - target.startAnimation(pt, adaptor, false /* hidden */, ANIMATION_TYPE_PREDICT_BACK); + target.startAnimation(st, adaptor, false /* hidden */, ANIMATION_TYPE_PREDICT_BACK); return adaptor; } @@ -1417,12 +1434,12 @@ class BackNavigationController { private Transition mPreparedOpenTransition; BackWindowAnimationAdaptorWrapper(boolean isOpen, int switchType, - @NonNull WindowContainer... targets) { + SurfaceControl.Transaction st, @NonNull WindowContainer... targets) { mAdaptors = new BackWindowAnimationAdaptor[targets.length]; for (int i = targets.length - 1; i >= 0; --i) { - mAdaptors[i] = createAdaptor(targets[i], isOpen, switchType); + mAdaptors[i] = createAdaptor(targets[i], isOpen, switchType, st); } - mRemoteAnimationTarget = targets.length > 1 ? createWrapTarget() + mRemoteAnimationTarget = targets.length > 1 ? createWrapTarget(st) : mAdaptors[0].mAnimationTarget; } @@ -1448,7 +1465,7 @@ class BackNavigationController { mPreparedOpenTransition = null; } - private RemoteAnimationTarget createWrapTarget() { + private RemoteAnimationTarget createWrapTarget(SurfaceControl.Transaction st) { // Special handle for opening two activities together. // If we animate both activities separately, the animation area and rounded corner // would also being handled separately. To make them seem like "open" together, wrap @@ -1470,12 +1487,11 @@ class BackNavigationController { .build(); mCloseTransaction = new SurfaceControl.Transaction(); mCloseTransaction.reparent(leashSurface, null); - final SurfaceControl.Transaction pt = wc.getPendingTransaction(); - pt.setLayer(leashSurface, wc.getLastLayer()); + st.setLayer(leashSurface, wc.getLastLayer()); for (int i = mAdaptors.length - 1; i >= 0; --i) { BackWindowAnimationAdaptor adaptor = mAdaptors[i]; - pt.reparent(adaptor.mAnimationTarget.leash, leashSurface); - pt.setPosition(adaptor.mAnimationTarget.leash, + st.reparent(adaptor.mAnimationTarget.leash, leashSurface); + st.setPosition(adaptor.mAnimationTarget.leash, adaptor.mAnimationTarget.localBounds.left, adaptor.mAnimationTarget.localBounds.top); // For adjacent activity embedded, reparent Activity to TaskFragment when @@ -1738,6 +1754,7 @@ class BackNavigationController { WindowContainer mCloseTarget; WindowContainer[] mOpenTargets; boolean mIsLaunchBehind; + TaskSnapshot mSnapshot; ScheduleAnimationBuilder(int type, BackAnimationAdapter adapter, NavigationMonitor monitor) { @@ -1771,6 +1788,13 @@ class BackNavigationController { return wc == mCloseTarget || mCloseTarget.hasChild(wc) || wc.hasChild(mCloseTarget); } + private Transition prepareTransitionIfNeeded(ActivityRecord[] visibleOpenActivities) { + if (mSnapshot == null) { + return setLaunchBehind(visibleOpenActivities); + } + return null; + } + /** * Apply preview strategy on the opening target * @@ -1780,26 +1804,17 @@ class BackNavigationController { private void applyPreviewStrategy( @NonNull BackWindowAnimationAdaptorWrapper openAnimationAdaptor, @NonNull ActivityRecord[] visibleOpenActivities) { - boolean needsLaunchBehind = true; if (isSupportWindowlessSurface() && mShowWindowlessSurface && !mIsLaunchBehind) { boolean activitiesAreDrawn = false; for (int i = visibleOpenActivities.length - 1; i >= 0; --i) { // If the activity hasn't stopped, it's window should remain drawn. activitiesAreDrawn |= visibleOpenActivities[i].firstWindowDrawn; } - final WindowContainer mainOpen = openAnimationAdaptor.mAdaptors[0].mTarget; - final TaskSnapshot snapshot = getSnapshot(mainOpen, visibleOpenActivities); // Don't create starting surface if previous activities haven't stopped or // the snapshot does not exist. - if (snapshot != null || !activitiesAreDrawn) { - openAnimationAdaptor.createStartingSurface(snapshot); + if (mSnapshot != null || !activitiesAreDrawn) { + openAnimationAdaptor.createStartingSurface(mSnapshot); } - // Only use LaunchBehind if snapshot does not exist. - needsLaunchBehind = snapshot == null; - } - if (needsLaunchBehind) { - openAnimationAdaptor.mPreparedOpenTransition = - setLaunchBehind(visibleOpenActivities); } // Force update mLastSurfaceShowing for opening activity and its task. if (mWindowManagerService.mRoot.mTransitionController.isShellTransitionsEnabled()) { @@ -1821,7 +1836,11 @@ class BackNavigationController { return null; } - if (!composeAnimations(mCloseTarget, mOpenTargets, openingActivities)) { + if (!shouldLaunchBehind && mShowWindowlessSurface) { + mSnapshot = getSnapshot(mOpenTargets[0], openingActivities); + } + + if (!composeAnimations(this, openingActivities)) { return null; } mCloseTarget.mTransitionController.mSnapshotController -- GitLab From a8c39a41f1454c486759a043d9763099ac8ffb75 Mon Sep 17 00:00:00 2001 From: Utkarsh Nigam Date: Mon, 9 Sep 2024 10:29:37 +0000 Subject: [PATCH 106/492] Add method to retrieve document by id. Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: I801f5c15f248689376dfe405aace8895799b34fa --- .../appfunctions/FutureAppSearchSession.java | 57 +++++++++++++++++++ .../FutureAppSearchSessionTest.kt | 33 +++++++++++ 2 files changed, 90 insertions(+) diff --git a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java index 03dd5dd62e51..094723814e17 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java +++ b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java @@ -22,6 +22,9 @@ import android.app.appsearch.AppSearchManager; import android.app.appsearch.AppSearchManager.SearchContext; import android.app.appsearch.AppSearchResult; import android.app.appsearch.AppSearchSession; +import android.app.appsearch.BatchResultCallback; +import android.app.appsearch.GenericDocument; +import android.app.appsearch.GetByDocumentIdRequest; import android.app.appsearch.GetSchemaResponse; import android.app.appsearch.PutDocumentsRequest; import android.app.appsearch.SearchResult; @@ -189,4 +192,58 @@ public class FutureAppSearchSession implements Closeable { }); } } + + /** A future API to retrieve a document by its id from the local AppSearch session. */ + public AndroidFuture getByDocumentId( + @NonNull String documentId, @NonNull String namespace) { + Objects.requireNonNull(documentId); + Objects.requireNonNull(namespace); + + GetByDocumentIdRequest request = + new GetByDocumentIdRequest.Builder(namespace) + .addIds(documentId) + .build(); + return getSessionAsync() + .thenCompose( + session -> { + AndroidFuture> + batchResultFuture = new AndroidFuture<>(); + session.getByDocumentId( + request, + mExecutor, + new BatchResultCallbackAdapter<>(batchResultFuture)); + + return batchResultFuture.thenApply( + batchResult -> + getGenericDocumentFromBatchResult( + batchResult, documentId)); + }); + } + + private static GenericDocument getGenericDocumentFromBatchResult( + AppSearchBatchResult result, String documentId) { + if (result.isSuccess()) { + return result.getSuccesses().get(documentId); + } + throw new IllegalArgumentException("No document in the result for id: " + documentId); + } + + private static final class BatchResultCallbackAdapter + implements BatchResultCallback { + private final AndroidFuture> mFuture; + + BatchResultCallbackAdapter(AndroidFuture> future) { + mFuture = future; + } + + @Override + public void onResult(@NonNull AppSearchBatchResult result) { + mFuture.complete(result); + } + + @Override + public void onSystemError(Throwable t) { + mFuture.completeExceptionally(t); + } + } } diff --git a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt index a323799e85e5..a0f1a559bb52 100644 --- a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt +++ b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt @@ -16,6 +16,7 @@ package com.android.server.appfunctions import android.app.appfunctions.AppFunctionRuntimeMetadata +import android.app.appfunctions.AppFunctionRuntimeMetadata.APP_FUNCTION_RUNTIME_NAMESPACE import android.app.appfunctions.AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema import android.app.appfunctions.AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema import android.app.appsearch.AppSearchManager @@ -123,6 +124,38 @@ class FutureAppSearchSessionTest { } } + @Test + fun getByDocumentId() { + val searchContext = AppSearchManager.SearchContext.Builder(TEST_DB).build() + FutureAppSearchSession(appSearchManager, testExecutor, searchContext).use { session -> + val setSchemaRequest = + SetSchemaRequest.Builder() + .addSchemas( + createParentAppFunctionRuntimeSchema(), + createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME) + ) + .build() + val schema = session.setSchema(setSchemaRequest) + val appFunctionRuntimeMetadata = + AppFunctionRuntimeMetadata.Builder(TEST_PACKAGE_NAME, TEST_FUNCTION_ID, "").build() + val putDocumentsRequest: PutDocumentsRequest = + PutDocumentsRequest.Builder() + .addGenericDocuments(appFunctionRuntimeMetadata) + .build() + val putResult = session.put(putDocumentsRequest) + + val genricDocument = session + .getByDocumentId( + /* documentId= */ "${TEST_PACKAGE_NAME}/${TEST_FUNCTION_ID}", + APP_FUNCTION_RUNTIME_NAMESPACE + ) + .get() + + val foundAppFunctionRuntimeMetadata = AppFunctionRuntimeMetadata(genricDocument) + assertThat(foundAppFunctionRuntimeMetadata.functionId).isEqualTo(TEST_FUNCTION_ID) + } + } + private companion object { const val TEST_DB: String = "test_db" const val TEST_PACKAGE_NAME: String = "test_pkg" -- GitLab From 6492a9dd7ce7de25083b2883218d48bbf3e1afaa Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Fri, 6 Sep 2024 15:26:10 +0000 Subject: [PATCH 107/492] Use flatMap to ensure NSSL alpha becomes 1f when GONE When transitioning to OCCLUDED/GONE states, also listen for statusBarState == SHADE, and when both conditions are met, emit the shade alpha, which will be 1f. This ensures HUNs will appear all of the time. Otherwise, let normal transitions determine alpha. Fixes: 357316448 Test: atest SharedNotificationContainerViewModelTest Flag: com.android.systemui.migrate_clocks_to_blueprint Change-Id: I372f5d19cbd1074a2bf29b35afee9f23b50c466c --- ...haredNotificationContainerViewModelTest.kt | 166 +++++--------- .../SharedNotificationContainerBinder.kt | 10 +- .../SharedNotificationContainerViewModel.kt | 211 ++++++++---------- 3 files changed, 141 insertions(+), 246 deletions(-) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt index 3f97f0b7a67d..425f16ec7da1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt @@ -312,7 +312,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = LOCKSCREEN, to = GLANCEABLE_HUB, value = 0f, - ) + ), ) runCurrent() @@ -321,7 +321,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S Transition( from = Scenes.Lockscreen, to = Scenes.Communal, - progress = flowOf(progress) + progress = flowOf(progress), ), stateTransition = TransitionStep( @@ -329,7 +329,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = LOCKSCREEN, to = GLANCEABLE_HUB, value = progress, - ) + ), ) runCurrent() @@ -344,7 +344,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = LOCKSCREEN, to = GLANCEABLE_HUB, value = 1f, - ) + ), ) assertThat(alpha).isEqualTo(0f) @@ -378,7 +378,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = DREAMING, to = GLANCEABLE_HUB, value = 0f, - ) + ), ) runCurrent() kosmos.setTransition( @@ -386,7 +386,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S Transition( from = Scenes.Lockscreen, to = Scenes.Communal, - progress = flowOf(progress) + progress = flowOf(progress), ), stateTransition = TransitionStep( @@ -394,7 +394,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = DREAMING, to = GLANCEABLE_HUB, value = progress, - ) + ), ) runCurrent() // Keep notifications hidden during the transition from dream to hub @@ -409,7 +409,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = DREAMING, to = GLANCEABLE_HUB, value = 1f, - ) + ), ) assertThat(alpha).isEqualTo(0f) } @@ -435,13 +435,13 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S kosmos.setTransition( sceneTransition = Idle(Scenes.Gone), - stateTransition = TransitionStep(from = LOCKSCREEN, to = GONE) + stateTransition = TransitionStep(from = LOCKSCREEN, to = GONE), ) assertThat(isOnLockscreen).isFalse() kosmos.setTransition( sceneTransition = Idle(Scenes.Lockscreen), - stateTransition = TransitionStep(from = GONE, to = LOCKSCREEN) + stateTransition = TransitionStep(from = GONE, to = LOCKSCREEN), ) assertThat(isOnLockscreen).isTrue() // While progressing from lockscreen, should still be true @@ -452,28 +452,20 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = LOCKSCREEN, to = GONE, value = 0.8f, - transitionState = TransitionState.RUNNING - ) + transitionState = TransitionState.RUNNING, + ), ) assertThat(isOnLockscreen).isTrue() kosmos.setTransition( sceneTransition = Idle(Scenes.Lockscreen), - stateTransition = - TransitionStep( - from = GONE, - to = LOCKSCREEN, - ) + stateTransition = TransitionStep(from = GONE, to = LOCKSCREEN), ) assertThat(isOnLockscreen).isTrue() kosmos.setTransition( sceneTransition = Idle(Scenes.Bouncer), - stateTransition = - TransitionStep( - from = LOCKSCREEN, - to = PRIMARY_BOUNCER, - ) + stateTransition = TransitionStep(from = LOCKSCREEN, to = PRIMARY_BOUNCER), ) assertThat(isOnLockscreen).isTrue() } @@ -527,11 +519,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S // Move to glanceable hub kosmos.setTransition( sceneTransition = Idle(Scenes.Communal), - stateTransition = - TransitionStep( - from = LOCKSCREEN, - to = GLANCEABLE_HUB, - ) + stateTransition = TransitionStep(from = LOCKSCREEN, to = GLANCEABLE_HUB), ) assertThat(isOnGlanceableHubWithoutShade).isTrue() @@ -553,11 +541,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S shadeTestUtil.setLockscreenShadeExpansion(0f) kosmos.setTransition( sceneTransition = Idle(Scenes.Communal), - stateTransition = - TransitionStep( - from = LOCKSCREEN, - to = GLANCEABLE_HUB, - ) + stateTransition = TransitionStep(from = LOCKSCREEN, to = GLANCEABLE_HUB), ) assertThat(isOnGlanceableHubWithoutShade).isTrue() } @@ -779,7 +763,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S configurationRepository.setDimensionPixelSize( R.dimen.keyguard_translate_distance_on_swipe_up, - -100 + -100, ) configurationRepository.onAnyConfigurationChange() @@ -800,7 +784,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S configurationRepository.setDimensionPixelSize( R.dimen.keyguard_translate_distance_on_swipe_up, - -100 + -100, ) configurationRepository.onAnyConfigurationChange() @@ -839,7 +823,8 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S fun alphaOnFullQsExpansion() = testScope.runTest { val viewState = ViewStateAccessor() - val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) + val alpha by + collectLastValue(underTest.keyguardAlpha(viewState, testScope.backgroundScope)) showLockscreenWithQSExpanded() @@ -856,12 +841,15 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S @Test @BrokenWithSceneContainer(330311871) - fun alphaDoesNotUpdateWhileGoneTransitionIsRunning() = + fun alphaWhenGoneIsSetToOne() = testScope.runTest { val viewState = ViewStateAccessor() - val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) + val alpha by + collectLastValue(underTest.keyguardAlpha(viewState, testScope.backgroundScope)) showLockscreen() + assertThat(alpha).isEqualTo(1f) + // GONE transition gets to 90% complete keyguardTransitionRepository.sendTransitionStep( TransitionStep( @@ -881,65 +869,23 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S ) ) runCurrent() + // Change in state should not immediately set value to 1f. Should wait for + // transition to complete + keyguardRepository.setStatusBarState(StatusBarState.SHADE) - // At this point, alpha should be zero - assertThat(alpha).isEqualTo(0f) - - // An attempt to override by the shade should be ignored - shadeTestUtil.setQsExpansion(0.5f) - assertThat(alpha).isEqualTo(0f) - } - - @Test - fun alphaDoesNotUpdateWhileOcclusionTransitionIsRunning() = - testScope.runTest { - val viewState = ViewStateAccessor() - val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) + // Transition is active, and NSSL should be nearly faded out + assertThat(alpha).isLessThan(0.5f) - showLockscreen() - // OCCLUDED transition gets to 90% complete keyguardTransitionRepository.sendTransitionStep( TransitionStep( from = LOCKSCREEN, - to = OCCLUDED, - transitionState = TransitionState.STARTED, - value = 0f, - ) - ) - runCurrent() - keyguardTransitionRepository.sendTransitionStep( - TransitionStep( - from = LOCKSCREEN, - to = OCCLUDED, - transitionState = TransitionState.RUNNING, - value = 0.9f, + to = GONE, + transitionState = TransitionState.FINISHED, + value = 1f, ) ) runCurrent() - - // At this point, alpha should be zero - assertThat(alpha).isEqualTo(0f) - - // An attempt to override by the shade should be ignored - shadeTestUtil.setQsExpansion(0.5f) - assertThat(alpha).isEqualTo(0f) - } - - @Test - fun alphaWhenGoneIsSetToOne() = - testScope.runTest { - val viewState = ViewStateAccessor() - val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) - - showLockscreen() - - keyguardTransitionRepository.sendTransitionSteps( - from = LOCKSCREEN, - to = GONE, - testScope - ) - keyguardRepository.setStatusBarState(StatusBarState.SHADE) - + // Should reset to 1f assertThat(alpha).isEqualTo(1f) } @@ -978,11 +924,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S assertThat(fadeIn[0]).isEqualTo(false) // ... then user hits power to go to AOD - keyguardTransitionRepository.sendTransitionSteps( - from = LOCKSCREEN, - to = AOD, - testScope, - ) + keyguardTransitionRepository.sendTransitionSteps(from = LOCKSCREEN, to = AOD, testScope) // ... followed by a shade collapse showLockscreen() // ... does not trigger a fade in @@ -994,7 +936,8 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S fun alpha_isZero_fromPrimaryBouncerToGoneWhileCommunalSceneVisible() = testScope.runTest { val viewState = ViewStateAccessor() - val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) + val alpha by + collectLastValue(underTest.keyguardAlpha(viewState, testScope.backgroundScope)) showPrimaryBouncer() showCommunalScene() @@ -1039,7 +982,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = PRIMARY_BOUNCER, to = GONE, transitionState = TransitionState.FINISHED, - value = 1f + value = 1f, ) ) runCurrent() @@ -1052,7 +995,8 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S fun alpha_fromPrimaryBouncerToGoneWhenCommunalSceneNotVisible() = testScope.runTest { val viewState = ViewStateAccessor() - val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) + val alpha by + collectLastValue(underTest.keyguardAlpha(viewState, testScope.backgroundScope)) showPrimaryBouncer() hideCommunalScene() @@ -1095,7 +1039,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = PRIMARY_BOUNCER, to = GONE, transitionState = TransitionState.FINISHED, - value = 1f + value = 1f, ) ) runCurrent() @@ -1107,7 +1051,8 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S fun alpha_isZero_fromAlternateBouncerToGoneWhileCommunalSceneVisible() = testScope.runTest { val viewState = ViewStateAccessor() - val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) + val alpha by + collectLastValue(underTest.keyguardAlpha(viewState, testScope.backgroundScope)) showAlternateBouncer() showCommunalScene() @@ -1152,7 +1097,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = ALTERNATE_BOUNCER, to = GONE, transitionState = TransitionState.FINISHED, - value = 1f + value = 1f, ) ) runCurrent() @@ -1165,7 +1110,8 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S fun alpha_fromAlternateBouncerToGoneWhenCommunalSceneNotVisible() = testScope.runTest { val viewState = ViewStateAccessor() - val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) + val alpha by + collectLastValue(underTest.keyguardAlpha(viewState, testScope.backgroundScope)) showAlternateBouncer() hideCommunalScene() @@ -1208,7 +1154,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S from = ALTERNATE_BOUNCER, to = GONE, transitionState = TransitionState.FINISHED, - value = 1f + value = 1f, ) ) runCurrent() @@ -1221,11 +1167,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S runCurrent() keyguardRepository.setStatusBarState(StatusBarState.KEYGUARD) runCurrent() - keyguardTransitionRepository.sendTransitionSteps( - from = AOD, - to = LOCKSCREEN, - testScope, - ) + keyguardTransitionRepository.sendTransitionSteps(from = AOD, to = LOCKSCREEN, testScope) } private suspend fun TestScope.showDream() { @@ -1247,11 +1189,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S runCurrent() keyguardRepository.setStatusBarState(StatusBarState.SHADE_LOCKED) runCurrent() - keyguardTransitionRepository.sendTransitionSteps( - from = AOD, - to = LOCKSCREEN, - testScope, - ) + keyguardTransitionRepository.sendTransitionSteps(from = AOD, to = LOCKSCREEN, testScope) } private suspend fun TestScope.showLockscreenWithQSExpanded() { @@ -1260,11 +1198,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S runCurrent() keyguardRepository.setStatusBarState(StatusBarState.SHADE_LOCKED) runCurrent() - keyguardTransitionRepository.sendTransitionSteps( - from = AOD, - to = LOCKSCREEN, - testScope, - ) + keyguardTransitionRepository.sendTransitionSteps(from = AOD, to = LOCKSCREEN, testScope) } private suspend fun TestScope.showPrimaryBouncer() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/SharedNotificationContainerBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/SharedNotificationContainerBinder.kt index aa1911e4cd2a..5ae5a3213954 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/SharedNotificationContainerBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/SharedNotificationContainerBinder.kt @@ -62,7 +62,6 @@ constructor( viewModel: SharedNotificationContainerViewModel, ): DisposableHandle { val disposables = DisposableHandles() - disposables += view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.CREATED) { @@ -87,10 +86,7 @@ constructor( } val burnInParams = MutableStateFlow(BurnInParameters()) - val viewState = - ViewStateAccessor( - alpha = { controller.getAlpha() }, - ) + val viewState = ViewStateAccessor(alpha = { controller.getAlpha() }) /* * For animation sensitive coroutines, immediately run just like applicationScope does @@ -108,7 +104,7 @@ constructor( addUpdateListener { animation -> controller.setMaxAlphaForKeyguard( animation.animatedFraction, - "SharedNotificationContainerVB (collapseFadeIn)" + "SharedNotificationContainerVB (collapseFadeIn)", ) } start() @@ -153,7 +149,7 @@ constructor( launch { viewModel.translationX.collect { x -> controller.translationX = x } } launch { - viewModel.keyguardAlpha(viewState).collect { + viewModel.keyguardAlpha(viewState, this).collect { controller.setMaxAlphaForKeyguard(it, "SharedNotificationContainerVB") } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt index aed00d8cd5be..e34eb61c5cbd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt @@ -20,7 +20,6 @@ package com.android.systemui.statusbar.notification.stack.ui.viewmodel import androidx.annotation.VisibleForTesting -import com.android.compose.animation.scene.SceneKey import com.android.systemui.common.shared.model.NotificationContainerBounds import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.dagger.SysUISingleton @@ -29,7 +28,6 @@ import com.android.systemui.dump.DumpManager import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.Edge -import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.KeyguardState.ALTERNATE_BOUNCER import com.android.systemui.keyguard.shared.model.KeyguardState.AOD import com.android.systemui.keyguard.shared.model.KeyguardState.DOZING @@ -41,7 +39,6 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.OCCLUDED import com.android.systemui.keyguard.shared.model.KeyguardState.PRIMARY_BOUNCER import com.android.systemui.keyguard.shared.model.StatusBarState.SHADE import com.android.systemui.keyguard.shared.model.StatusBarState.SHADE_LOCKED -import com.android.systemui.keyguard.shared.model.TransitionState.RUNNING import com.android.systemui.keyguard.ui.viewmodel.AlternateBouncerToGoneTransitionViewModel import com.android.systemui.keyguard.ui.viewmodel.AodBurnInViewModel import com.android.systemui.keyguard.ui.viewmodel.AodToGoneTransitionViewModel @@ -73,7 +70,6 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationStackAppearanceInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor import com.android.systemui.unfold.domain.interactor.UnfoldTransitionInteractor -import com.android.systemui.util.kotlin.BooleanFlowOperators.allOf import com.android.systemui.util.kotlin.BooleanFlowOperators.anyOf import com.android.systemui.util.kotlin.FlowDumperImpl import com.android.systemui.util.kotlin.Utils.Companion.sample as sampleCombine @@ -166,10 +162,9 @@ constructor( * before the other. */ private val isShadeLocked: Flow = - combine( - keyguardInteractor.statusBarState.map { it == SHADE_LOCKED }, - isAnyExpanded, - ) { isShadeLocked, isAnyExpanded -> + combine(keyguardInteractor.statusBarState.map { it == SHADE_LOCKED }, isAnyExpanded) { + isShadeLocked, + isAnyExpanded -> isShadeLocked && isAnyExpanded } .stateIn( @@ -220,23 +215,20 @@ constructor( keyguardTransitionInteractor.isFinishedIn(ALTERNATE_BOUNCER), keyguardTransitionInteractor.isFinishedIn( scene = Scenes.Bouncer, - stateWithoutSceneContainer = PRIMARY_BOUNCER + stateWithoutSceneContainer = PRIMARY_BOUNCER, ), keyguardTransitionInteractor.transitionValue(LOCKSCREEN).map { it > 0f }, ) .stateIn( scope = applicationScope, started = SharingStarted.Eagerly, - initialValue = false + initialValue = false, ) .dumpValue("isOnLockscreen") /** Are we purely on the keyguard without the shade/qs? */ val isOnLockscreenWithoutShade: Flow = - combine( - isOnLockscreen, - isAnyExpanded, - ) { isKeyguard, isAnyExpanded -> + combine(isOnLockscreen, isAnyExpanded) { isKeyguard, isAnyExpanded -> isKeyguard && !isAnyExpanded } .stateIn( @@ -251,16 +243,16 @@ constructor( combine( keyguardTransitionInteractor.isFinishedIn( scene = Scenes.Communal, - stateWithoutSceneContainer = GLANCEABLE_HUB + stateWithoutSceneContainer = GLANCEABLE_HUB, ), anyOf( keyguardTransitionInteractor.isInTransition( edge = Edge.create(to = Scenes.Communal), - edgeWithoutSceneContainer = Edge.create(to = GLANCEABLE_HUB) + edgeWithoutSceneContainer = Edge.create(to = GLANCEABLE_HUB), ), keyguardTransitionInteractor.isInTransition( edge = Edge.create(from = Scenes.Communal), - edgeWithoutSceneContainer = Edge.create(from = GLANCEABLE_HUB) + edgeWithoutSceneContainer = Edge.create(from = GLANCEABLE_HUB), ), ), ) { isOnGlanceableHub, transitioningToOrFromHub -> @@ -271,10 +263,7 @@ constructor( /** Are we purely on the glanceable hub without the shade/qs? */ val isOnGlanceableHubWithoutShade: Flow = - combine( - isOnGlanceableHub, - isAnyExpanded, - ) { isGlanceableHub, isAnyExpanded -> + combine(isOnGlanceableHub, isAnyExpanded) { isGlanceableHub, isAnyExpanded -> isGlanceableHub && !isAnyExpanded } .stateIn( @@ -286,10 +275,9 @@ constructor( /** Are we on the dream without the shade/qs? */ private val isDreamingWithoutShade: Flow = - combine( - keyguardTransitionInteractor.isFinishedIn(DREAMING), - isAnyExpanded, - ) { isDreaming, isAnyExpanded -> + combine(keyguardTransitionInteractor.isFinishedIn(DREAMING), isAnyExpanded) { + isDreaming, + isAnyExpanded -> isDreaming && !isAnyExpanded } .stateIn( @@ -310,7 +298,7 @@ constructor( keyguardTransitionInteractor.isInTransition( edge = Edge.create(from = LOCKSCREEN, to = AOD) ), - ::Pair + ::Pair, ) .transformWhile { (isOnLockscreenWithoutShade, aodTransitionIsRunning) -> // Wait until the AOD transition is complete before terminating @@ -375,7 +363,7 @@ constructor( keyguardTransitionInteractor.isInTransition, shadeInteractor.qsExpansion, ) - .onStart { emit(Triple(0f, false, 0f)) } + .onStart { emit(Triple(0f, false, 0f)) }, ) { onLockscreen, bounds, paddingTop, (top, isInTransitionToAnyState, qsExpansion) -> if (onLockscreen) { bounds.copy(top = bounds.top - paddingTop) @@ -383,10 +371,7 @@ constructor( // When QS expansion > 0, it should directly set the top padding so do not // animate it val animate = qsExpansion == 0f && !isInTransitionToAnyState - bounds.copy( - top = top, - isAnimated = animate, - ) + bounds.copy(top = top, isAnimated = animate) } } .stateIn( @@ -404,10 +389,9 @@ constructor( private val alphaForShadeAndQsExpansion: Flow = interactor.configurationBasedDimensions .flatMapLatest { configurationBasedDimensions -> - combineTransform( - shadeInteractor.shadeExpansion, - shadeInteractor.qsExpansion, - ) { shadeExpansion, qsExpansion -> + combineTransform(shadeInteractor.shadeExpansion, shadeInteractor.qsExpansion) { + shadeExpansion, + qsExpansion -> if (shadeExpansion > 0f || qsExpansion > 0f) { if (configurationBasedDimensions.useSplitShade) { emit(1f) @@ -424,47 +408,6 @@ constructor( .onStart { emit(1f) } .dumpWhileCollecting("alphaForShadeAndQsExpansion") - private val isTransitioningToHiddenKeyguard: Flow = - flow { - while (currentCoroutineContext().isActive) { - emit(false) - // Ensure states are inactive to start - allOf(isNotOnState(OCCLUDED), isNotOnState(GONE, Scenes.Gone)).first { it } - // Wait for a qualifying transition to begin - anyOf( - transitionToIsRunning(Edge.create(to = OCCLUDED)), - transitionToIsRunning( - edge = Edge.create(to = Scenes.Gone), - edgeWithoutSceneContainer = Edge.create(to = GONE) - ) - ) - .first { it } - emit(true) - // Now await the signal that SHADE state has been reached or the transition was - // reversed. Until SHADE state has been replaced it is the only source of when - // it is considered safe to reset alpha to 1f for HUNs. - combine( - keyguardInteractor.statusBarState, - allOf(isNotOnState(OCCLUDED), isNotOnState(GONE, Scenes.Gone)) - ) { statusBarState, stateIsReversed -> - statusBarState == SHADE || stateIsReversed - } - .first { it } - } - } - .dumpWhileCollecting("isTransitioningToHiddenKeyguard") - - private fun isNotOnState(stateWithoutSceneContainer: KeyguardState, scene: SceneKey? = null) = - keyguardTransitionInteractor - .transitionValue(scene = scene, stateWithoutSceneContainer = stateWithoutSceneContainer) - .map { it == 0f } - - private fun transitionToIsRunning(edge: Edge, edgeWithoutSceneContainer: Edge? = null) = - keyguardTransitionInteractor - .transition(edge = edge, edgeWithoutSceneContainer = edgeWithoutSceneContainer) - .map { it.value > 0f && it.transitionState == RUNNING } - .onStart { emit(false) } - val panelAlpha = keyguardInteractor.panelAlpha private fun bouncerToGoneNotificationAlpha(viewState: ViewStateAccessor): Flow = @@ -478,49 +421,72 @@ constructor( } .dumpWhileCollecting("bouncerToGoneNotificationAlpha") - fun keyguardAlpha(viewState: ViewStateAccessor): Flow { - // All transition view models are mututally exclusive, and safe to merge - val alphaTransitions = - merge( - keyguardInteractor.dismissAlpha.dumpWhileCollecting( - "keyguardInteractor.dismissAlpha" + private fun alphaForTransitions(viewState: ViewStateAccessor): Flow { + return merge( + keyguardInteractor.dismissAlpha.dumpWhileCollecting("keyguardInteractor.dismissAlpha"), + // All transition view models are mututally exclusive, and safe to merge + bouncerToGoneNotificationAlpha(viewState), + aodToGoneTransitionViewModel.notificationAlpha(viewState), + aodToLockscreenTransitionViewModel.notificationAlpha, + aodToOccludedTransitionViewModel.lockscreenAlpha(viewState), + dozingToLockscreenTransitionViewModel.lockscreenAlpha, + dozingToOccludedTransitionViewModel.lockscreenAlpha(viewState), + dreamingToLockscreenTransitionViewModel.lockscreenAlpha, + goneToAodTransitionViewModel.notificationAlpha, + goneToDreamingTransitionViewModel.lockscreenAlpha, + goneToDozingTransitionViewModel.notificationAlpha, + goneToLockscreenTransitionViewModel.lockscreenAlpha, + lockscreenToDreamingTransitionViewModel.lockscreenAlpha, + lockscreenToGoneTransitionViewModel.notificationAlpha(viewState), + lockscreenToOccludedTransitionViewModel.lockscreenAlpha, + lockscreenToPrimaryBouncerTransitionViewModel.lockscreenAlpha, + occludedToAodTransitionViewModel.lockscreenAlpha, + occludedToGoneTransitionViewModel.notificationAlpha(viewState), + occludedToLockscreenTransitionViewModel.lockscreenAlpha, + primaryBouncerToLockscreenTransitionViewModel.lockscreenAlpha(viewState), + glanceableHubToLockscreenTransitionViewModel.keyguardAlpha, + lockscreenToGlanceableHubTransitionViewModel.keyguardAlpha, + ) + } + + fun keyguardAlpha(viewState: ViewStateAccessor, scope: CoroutineScope): Flow { + // Transitions are not (yet) authoritative for NSSL; they still rely on StatusBarState to + // help determine when the device has fully moved to GONE or OCCLUDED state. Once SHADE + // state has been set, let shade alpha take over + val isKeyguardNotVisible = + combine( + anyOf( + keyguardTransitionInteractor.transitionValue(OCCLUDED).map { it == 1f }, + keyguardTransitionInteractor + .transitionValue(scene = Scenes.Gone, stateWithoutSceneContainer = GONE) + .map { it == 1f }, ), - bouncerToGoneNotificationAlpha(viewState), - aodToGoneTransitionViewModel.notificationAlpha(viewState), - aodToLockscreenTransitionViewModel.notificationAlpha, - aodToOccludedTransitionViewModel.lockscreenAlpha(viewState), - dozingToLockscreenTransitionViewModel.lockscreenAlpha, - dozingToOccludedTransitionViewModel.lockscreenAlpha(viewState), - dreamingToLockscreenTransitionViewModel.lockscreenAlpha, - goneToAodTransitionViewModel.notificationAlpha, - goneToDreamingTransitionViewModel.lockscreenAlpha, - goneToDozingTransitionViewModel.notificationAlpha, - goneToLockscreenTransitionViewModel.lockscreenAlpha, - lockscreenToDreamingTransitionViewModel.lockscreenAlpha, - lockscreenToGoneTransitionViewModel.notificationAlpha(viewState), - lockscreenToOccludedTransitionViewModel.lockscreenAlpha, - lockscreenToPrimaryBouncerTransitionViewModel.lockscreenAlpha, - occludedToAodTransitionViewModel.lockscreenAlpha, - occludedToGoneTransitionViewModel.notificationAlpha(viewState), - occludedToLockscreenTransitionViewModel.lockscreenAlpha, - primaryBouncerToLockscreenTransitionViewModel.lockscreenAlpha(viewState), - glanceableHubToLockscreenTransitionViewModel.keyguardAlpha, - lockscreenToGlanceableHubTransitionViewModel.keyguardAlpha, - ) + keyguardInteractor.statusBarState, + ) { isKeyguardNotVisibleInState, statusBarState -> + isKeyguardNotVisibleInState && statusBarState == SHADE + } - return merge( - alphaTransitions, - // These remaining cases handle alpha changes within an existing state, such as - // shade expansion or swipe to dismiss - combineTransform( - isTransitioningToHiddenKeyguard, - alphaForShadeAndQsExpansion, - ) { isTransitioningToHiddenKeyguard, alphaForShadeAndQsExpansion -> - if (!isTransitioningToHiddenKeyguard) { - emit(alphaForShadeAndQsExpansion) - } - }, - ) + // This needs to continue collecting the current value so that when it is selected in the + // flatMapLatest below, the last value gets emitted, to avoid the randomness of `merge`. + val alphaForTransitionsAndShade = + merge(alphaForTransitions(viewState), alphaForShadeAndQsExpansion) + .stateIn( + // Use view-level scope instead of ApplicationScope, to prevent collection that + // never stops + scope = scope, + started = SharingStarted.Eagerly, + initialValue = 1f, + ) + .dumpValue("alphaForTransitionsAndShade") + + return isKeyguardNotVisible + .flatMapLatest { isKeyguardNotVisible -> + if (isKeyguardNotVisible) { + alphaForShadeAndQsExpansion + } else { + alphaForTransitionsAndShade + } + } .distinctUntilChanged() .dumpWhileCollecting("keyguardAlpha") } @@ -543,9 +509,8 @@ constructor( ) // Manually emit on start because [notificationAlpha] only starts emitting // when transitions start. - .onStart { emit(1f) } - ) { isOnGlanceableHubWithoutShade, isOnLockscreen, isDreamingWithoutShade, alpha, - -> + .onStart { emit(1f) }, + ) { isOnGlanceableHubWithoutShade, isOnLockscreen, isDreamingWithoutShade, alpha -> if ((isOnGlanceableHubWithoutShade || isDreamingWithoutShade) && !isOnLockscreen) { // Notifications should not be visible on the glanceable hub. // TODO(b/321075734): implement a way to actually set the notifications to @@ -580,7 +545,7 @@ constructor( merge( keyguardInteractor.keyguardTranslationY, occludedToLockscreenTransitionViewModel.lockscreenTranslationY, - ) + ), ) { burnInY, isOnLockscreenWithoutShade, translationY -> if (isOnLockscreenWithoutShade) { burnInY + translationY @@ -604,7 +569,7 @@ constructor( unfoldTransitionInteractor.unfoldTranslationX(isOnStartSide = false) } else { emptyFlow() - } + }, ) .dumpWhileCollecting("translationX") @@ -634,7 +599,7 @@ constructor( primaryBouncerToGoneTransitionViewModel.showAllNotifications, alternateBouncerToGoneTransitionViewModel.showAllNotifications, ) - .onStart { emit(false) } + .onStart { emit(false) }, ) { isOnLockscreen, statusBarState, showAllNotifications -> statusBarState == SHADE_LOCKED || !isOnLockscreen || showAllNotifications } -- GitLab From 7910e6a29b5987bb23879c09118c65145cda9c60 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Mon, 9 Sep 2024 12:26:29 +0000 Subject: [PATCH 108/492] Check device sleeping state for bouncer visibility On reset when the device is going to sleep, the bouncer may be asked to be visible for SIM unlocks. Do not attempt to show the bouncer if the device is going to sleep. The dozing signal can sometimes come too late. Fixes: 351426938 Test: atest StatusBarKeyguardViewManagerTest Test: manual - race condition on reboot, hit power button when on SIM unlock Flag: com.android.systemui.sim_pin_race_condition_on_restart Change-Id: Id3ecac03bdaf31b8d54b63a44ef99a582a89a85b --- .../phone/StatusBarKeyguardViewManager.java | 9 ++++++++- .../StatusBarKeyguardViewManagerTest.java | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index dd4b0005b034..f3b937100db2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -182,6 +182,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb private boolean mBouncerShowingOverDream; private int mAttemptsToShowBouncer = 0; private DelayableExecutor mExecutor; + private boolean mIsSleeping = false; private final PrimaryBouncerExpansionCallback mExpansionCallback = new PrimaryBouncerExpansionCallback() { @@ -713,7 +714,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * {@link #needsFullscreenBouncer()}. */ protected void showBouncerOrKeyguard(boolean hideBouncerWhenShowing, boolean isFalsingReset) { - if (needsFullscreenBouncer() && !mDozing) { + boolean showBouncer = needsFullscreenBouncer() && !mDozing; + if (Flags.simPinRaceConditionOnRestart()) { + showBouncer = showBouncer && !mIsSleeping; + } + if (showBouncer) { // The keyguard might be showing (already). So we need to hide it. if (!primaryBouncerIsShowing()) { if (SceneContainerFlag.isEnabled()) { @@ -1041,6 +1046,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb @Override public void onStartedWakingUp() { + mIsSleeping = false; setRootViewAnimationDisabled(false); NavigationBarView navBarView = mCentralSurfaces.getNavigationBarView(); if (navBarView != null) { @@ -1054,6 +1060,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb @Override public void onStartedGoingToSleep() { + mIsSleeping = true; setRootViewAnimationDisabled(true); NavigationBarView navBarView = mCentralSurfaces.getNavigationBarView(); if (navBarView != null) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index 01a3d36a05ec..1d74331e429b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -1112,9 +1112,11 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { public void testShowBouncerOrKeyguard_showsKeyguardIfShowBouncerReturnsFalse() { when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn( KeyguardSecurityModel.SecurityMode.SimPin); + // Returning false means unable to show the bouncer when(mPrimaryBouncerInteractor.show(true)).thenReturn(false); when(mKeyguardTransitionInteractor.getTransitionState().getValue().getTo()) .thenReturn(KeyguardState.LOCKSCREEN); + mStatusBarKeyguardViewManager.onStartedWakingUp(); reset(mCentralSurfaces); // Advance past reattempts @@ -1125,6 +1127,23 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { verify(mCentralSurfaces).showKeyguard(); } + @Test + @DisableSceneContainer + @EnableFlags(Flags.FLAG_SIM_PIN_RACE_CONDITION_ON_RESTART) + public void testShowBouncerOrKeyguard_showsKeyguardIfSleeping() { + when(mKeyguardTransitionInteractor.getTransitionState().getValue().getTo()) + .thenReturn(KeyguardState.LOCKSCREEN); + mStatusBarKeyguardViewManager.onStartedGoingToSleep(); + + reset(mCentralSurfaces); + reset(mPrimaryBouncerInteractor); + mStatusBarKeyguardViewManager.showBouncerOrKeyguard( + /* hideBouncerWhenShowing= */true, false); + verify(mCentralSurfaces).showKeyguard(); + verify(mPrimaryBouncerInteractor).hide(); + } + + @Test @DisableSceneContainer public void testShowBouncerOrKeyguard_needsFullScreen_bouncerAlreadyShowing() { -- GitLab From 529255715624ae1d8fa8cf8f56ff2f75a1452927 Mon Sep 17 00:00:00 2001 From: Johannes Gallmann Date: Mon, 9 Sep 2024 13:33:46 +0000 Subject: [PATCH 109/492] Revert^2 "[flexiglass] Add bouncer predictive back motion test" This reverts commit cdf10953f4e35ac1e8f8882df1e833395c7d5911. Reason for revert: reland revert Change-Id: I40ca0f0c099213836527b0a23ff26ac70e762e2b --- packages/SystemUI/Android.bp | 1 + .../bouncer/ui/composable/BouncerScene.kt | 4 +- .../goldens/bouncerPredictiveBackMotion.json | 831 ++++++++++++++++++ .../composable/BouncerPredictiveBackTest.kt | 348 ++++++++ 4 files changed, 1182 insertions(+), 2 deletions(-) create mode 100644 packages/SystemUI/tests/goldens/bouncerPredictiveBackMotion.json create mode 100644 packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerPredictiveBackTest.kt diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index d26a9066e075..a9e81c77acad 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -756,6 +756,7 @@ android_library { "notification_flags_lib", "PlatformComposeCore", "PlatformComposeSceneTransitionLayout", + "PlatformComposeSceneTransitionLayoutTestsUtils", "androidx.compose.runtime_runtime", "androidx.compose.material3_material3", "androidx.compose.material_material-icons-extended", diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt index 7fb88e8d1fcc..ae92d259d62b 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt @@ -99,8 +99,8 @@ private fun SceneScope.BouncerScene( BouncerContent( viewModel, dialogFactory, - Modifier.sysuiResTag(Bouncer.TestTags.Root) - .element(Bouncer.Elements.Content) + Modifier.element(Bouncer.Elements.Content) + .sysuiResTag(Bouncer.TestTags.Root) .fillMaxSize() ) } diff --git a/packages/SystemUI/tests/goldens/bouncerPredictiveBackMotion.json b/packages/SystemUI/tests/goldens/bouncerPredictiveBackMotion.json new file mode 100644 index 000000000000..f37580dd47d4 --- /dev/null +++ b/packages/SystemUI/tests/goldens/bouncerPredictiveBackMotion.json @@ -0,0 +1,831 @@ +{ + "frame_ids": [ + "before", + 0, + 16, + 32, + 48, + 64, + 80, + 96, + 112, + 128, + 144, + 160, + 176, + 192, + 208, + 224, + 240, + 256, + 272, + 288, + 304, + 320, + 336, + 352, + 368, + 384, + 400, + 416, + 432, + 448, + 464, + 480, + 496, + 512, + 528, + 544, + 560, + 576, + 592, + 608, + 624, + 640, + 656, + 672, + 688, + 704, + 720, + 736, + 752, + 768, + 784, + 800, + 816, + 832, + 848, + 864, + 880, + 896, + 912, + 928, + 944, + 960, + 976, + 992, + 1008, + 1024, + "after" + ], + "features": [ + { + "name": "content_alpha", + "type": "float", + "data_points": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0.9954499, + 0.9805035, + 0.9527822, + 0.9092045, + 0.84588075, + 0.7583043, + 0.6424476, + 0.49766344, + 0.33080608, + 0.15650165, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + { + "type": "not_found" + } + ] + }, + { + "name": "content_scale", + "type": "scale", + "data_points": [ + "default", + { + "x": 0.9995097, + "y": 0.9995097, + "pivot": "unspecified" + }, + { + "x": 0.997352, + "y": 0.997352, + "pivot": "unspecified" + }, + { + "x": 0.990635, + "y": 0.990635, + "pivot": "unspecified" + }, + { + "x": 0.97249764, + "y": 0.97249764, + "pivot": "unspecified" + }, + { + "x": 0.94287145, + "y": 0.94287145, + "pivot": "unspecified" + }, + { + "x": 0.9128026, + "y": 0.9128026, + "pivot": "unspecified" + }, + { + "x": 0.8859569, + "y": 0.8859569, + "pivot": "unspecified" + }, + { + "x": 0.8629254, + "y": 0.8629254, + "pivot": "unspecified" + }, + { + "x": 0.8442908, + "y": 0.8442908, + "pivot": "unspecified" + }, + { + "x": 0.8303209, + "y": 0.8303209, + "pivot": "unspecified" + }, + { + "x": 0.8205137, + "y": 0.8205137, + "pivot": "unspecified" + }, + { + "x": 0.81387186, + "y": 0.81387186, + "pivot": "unspecified" + }, + { + "x": 0.80941653, + "y": 0.80941653, + "pivot": "unspecified" + }, + { + "x": 0.80641484, + "y": 0.80641484, + "pivot": "unspecified" + }, + { + "x": 0.80437464, + "y": 0.80437464, + "pivot": "unspecified" + }, + { + "x": 0.80297637, + "y": 0.80297637, + "pivot": "unspecified" + }, + { + "x": 0.80201286, + "y": 0.80201286, + "pivot": "unspecified" + }, + { + "x": 0.8013477, + "y": 0.8013477, + "pivot": "unspecified" + }, + { + "x": 0.8008894, + "y": 0.8008894, + "pivot": "unspecified" + }, + { + "x": 0.8005756, + "y": 0.8005756, + "pivot": "unspecified" + }, + { + "x": 0.80036324, + "y": 0.80036324, + "pivot": "unspecified" + }, + { + "x": 0.8002219, + "y": 0.8002219, + "pivot": "unspecified" + }, + { + "x": 0.80012995, + "y": 0.80012995, + "pivot": "unspecified" + }, + { + "x": 0.8000721, + "y": 0.8000721, + "pivot": "unspecified" + }, + { + "x": 0.80003715, + "y": 0.80003715, + "pivot": "unspecified" + }, + { + "x": 0.8000173, + "y": 0.8000173, + "pivot": "unspecified" + }, + { + "x": 0.800007, + "y": 0.800007, + "pivot": "unspecified" + }, + { + "x": 0.8000022, + "y": 0.8000022, + "pivot": "unspecified" + }, + { + "x": 0.8000004, + "y": 0.8000004, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.79999995, + "y": 0.79999995, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "x": 0.8, + "y": 0.8, + "pivot": "unspecified" + }, + { + "type": "not_found" + } + ] + }, + { + "name": "content_offset", + "type": "dpOffset", + "data_points": [ + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0 + }, + { + "x": 0, + "y": 0.5714286 + }, + { + "x": 0, + "y": 2.857143 + }, + { + "x": 0, + "y": 7.142857 + }, + { + "x": 0, + "y": 13.714286 + }, + { + "x": 0, + "y": 23.142857 + }, + { + "x": 0, + "y": 36.285713 + }, + { + "x": 0, + "y": 53.714287 + }, + { + "x": 0, + "y": 75.42857 + }, + { + "x": 0, + "y": 100.28571 + }, + { + "x": 0, + "y": 126.57143 + }, + { + "x": 0, + "y": 151.42857 + }, + { + "x": 0, + "y": 174 + }, + { + "x": 0, + "y": 193.42857 + }, + { + "x": 0, + "y": 210.28572 + }, + { + "x": 0, + "y": 224.85715 + }, + { + "x": 0, + "y": 237.14285 + }, + { + "x": 0, + "y": 247.71428 + }, + { + "x": 0, + "y": 256.85715 + }, + { + "x": 0, + "y": 264.57144 + }, + { + "x": 0, + "y": 271.42856 + }, + { + "x": 0, + "y": 277.14285 + }, + { + "x": 0, + "y": 282 + }, + { + "x": 0, + "y": 286.2857 + }, + { + "x": 0, + "y": 289.7143 + }, + { + "x": 0, + "y": 292.57144 + }, + { + "x": 0, + "y": 294.85715 + }, + { + "x": 0, + "y": 296.85715 + }, + { + "x": 0, + "y": 298.2857 + }, + { + "x": 0, + "y": 299.14285 + }, + { + "x": 0, + "y": 299.7143 + }, + { + "x": 0, + "y": 300 + }, + { + "x": 0, + "y": 0 + }, + { + "type": "not_found" + } + ] + }, + { + "name": "background_alpha", + "type": "float", + "data_points": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0.9900334, + 0.8403853, + 0.71002257, + 0.5979084, + 0.50182605, + 0.41945767, + 0.34874845, + 0.28797746, + 0.23573697, + 0.19087732, + 0.1524564, + 0.11970067, + 0.091962695, + 0.068702936, + 0.049464583, + 0.033859253, + 0.021552086, + 0.012255073, + 0.005717635, + 0.0017191172, + 6.711483e-05, + 0, + { + "type": "not_found" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerPredictiveBackTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerPredictiveBackTest.kt new file mode 100644 index 000000000000..22946c8e6ad0 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerPredictiveBackTest.kt @@ -0,0 +1,348 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.bouncer.ui.composable + +import android.app.AlertDialog +import android.platform.test.annotations.MotionTest +import android.testing.TestableLooper.RunWithLooper +import androidx.activity.BackEventCompat +import androidx.compose.animation.core.Animatable +import androidx.compose.animation.core.tween +import androidx.compose.foundation.layout.Box +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.isFinite +import androidx.compose.ui.geometry.isUnspecified +import androidx.compose.ui.semantics.SemanticsNode +import androidx.compose.ui.test.junit4.AndroidComposeTestRule +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.LargeTest +import com.android.compose.animation.scene.ObservableTransitionState +import com.android.compose.animation.scene.Scale +import com.android.compose.animation.scene.SceneKey +import com.android.compose.animation.scene.SceneScope +import com.android.compose.animation.scene.UserAction +import com.android.compose.animation.scene.UserActionResult +import com.android.compose.animation.scene.isElement +import com.android.compose.animation.scene.testing.lastAlphaForTesting +import com.android.compose.animation.scene.testing.lastScaleForTesting +import com.android.compose.theme.PlatformTheme +import com.android.systemui.SysuiTestCase +import com.android.systemui.bouncer.domain.interactor.bouncerInteractor +import com.android.systemui.bouncer.ui.BouncerDialogFactory +import com.android.systemui.bouncer.ui.viewmodel.BouncerSceneContentViewModel +import com.android.systemui.bouncer.ui.viewmodel.BouncerUserActionsViewModel +import com.android.systemui.bouncer.ui.viewmodel.bouncerSceneContentViewModel +import com.android.systemui.classifier.domain.interactor.falsingInteractor +import com.android.systemui.flags.EnableSceneContainer +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.Kosmos.Fixture +import com.android.systemui.lifecycle.ExclusiveActivatable +import com.android.systemui.lifecycle.rememberViewModel +import com.android.systemui.motion.createSysUiComposeMotionTestRule +import com.android.systemui.power.domain.interactor.powerInteractor +import com.android.systemui.scene.domain.interactor.sceneInteractor +import com.android.systemui.scene.domain.startable.sceneContainerStartable +import com.android.systemui.scene.shared.logger.sceneLogger +import com.android.systemui.scene.shared.model.SceneContainerConfig +import com.android.systemui.scene.shared.model.Scenes +import com.android.systemui.scene.shared.model.sceneDataSourceDelegator +import com.android.systemui.scene.ui.composable.Scene +import com.android.systemui.scene.ui.composable.SceneContainer +import com.android.systemui.scene.ui.viewmodel.SceneContainerViewModel +import com.android.systemui.scene.ui.viewmodel.splitEdgeDetector +import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.testKosmos +import kotlinx.coroutines.awaitCancellation +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.flowOf +import org.json.JSONObject +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import platform.test.motion.compose.ComposeFeatureCaptures.positionInRoot +import platform.test.motion.compose.ComposeRecordingSpec +import platform.test.motion.compose.MotionControl +import platform.test.motion.compose.feature +import platform.test.motion.compose.recordMotion +import platform.test.motion.compose.runTest +import platform.test.motion.golden.DataPoint +import platform.test.motion.golden.DataPointType +import platform.test.motion.golden.DataPointTypes +import platform.test.motion.golden.FeatureCapture +import platform.test.motion.golden.UnknownTypeException +import platform.test.screenshot.DeviceEmulationSpec +import platform.test.screenshot.Displays.Phone + +/** MotionTest for the Bouncer Predictive Back animation */ +@LargeTest +@RunWith(AndroidJUnit4::class) +@RunWithLooper +@EnableSceneContainer +@MotionTest +class BouncerPredictiveBackTest : SysuiTestCase() { + + private val deviceSpec = DeviceEmulationSpec(Phone) + private val kosmos = testKosmos() + + @get:Rule val motionTestRule = createSysUiComposeMotionTestRule(kosmos, deviceSpec) + private val androidComposeTestRule = + motionTestRule.toolkit.composeContentTestRule as AndroidComposeTestRule<*, *> + + private val sceneInteractor by lazy { kosmos.sceneInteractor } + private val Kosmos.sceneKeys by Fixture { listOf(Scenes.Lockscreen, Scenes.Bouncer) } + private val Kosmos.initialSceneKey by Fixture { Scenes.Bouncer } + private val Kosmos.sceneContainerConfig by Fixture { + val navigationDistances = + mapOf( + Scenes.Lockscreen to 1, + Scenes.Bouncer to 0, + ) + SceneContainerConfig(sceneKeys, initialSceneKey, emptyList(), navigationDistances) + } + + private val transitionState by lazy { + MutableStateFlow( + ObservableTransitionState.Idle(kosmos.sceneContainerConfig.initialSceneKey) + ) + } + private val sceneContainerViewModel by lazy { + SceneContainerViewModel( + sceneInteractor = kosmos.sceneInteractor, + falsingInteractor = kosmos.falsingInteractor, + powerInteractor = kosmos.powerInteractor, + shadeInteractor = kosmos.shadeInteractor, + splitEdgeDetector = kosmos.splitEdgeDetector, + logger = kosmos.sceneLogger, + motionEventHandlerReceiver = {}, + ) + .apply { setTransitionState(transitionState) } + } + + private val bouncerDialogFactory = + object : BouncerDialogFactory { + override fun invoke(): AlertDialog { + throw AssertionError() + } + } + private val bouncerSceneActionsViewModelFactory = + object : BouncerUserActionsViewModel.Factory { + override fun create() = BouncerUserActionsViewModel(kosmos.bouncerInteractor) + } + private lateinit var bouncerSceneContentViewModel: BouncerSceneContentViewModel + private val bouncerSceneContentViewModelFactory = + object : BouncerSceneContentViewModel.Factory { + override fun create() = bouncerSceneContentViewModel + } + private val bouncerScene = + BouncerScene( + bouncerSceneActionsViewModelFactory, + bouncerSceneContentViewModelFactory, + bouncerDialogFactory + ) + + @Before + fun setUp() { + MockitoAnnotations.initMocks(this) + + bouncerSceneContentViewModel = kosmos.bouncerSceneContentViewModel + + val startable = kosmos.sceneContainerStartable + startable.start() + } + + @Test + fun bouncerPredictiveBackMotion() = + motionTestRule.runTest { + val motion = + recordMotion( + content = { play -> + PlatformTheme { + BackGestureAnimation(play) + SceneContainer( + viewModel = + rememberViewModel("BouncerPredictiveBackTest") { + sceneContainerViewModel + }, + sceneByKey = + mapOf( + Scenes.Lockscreen to FakeLockscreen(), + Scenes.Bouncer to bouncerScene + ), + initialSceneKey = Scenes.Bouncer, + overlayByKey = emptyMap(), + dataSourceDelegator = kosmos.sceneDataSourceDelegator + ) + } + }, + ComposeRecordingSpec( + MotionControl( + delayRecording = { + awaitCondition { + sceneInteractor.transitionState.value.isTransitioning() + } + } + ) { + awaitCondition { + sceneInteractor.transitionState.value.isIdle(Scenes.Lockscreen) + } + } + ) { + feature(isElement(Bouncer.Elements.Content), elementAlpha, "content_alpha") + feature(isElement(Bouncer.Elements.Content), elementScale, "content_scale") + feature( + isElement(Bouncer.Elements.Content), + positionInRoot, + "content_offset" + ) + feature( + isElement(Bouncer.Elements.Background), + elementAlpha, + "background_alpha" + ) + } + ) + + assertThat(motion).timeSeriesMatchesGolden() + } + + @Composable + private fun BackGestureAnimation(play: Boolean) { + val backProgress = remember { Animatable(0f) } + + LaunchedEffect(play) { + if (play) { + val dispatcher = androidComposeTestRule.activity.onBackPressedDispatcher + androidComposeTestRule.runOnUiThread { + dispatcher.dispatchOnBackStarted(backEvent()) + } + backProgress.animateTo( + targetValue = 1f, + animationSpec = tween(durationMillis = 500) + ) { + androidComposeTestRule.runOnUiThread { + dispatcher.dispatchOnBackProgressed( + backEvent(progress = backProgress.value) + ) + if (backProgress.value == 1f) { + dispatcher.onBackPressed() + } + } + } + } + } + } + + private fun backEvent(progress: Float = 0f): BackEventCompat { + return BackEventCompat( + touchX = 0f, + touchY = 0f, + progress = progress, + swipeEdge = BackEventCompat.EDGE_LEFT, + ) + } + + private class FakeLockscreen : ExclusiveActivatable(), Scene { + override val key: SceneKey = Scenes.Lockscreen + override val userActions: Flow> = flowOf() + + @Composable + override fun SceneScope.Content(modifier: Modifier) { + Box(modifier = modifier, contentAlignment = Alignment.Center) { + Text(text = "Fake Lockscreen") + } + } + + override suspend fun onActivated() = awaitCancellation() + } + + companion object { + private val elementAlpha = + FeatureCapture("alpha") { + DataPoint.of(it.lastAlphaForTesting, DataPointTypes.float) + } + + private val elementScale = + FeatureCapture("scale") { + DataPoint.of(it.lastScaleForTesting, scale) + } + + private val scale: DataPointType = + DataPointType( + "scale", + jsonToValue = { + when (it) { + "unspecified" -> Scale.Unspecified + "default" -> Scale.Default + "zero" -> Scale.Zero + is JSONObject -> { + val pivot = it.get("pivot") + Scale( + scaleX = it.getDouble("x").toFloat(), + scaleY = it.getDouble("y").toFloat(), + pivot = + when (pivot) { + "unspecified" -> Offset.Unspecified + "infinite" -> Offset.Infinite + is JSONObject -> + Offset( + pivot.getDouble("x").toFloat(), + pivot.getDouble("y").toFloat() + ) + else -> throw UnknownTypeException() + } + ) + } + else -> throw UnknownTypeException() + } + }, + valueToJson = { + when (it) { + Scale.Unspecified -> "unspecified" + Scale.Default -> "default" + Scale.Zero -> "zero" + else -> { + JSONObject().apply { + put("x", it.scaleX) + put("y", it.scaleY) + put( + "pivot", + when { + it.pivot.isUnspecified -> "unspecified" + !it.pivot.isFinite -> "infinite" + else -> + JSONObject().apply { + put("x", it.pivot.x) + put("y", it.pivot.y) + } + } + ) + } + } + } + } + ) + } +} -- GitLab From 150f37a98f57c713dae6186261ade210ef0360b1 Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Mon, 9 Sep 2024 04:32:51 +0000 Subject: [PATCH 110/492] Introduce MetadataSyncAdapter. This class is used to index runtime metadata in sync with the static metadata for app functions. Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: Ifd031cced3bb974c5e7c183f402e6e3798078025 --- .../appfunctions/MetadataSyncAdapter.java | 149 +++++++++ .../appfunctions/MetadataSyncAdapterTest.kt | 296 ++++++++++++++++++ 2 files changed, 445 insertions(+) create mode 100644 services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java create mode 100644 services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt diff --git a/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java b/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java new file mode 100644 index 000000000000..be5770b280dc --- /dev/null +++ b/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.appfunctions; + +import android.annotation.NonNull; +import android.annotation.WorkerThread; +import android.app.appsearch.SearchResult; +import android.app.appsearch.SearchSpec; +import android.util.ArrayMap; +import android.util.ArraySet; + +import com.android.internal.annotations.VisibleForTesting; +import com.android.server.appfunctions.FutureAppSearchSession.FutureSearchResults; + +import java.util.List; +import java.util.Objects; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; + +/** + * This class implements helper methods for synchronously interacting with AppSearch while + * synchronizing AppFunction runtime and static metadata. + */ +public class MetadataSyncAdapter { + private final FutureAppSearchSession mFutureAppSearchSession; + private final Executor mSyncExecutor; + + public MetadataSyncAdapter( + @NonNull Executor syncExecutor, + @NonNull FutureAppSearchSession futureAppSearchSession) { + mSyncExecutor = Objects.requireNonNull(syncExecutor); + mFutureAppSearchSession = Objects.requireNonNull(futureAppSearchSession); + } + + /** + * This method returns a map of package names to a set of function ids that are in the static + * metadata but not in the runtime metadata. + * + * @param staticPackageToFunctionMap A map of package names to a set of function ids from the + * static metadata. + * @param runtimePackageToFunctionMap A map of package names to a set of function ids from the + * runtime metadata. + * @return A map of package names to a set of function ids that are in the static metadata but + * not in the runtime metadata. + */ + @NonNull + @VisibleForTesting + static ArrayMap> getAddedFunctionsDiffMap( + ArrayMap> staticPackageToFunctionMap, + ArrayMap> runtimePackageToFunctionMap) { + return getFunctionsDiffMap(staticPackageToFunctionMap, runtimePackageToFunctionMap); + } + + /** + * This method returns a map of package names to a set of function ids that are in the runtime + * metadata but not in the static metadata. + * + * @param staticPackageToFunctionMap A map of package names to a set of function ids from the + * static metadata. + * @param runtimePackageToFunctionMap A map of package names to a set of function ids from the + * runtime metadata. + * @return A map of package names to a set of function ids that are in the runtime metadata but + * not in the static metadata. + */ + @NonNull + @VisibleForTesting + static ArrayMap> getRemovedFunctionsDiffMap( + ArrayMap> staticPackageToFunctionMap, + ArrayMap> runtimePackageToFunctionMap) { + return getFunctionsDiffMap(runtimePackageToFunctionMap, staticPackageToFunctionMap); + } + + @NonNull + private static ArrayMap> getFunctionsDiffMap( + ArrayMap> packageToFunctionMapA, + ArrayMap> packageToFunctionMapB) { + ArrayMap> diffMap = new ArrayMap<>(); + for (String packageName : packageToFunctionMapA.keySet()) { + if (!packageToFunctionMapB.containsKey(packageName)) { + diffMap.put(packageName, packageToFunctionMapA.get(packageName)); + continue; + } + ArraySet diffFunctions = new ArraySet<>(); + for (String functionId : + Objects.requireNonNull(packageToFunctionMapA.get(packageName))) { + if (!Objects.requireNonNull(packageToFunctionMapB.get(packageName)) + .contains(functionId)) { + diffFunctions.add(functionId); + } + } + if (!diffFunctions.isEmpty()) { + diffMap.put(packageName, diffFunctions); + } + } + return diffMap; + } + + /** + * This method returns a map of package names to a set of function ids. + * + * @param queryExpression The query expression to use when searching for AppFunction metadata. + * @param metadataSearchSpec The search spec to use when searching for AppFunction metadata. + * @return A map of package names to a set of function ids. + * @throws ExecutionException If the future search results fail to execute. + * @throws InterruptedException If the future search results are interrupted. + */ + @NonNull + @VisibleForTesting + @WorkerThread + ArrayMap> getPackageToFunctionIdMap( + @NonNull String queryExpression, + @NonNull SearchSpec metadataSearchSpec, + @NonNull String propertyFunctionId, + @NonNull String propertyPackageName) + throws ExecutionException, InterruptedException { + ArrayMap> packageToFunctionIds = new ArrayMap<>(); + FutureSearchResults futureSearchResults = + mFutureAppSearchSession.search(queryExpression, metadataSearchSpec).get(); + List searchResultsList = futureSearchResults.getNextPage().get(); + // TODO(b/357551503): This could be expensive if we have more functions + while (!searchResultsList.isEmpty()) { + for (SearchResult searchResult : searchResultsList) { + String packageName = + searchResult.getGenericDocument().getPropertyString(propertyPackageName); + String functionId = + searchResult.getGenericDocument().getPropertyString(propertyFunctionId); + packageToFunctionIds + .computeIfAbsent(packageName, k -> new ArraySet<>()) + .add(functionId); + } + searchResultsList = futureSearchResults.getNextPage().get(); + } + return packageToFunctionIds; + } +} diff --git a/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt b/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt new file mode 100644 index 000000000000..1061da28f799 --- /dev/null +++ b/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt @@ -0,0 +1,296 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.server.appfunctions + +import android.app.appfunctions.AppFunctionRuntimeMetadata +import android.app.appfunctions.AppFunctionRuntimeMetadata.PROPERTY_FUNCTION_ID +import android.app.appfunctions.AppFunctionRuntimeMetadata.PROPERTY_PACKAGE_NAME +import android.app.appsearch.AppSearchManager +import android.app.appsearch.AppSearchManager.SearchContext +import android.app.appsearch.PutDocumentsRequest +import android.app.appsearch.SearchSpec +import android.app.appsearch.SetSchemaRequest +import android.util.ArrayMap +import android.util.ArraySet +import androidx.test.platform.app.InstrumentationRegistry +import com.google.common.truth.Truth.assertThat +import com.google.common.util.concurrent.MoreExecutors +import org.junit.After +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(JUnit4::class) +class MetadataSyncAdapterTest { + private val context = InstrumentationRegistry.getInstrumentation().targetContext + private val appSearchManager = context.getSystemService(AppSearchManager::class.java) + private val testExecutor = MoreExecutors.directExecutor() + + @Before + @After + fun clearData() { + val searchContext = SearchContext.Builder(TEST_DB).build() + FutureAppSearchSession(appSearchManager, testExecutor, searchContext).use { + val setSchemaRequest = SetSchemaRequest.Builder().setForceOverride(true).build() + it.setSchema(setSchemaRequest) + } + } + + @Test + fun getPackageToFunctionIdMap() { + val searchContext: SearchContext = SearchContext.Builder(TEST_DB).build() + val functionRuntimeMetadata = + AppFunctionRuntimeMetadata.Builder(TEST_TARGET_PKG_NAME, "testFunctionId", "").build() + val setSchemaRequest = + SetSchemaRequest.Builder() + .addSchemas(AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema()) + .addSchemas( + AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(TEST_TARGET_PKG_NAME) + ) + .build() + val putDocumentsRequest: PutDocumentsRequest = + PutDocumentsRequest.Builder().addGenericDocuments(functionRuntimeMetadata).build() + FutureAppSearchSession(appSearchManager, testExecutor, searchContext).use { + val setSchemaResponse = it.setSchema(setSchemaRequest).get() + assertThat(setSchemaResponse).isNotNull() + val appSearchBatchResult = it.put(putDocumentsRequest).get() + assertThat(appSearchBatchResult.isSuccess).isTrue() + } + + val metadataSyncAdapter = + MetadataSyncAdapter( + testExecutor, + FutureAppSearchSession(appSearchManager, testExecutor, searchContext), + ) + val searchSpec: SearchSpec = + SearchSpec.Builder() + .addFilterSchemas( + AppFunctionRuntimeMetadata.RUNTIME_SCHEMA_TYPE, + AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(TEST_TARGET_PKG_NAME) + .schemaType, + ) + .build() + val packageToFunctionIdMap = + metadataSyncAdapter.getPackageToFunctionIdMap( + "", + searchSpec, + PROPERTY_FUNCTION_ID, + PROPERTY_PACKAGE_NAME, + ) + + assertThat(packageToFunctionIdMap).isNotNull() + assertThat(packageToFunctionIdMap[TEST_TARGET_PKG_NAME]).containsExactly("testFunctionId") + } + + @Test + fun getPackageToFunctionIdMap_multipleDocuments() { + val searchContext: SearchContext = SearchContext.Builder(TEST_DB).build() + val functionRuntimeMetadata = + AppFunctionRuntimeMetadata.Builder(TEST_TARGET_PKG_NAME, "testFunctionId", "").build() + val functionRuntimeMetadata1 = + AppFunctionRuntimeMetadata.Builder(TEST_TARGET_PKG_NAME, "testFunctionId1", "").build() + val functionRuntimeMetadata2 = + AppFunctionRuntimeMetadata.Builder(TEST_TARGET_PKG_NAME, "testFunctionId2", "").build() + val functionRuntimeMetadata3 = + AppFunctionRuntimeMetadata.Builder(TEST_TARGET_PKG_NAME, "testFunctionId3", "").build() + val setSchemaRequest = + SetSchemaRequest.Builder() + .addSchemas(AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema()) + .addSchemas( + AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(TEST_TARGET_PKG_NAME) + ) + .build() + val putDocumentsRequest: PutDocumentsRequest = + PutDocumentsRequest.Builder() + .addGenericDocuments( + functionRuntimeMetadata, + functionRuntimeMetadata1, + functionRuntimeMetadata2, + functionRuntimeMetadata3, + ) + .build() + FutureAppSearchSession(appSearchManager, testExecutor, searchContext).use { + val setSchemaResponse = it.setSchema(setSchemaRequest).get() + assertThat(setSchemaResponse).isNotNull() + val appSearchBatchResult = it.put(putDocumentsRequest).get() + assertThat(appSearchBatchResult.isSuccess).isTrue() + } + + val metadataSyncAdapter = + MetadataSyncAdapter( + testExecutor, + FutureAppSearchSession(appSearchManager, testExecutor, searchContext), + ) + val searchSpec: SearchSpec = + SearchSpec.Builder() + .setResultCountPerPage(1) + .addFilterSchemas( + AppFunctionRuntimeMetadata.RUNTIME_SCHEMA_TYPE, + AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(TEST_TARGET_PKG_NAME) + .schemaType, + ) + .build() + val packageToFunctionIdMap = + metadataSyncAdapter.getPackageToFunctionIdMap( + "", + searchSpec, + PROPERTY_FUNCTION_ID, + PROPERTY_PACKAGE_NAME, + ) + + assertThat(packageToFunctionIdMap).isNotNull() + assertThat(packageToFunctionIdMap[TEST_TARGET_PKG_NAME]) + .containsExactly( + "testFunctionId", + "testFunctionId1", + "testFunctionId2", + "testFunctionId3", + ) + } + + @Test + fun getAddedFunctionsDiffMap_noDiff() { + val staticPackageToFunctionMap: ArrayMap> = ArrayMap() + staticPackageToFunctionMap.putAll( + mapOf(TEST_TARGET_PKG_NAME to ArraySet(setOf("testFunction1"))) + ) + val runtimePackageToFunctionMap: ArrayMap> = + ArrayMap(staticPackageToFunctionMap) + + val addedFunctionsDiffMap = + MetadataSyncAdapter.getAddedFunctionsDiffMap( + staticPackageToFunctionMap, + runtimePackageToFunctionMap, + ) + + assertThat(addedFunctionsDiffMap.isEmpty()).isEqualTo(true) + } + + @Test + fun getAddedFunctionsDiffMap_addedFunction() { + val staticPackageToFunctionMap: ArrayMap> = ArrayMap() + staticPackageToFunctionMap.putAll( + mapOf(TEST_TARGET_PKG_NAME to ArraySet(setOf("testFunction1", "testFunction2"))) + ) + val runtimePackageToFunctionMap: ArrayMap> = ArrayMap() + runtimePackageToFunctionMap.putAll( + mapOf(TEST_TARGET_PKG_NAME to ArraySet(setOf("testFunction1"))) + ) + + val addedFunctionsDiffMap = + MetadataSyncAdapter.getAddedFunctionsDiffMap( + staticPackageToFunctionMap, + runtimePackageToFunctionMap, + ) + + assertThat(addedFunctionsDiffMap.size).isEqualTo(1) + assertThat(addedFunctionsDiffMap[TEST_TARGET_PKG_NAME]).containsExactly("testFunction2") + } + + @Test + fun getAddedFunctionsDiffMap_addedFunctionNewPackage() { + val staticPackageToFunctionMap: ArrayMap> = ArrayMap() + staticPackageToFunctionMap.putAll( + mapOf(TEST_TARGET_PKG_NAME to ArraySet(setOf("testFunction1"))) + ) + val runtimePackageToFunctionMap: ArrayMap> = ArrayMap() + + val addedFunctionsDiffMap = + MetadataSyncAdapter.getAddedFunctionsDiffMap( + staticPackageToFunctionMap, + runtimePackageToFunctionMap, + ) + + assertThat(addedFunctionsDiffMap.size).isEqualTo(1) + assertThat(addedFunctionsDiffMap[TEST_TARGET_PKG_NAME]).containsExactly("testFunction1") + } + + @Test + fun getAddedFunctionsDiffMap_removedFunction() { + val staticPackageToFunctionMap: ArrayMap> = ArrayMap() + val runtimePackageToFunctionMap: ArrayMap> = ArrayMap() + runtimePackageToFunctionMap.putAll( + mapOf(TEST_TARGET_PKG_NAME to ArraySet(setOf("testFunction1"))) + ) + + val addedFunctionsDiffMap = + MetadataSyncAdapter.getAddedFunctionsDiffMap( + staticPackageToFunctionMap, + runtimePackageToFunctionMap, + ) + + assertThat(addedFunctionsDiffMap.isEmpty()).isEqualTo(true) + } + + @Test + fun getRemovedFunctionsDiffMap_noDiff() { + val staticPackageToFunctionMap: ArrayMap> = ArrayMap() + staticPackageToFunctionMap.putAll( + mapOf(TEST_TARGET_PKG_NAME to ArraySet(setOf("testFunction1"))) + ) + val runtimePackageToFunctionMap: ArrayMap> = + ArrayMap(staticPackageToFunctionMap) + + val removedFunctionsDiffMap = + MetadataSyncAdapter.getRemovedFunctionsDiffMap( + staticPackageToFunctionMap, + runtimePackageToFunctionMap, + ) + + assertThat(removedFunctionsDiffMap.isEmpty()).isEqualTo(true) + } + + @Test + fun getRemovedFunctionsDiffMap_removedFunction() { + val staticPackageToFunctionMap: ArrayMap> = ArrayMap() + val runtimePackageToFunctionMap: ArrayMap> = ArrayMap() + runtimePackageToFunctionMap.putAll( + mapOf(TEST_TARGET_PKG_NAME to ArraySet(setOf("testFunction1"))) + ) + + val removedFunctionsDiffMap = + MetadataSyncAdapter.getRemovedFunctionsDiffMap( + staticPackageToFunctionMap, + runtimePackageToFunctionMap, + ) + + assertThat(removedFunctionsDiffMap.size).isEqualTo(1) + assertThat(removedFunctionsDiffMap[TEST_TARGET_PKG_NAME]).containsExactly("testFunction1") + } + + @Test + fun getRemovedFunctionsDiffMap_addedFunction() { + val staticPackageToFunctionMap: ArrayMap> = ArrayMap() + staticPackageToFunctionMap.putAll( + mapOf(TEST_TARGET_PKG_NAME to ArraySet(setOf("testFunction1"))) + ) + val runtimePackageToFunctionMap: ArrayMap> = ArrayMap() + + val removedFunctionsDiffMap = + MetadataSyncAdapter.getRemovedFunctionsDiffMap( + staticPackageToFunctionMap, + runtimePackageToFunctionMap, + ) + + assertThat(removedFunctionsDiffMap.isEmpty()).isEqualTo(true) + } + + private companion object { + const val TEST_DB: String = "test_db" + const val TEST_TARGET_PKG_NAME = "com.android.frameworks.appfunctionstests" + } +} -- GitLab From 78bb8c538a9224b9dd231c64de03d58577f8f186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Hern=C3=A1ndez?= Date: Mon, 9 Sep 2024 14:27:52 +0200 Subject: [PATCH 111/492] Improve logging in ManagedServices * The value of "service.asBinder()" should be stable in calls to checkServiceTokenLocked() coming from the same NLS (it's a candidate key in mServices), whereas "service" itself is different every time. * Specify which service died in binderDied(). * Log skipped rebinding. Bug: 359126464 Test: N/A Flag: EXEMPT Trivial logging change Change-Id: I43ccf3407d2be690885d9bee410cf1560bde5736 --- .../com/android/server/notification/ManagedServices.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java index 1fdb57c0b61a..00375d8fd1eb 100644 --- a/services/core/java/com/android/server/notification/ManagedServices.java +++ b/services/core/java/com/android/server/notification/ManagedServices.java @@ -1090,7 +1090,7 @@ abstract public class ManagedServices { return info; } throw new SecurityException("Disallowed call from unknown " + getCaption() + ": " - + service + " " + service.getClass()); + + service.asBinder() + " " + service.getClass()); } public boolean isSameUser(IInterface service, int userId) { @@ -1573,6 +1573,9 @@ abstract public class ManagedServices { // after the rebind delay if (isPackageOrComponentAllowedWithPermission(cn, userId)) { registerService(cn, userId); + } else { + if (DEBUG) Slog.v(TAG, "skipped reregisterService cn=" + cn + " u=" + userId + + " because of isPackageOrComponentAllowedWithPermission check"); } } @@ -1906,6 +1909,7 @@ abstract public class ManagedServices { .append(",targetSdkVersion=").append(targetSdkVersion) .append(",connection=").append(connection == null ? null : "") .append(",service=").append(service) + .append(",serviceAsBinder=").append(service != null ? service.asBinder() : null) .append(']').toString(); } @@ -1944,7 +1948,7 @@ abstract public class ManagedServices { @Override public void binderDied() { - if (DEBUG) Slog.d(TAG, "binderDied"); + if (DEBUG) Slog.d(TAG, "binderDied " + this); // Remove the service, but don't unbind from the service. The system will bring the // service back up, and the onServiceConnected handler will read the service with the // new binding. If this isn't a bound service, and is just a registered -- GitLab From 2cbc7e02820ef45c2055c2b454899240629ee446 Mon Sep 17 00:00:00 2001 From: Ronald Braunstein Date: Mon, 9 Sep 2024 14:56:53 +0000 Subject: [PATCH 112/492] Migrate FLAKY options from modules to test suites. Excluding "flakes" is now down directly in test-mapping.gcl rather than per module. Junit @Ignore is always ignored and doesn't need to specified. For a few modules, we had two versions that had identical options other than specifying Flaky. I removed one and updated the affected TEST_MAPPING files. Test: atest -p apex/jobscheduler/service/java/com/android/server/usage:all Test: atest -p services/accessibility:all Test: atest -p services/core/java/com/android/server/logcat:all Test-Mapping-Slo-Bypass-Bug: b/335015078 Change-Id: I63e7f9e1f466dd60b0b11c4d06340037c27cb489 --- .../com/android/server/usage/TEST_MAPPING | 8 +-- core/tests/coretests/Android.bp | 38 ------------ services/accessibility/TEST_MAPPING | 32 ++-------- .../com/android/server/logcat/TEST_MAPPING | 7 +-- .../tests/mockingservicestests/Android.bp | 14 +---- services/tests/servicestests/Android.bp | 60 ------------------- 6 files changed, 11 insertions(+), 148 deletions(-) diff --git a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING index 52670a2570d3..dd0d1b6285de 100644 --- a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING +++ b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING @@ -10,14 +10,10 @@ ] }, { - "name": "CtsBRSTestCases", - "options": [ - {"exclude-annotation": "androidx.test.filters.FlakyTest"}, - {"exclude-annotation": "org.junit.Ignore"} - ] + "name": "CtsBRSTestCases" }, { - "name": "FrameworksServicesTests_com_android_server_usage_Presubmit" + "name": "FrameworksServicesTests_com_android_server_usage" } ], "postsubmit": [ diff --git a/core/tests/coretests/Android.bp b/core/tests/coretests/Android.bp index e7eb9dedab0e..efd27c87c9cf 100644 --- a/core/tests/coretests/Android.bp +++ b/core/tests/coretests/Android.bp @@ -287,11 +287,6 @@ android_ravenwood_test { auto_gen_config: true, } -FLAKY_OR_IGNORED = [ - "androidx.test.filters.FlakyTest", - "org.junit.Ignore", -] - test_module_config { name: "FrameworksCoreTests_Presubmit", base: "FrameworksCoreTests", @@ -300,7 +295,6 @@ test_module_config { "device-platinum-tests", ], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -325,7 +319,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["android.content.ContextTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -336,7 +329,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["android.app.KeyguardManagerTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -347,7 +339,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["android.app.PropertyInvalidatedCacheTests"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -362,7 +353,6 @@ test_module_config { "android.content.ComponentCallbacksControllerTest", "android.content.ContextWrapperTest", ], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -373,7 +363,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["android.database.sqlite.SQLiteRawStatementTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -385,7 +374,6 @@ test_module_config { ], include_filters: ["android.net"], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -498,7 +486,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["com.android.internal.jank"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -557,7 +544,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["com.android.internal.util.LatencyTrackerTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -568,7 +554,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["android.content.ContentCaptureOptionsTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -590,7 +575,6 @@ test_module_config { ], include_filters: ["android.content.pm."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -602,7 +586,6 @@ test_module_config { ], include_filters: ["android.content.pm."], include_annotations: ["android.platform.test.annotations.Postsubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -630,7 +613,6 @@ test_module_config { ], include_filters: ["android.content.res."], include_annotations: ["android.platform.test.annotations.Postsubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -660,7 +642,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["android.view.contentcapture"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -671,7 +652,6 @@ test_module_config { "device-platinum-tests", ], include_filters: ["android.view.contentprotection"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -683,7 +663,6 @@ test_module_config { ], include_filters: ["com.android.internal.content."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -696,21 +675,6 @@ test_module_config { include_filters: ["android.graphics.drawable.IconTest"], } -test_module_config { - name: "FrameworksCoreTests_accessibility_NO_FLAKES", - base: "FrameworksCoreTests", - test_suites: [ - "device-tests", - "device-platinum-tests", - ], - include_filters: [ - "com.android.internal.accessibility", - "android.accessibilityservice", - "android.view.accessibility", - ], - exclude_annotations: ["androidx.test.filters.FlakyTest"], -} - test_module_config { name: "FrameworksCoreTests_accessibility", base: "FrameworksCoreTests", @@ -780,7 +744,6 @@ test_module_config { "com.android.internal.jank.InteractionJankMonitorTest", "com.android.internal.util.LatencyTrackerTest", ], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { @@ -791,5 +754,4 @@ test_module_config { "device-platinum-tests", ], include_annotations: ["android.platform.test.annotations.PlatinumTest"], - exclude_annotations: FLAKY_OR_IGNORED, } diff --git a/services/accessibility/TEST_MAPPING b/services/accessibility/TEST_MAPPING index 3f85a9005582..0bc25e2dd3c4 100644 --- a/services/accessibility/TEST_MAPPING +++ b/services/accessibility/TEST_MAPPING @@ -1,34 +1,19 @@ { "presubmit": [ { - "name": "CtsAccessibilityServiceTestCases", - "options": [ - { - "exclude-annotation": "androidx.test.filters.FlakyTest" - } - ] + "name": "CtsAccessibilityServiceTestCases" }, { - "name": "CtsAccessibilityTestCases", - "options": [ - { - "exclude-annotation": "androidx.test.filters.FlakyTest" - } - ] + "name": "CtsAccessibilityTestCases" }, { - "name": "CtsUiAutomationTestCases", - "options": [ - { - "exclude-annotation": "androidx.test.filters.FlakyTest" - } - ] + "name": "CtsUiAutomationTestCases" }, { - "name": "FrameworksServicesTests_accessibility_Presubmit" + "name": "FrameworksServicesTests_accessibility" }, { - "name": "FrameworksCoreTests_accessibility_NO_FLAKES" + "name": "FrameworksCoreTests_accessibility" } ], "postsubmit": [ @@ -45,12 +30,7 @@ "name": "CtsUiAutomationTestCases" }, { - "name": "FrameworksServicesTests", - "options": [ - { - "include-filter": "com.android.server.accessibility" - } - ] + "name": "FrameworksServicesTests_accessibility" }, { "name": "FrameworksCoreTests_accessibility" diff --git a/services/core/java/com/android/server/logcat/TEST_MAPPING b/services/core/java/com/android/server/logcat/TEST_MAPPING index 5b07cd960fbe..688dbe9ec444 100644 --- a/services/core/java/com/android/server/logcat/TEST_MAPPING +++ b/services/core/java/com/android/server/logcat/TEST_MAPPING @@ -1,15 +1,12 @@ { "presubmit": [ { - "name": "FrameworksServicesTests_android_server_logcat_Presubmit" + "name": "FrameworksServicesTests_android_server_logcat" } ], "postsubmit": [ { - "name": "FrameworksServicesTests", - "options": [ - {"include-filter": "com.android.server.logcat"} - ] + "name": "FrameworksServicesTests_android_server_logcat" } ] } diff --git a/services/tests/mockingservicestests/Android.bp b/services/tests/mockingservicestests/Android.bp index 5a7693194d88..01435ff7f253 100644 --- a/services/tests/mockingservicestests/Android.bp +++ b/services/tests/mockingservicestests/Android.bp @@ -138,8 +138,6 @@ android_ravenwood_test { auto_gen_config: true, } -FLAKY = ["androidx.test.filters.FlakyTest"] - test_module_config { name: "FrameworksMockingServicesTests_blob", base: "FrameworksMockingServicesTests", @@ -152,7 +150,6 @@ test_module_config { base: "FrameworksMockingServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.DeviceIdleControllerTest"], - exclude_annotations: FLAKY, } test_module_config { @@ -161,7 +158,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.AppStateTrackerTest"], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY, } test_module_config { @@ -177,7 +173,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.alarm"], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY, } test_module_config { @@ -185,7 +180,7 @@ test_module_config { base: "FrameworksMockingServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.job"], - exclude_annotations: FLAKY + ["androidx.test.filters.LargeTest"], + exclude_annotations: ["androidx.test.filters.LargeTest"], } test_module_config { @@ -200,7 +195,6 @@ test_module_config { base: "FrameworksMockingServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.tare"], - exclude_annotations: FLAKY, } test_module_config { @@ -215,7 +209,6 @@ test_module_config { base: "FrameworksMockingServicesTests", test_suites: ["device-tests"], include_filters: ["android.service.games"], - exclude_annotations: FLAKY, } test_module_config { @@ -245,7 +238,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.am."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY, } test_module_config { @@ -265,7 +257,6 @@ test_module_config { test_suites: ["device-tests"], // Matches appop too include_filters: ["com.android.server.app"], - exclude_annotations: FLAKY, } test_module_config { @@ -301,7 +292,6 @@ test_module_config { base: "FrameworksMockingServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.pm"], - exclude_annotations: FLAKY + ["org.junit.Ignore"], } test_module_config { @@ -309,7 +299,6 @@ test_module_config { base: "FrameworksMockingServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.power"], - exclude_annotations: FLAKY, } test_module_config { @@ -324,7 +313,6 @@ test_module_config { base: "FrameworksMockingServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.trust"], - exclude_annotations: FLAKY, } test_module_config { diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp index dce6c359e6fd..46c343353a2a 100644 --- a/services/tests/servicestests/Android.bp +++ b/services/tests/servicestests/Android.bp @@ -272,21 +272,12 @@ java_genrule { "$(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res", } -FLAKY = [ - "androidx.test.filters.FlakyTest", -] - -FLAKY_AND_IGNORED = [ - "androidx.test.filters.FlakyTest", - "org.junit.Ignore", -] // Used by content protection TEST_MAPPING test_module_config { name: "FrameworksServicesTests_contentprotection", base: "FrameworksServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.contentprotection"], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { @@ -294,7 +285,6 @@ test_module_config { base: "FrameworksServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.om."], - exclude_annotations: FLAKY_AND_IGNORED, } // Used by contexthub TEST_MAPPING @@ -305,7 +295,6 @@ test_module_config { include_filters: ["com.android.server.location.contexthub."], // TODO(ron): are these right, does it run anything? include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { @@ -315,7 +304,6 @@ test_module_config { include_filters: ["com.android.server.location.contexthub."], // TODO(ron): are these right, does it run anything? include_annotations: ["android.platform.test.annotations.Postsubmit"], - exclude_annotations: FLAKY_AND_IGNORED, } // Used by contentcapture @@ -324,7 +312,6 @@ test_module_config { base: "FrameworksServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.contentcapture"], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { @@ -332,7 +319,6 @@ test_module_config { base: "FrameworksServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.recoverysystem."], - exclude_annotations: FLAKY, } // server pm TEST_MAPPING @@ -342,7 +328,6 @@ test_module_config { test_suites: ["device-tests"], include_annotations: ["android.platform.test.annotations.Presubmit"], include_filters: ["com.android.server.pm."], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { @@ -351,7 +336,6 @@ test_module_config { test_suites: ["device-tests"], include_annotations: ["android.platform.test.annotations.Postsubmit"], include_filters: ["com.android.server.pm."], - exclude_annotations: FLAKY_AND_IGNORED, } // server os TEST_MAPPING @@ -367,7 +351,6 @@ test_module_config { base: "FrameworksServicesTests", test_suites: ["device-tests"], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { @@ -388,14 +371,6 @@ test_module_config { include_filters: ["com.android.server.job"], } -test_module_config { - name: "FrameworksServicesTests_com_android_server_tare_Presubmit", - base: "FrameworksServicesTests", - test_suites: ["device-tests"], - include_filters: ["com.android.server.tare"], - exclude_annotations: FLAKY, -} - test_module_config { name: "FrameworksServicesTests_com_android_server_tare", base: "FrameworksServicesTests", @@ -403,14 +378,6 @@ test_module_config { include_filters: ["com.android.server.tare"], } -test_module_config { - name: "FrameworksServicesTests_com_android_server_usage_Presubmit", - base: "FrameworksServicesTests", - test_suites: ["device-tests"], - include_filters: ["com.android.server.usage"], - exclude_annotations: FLAKY, -} - test_module_config { name: "FrameworksServicesTests_com_android_server_usage", base: "FrameworksServicesTests", @@ -425,14 +392,6 @@ test_module_config { include_filters: ["com.android.server.am.BatteryStatsServiceTest"], } -test_module_config { - name: "FrameworksServicesTests_accessibility_Presubmit", - base: "FrameworksServicesTests", - test_suites: ["device-tests"], - include_filters: ["com.android.server.accessibility"], - exclude_annotations: FLAKY, -} - test_module_config { name: "FrameworksServicesTests_accessibility", base: "FrameworksServicesTests", @@ -461,7 +420,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.am."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY, } test_module_config { @@ -484,7 +442,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.audio"], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { @@ -500,7 +457,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.hdmi"], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { @@ -508,7 +464,6 @@ test_module_config { base: "FrameworksServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.hdmi"], - exclude_annotations: ["org.junit.Ignore"], } test_module_config { @@ -523,7 +478,6 @@ test_module_config { base: "FrameworksServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.lights"], - exclude_annotations: FLAKY, } test_module_config { @@ -539,7 +493,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.location.contexthub."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { @@ -547,15 +500,6 @@ test_module_config { base: "FrameworksServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.locksettings."], - exclude_annotations: FLAKY, -} - -test_module_config { - name: "FrameworksServicesTests_android_server_logcat_Presubmit", - base: "FrameworksServicesTests", - test_suites: ["device-tests"], - include_filters: ["com.android.server.logcat"], - exclude_annotations: FLAKY, } test_module_config { @@ -571,7 +515,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.net."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY, } test_module_config { @@ -601,7 +544,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.policy."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY, } test_module_config { @@ -623,7 +565,6 @@ test_module_config { base: "FrameworksServicesTests", test_suites: ["device-tests"], include_filters: ["com.android.server.power.hint"], - exclude_annotations: FLAKY, } test_module_config { @@ -653,7 +594,6 @@ test_module_config { test_suites: ["device-tests"], include_filters: ["com.android.server.location.contexthub."], include_annotations: ["android.platform.test.annotations.Postsubmit"], - exclude_annotations: FLAKY_AND_IGNORED, } test_module_config { -- GitLab From d197c0788fd125b520bce4bb5d01a2859be1b801 Mon Sep 17 00:00:00 2001 From: Vladimir Komsiyski Date: Fri, 6 Sep 2024 13:43:03 +0000 Subject: [PATCH 113/492] SystemApi for specifying insets in LayoutParams Exposing a minimal subset of the hidden InsetsFrameProvider, only a constructor and the actual insets. Bug: 350007866 Bug: 327742113 Test: presubmit, VDM demo app, CTS Flag: android.companion.virtualdevice.flags.status_bar_and_insets Change-Id: I08deeda77ea594648074e6b8b85e3d5a0dfb0516 --- core/api/system-current.txt | 8 +++ core/java/android/view/WindowManager.java | 74 +++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 60dc52b655d6..a657714f461a 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -18155,9 +18155,17 @@ package android.view { field public static final int DISPLAY_IME_POLICY_LOCAL = 0; // 0x0 } + @FlaggedApi("android.companion.virtualdevice.flags.status_bar_and_insets") public static class WindowManager.InsetsParams { + ctor public WindowManager.InsetsParams(int); + method @Nullable public android.graphics.Insets getInsetsSize(); + method public int getType(); + method @NonNull public android.view.WindowManager.InsetsParams setInsetsSize(@Nullable android.graphics.Insets); + } + public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable { method public final long getUserActivityTimeout(); method public boolean isSystemApplicationOverlay(); + method @FlaggedApi("android.companion.virtualdevice.flags.status_bar_and_insets") public void setInsetsParams(@NonNull java.util.List); method @RequiresPermission(android.Manifest.permission.SYSTEM_APPLICATION_OVERLAY) public void setSystemApplicationOverlay(boolean); method public final void setUserActivityTimeout(long); field @RequiresPermission(android.Manifest.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS) public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 524288; // 0x80000 diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 67a207e34a1a..af21071851fb 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -107,6 +107,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.Bitmap; +import android.graphics.Insets; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; @@ -4648,6 +4649,30 @@ public interface WindowManager extends ViewManager { */ public InsetsFrameProvider[] providedInsets; + /** + * Sets the insets to be provided by the window. + * + * @param insetsParams The parameters for the insets to be provided by the window. + * + * @hide + */ + @FlaggedApi(android.companion.virtualdevice.flags.Flags.FLAG_STATUS_BAR_AND_INSETS) + @SystemApi + public void setInsetsParams(@NonNull List insetsParams) { + if (insetsParams.isEmpty()) { + providedInsets = null; + } else { + providedInsets = new InsetsFrameProvider[insetsParams.size()]; + for (int i = 0; i < insetsParams.size(); ++i) { + final InsetsParams params = insetsParams.get(i); + providedInsets[i] = + new InsetsFrameProvider(/* owner= */ this, /* index= */ i, + params.getType()) + .setInsetsSize(params.getInsetsSize()); + } + } + } + /** * Specifies which {@link InsetsType}s should be forcibly shown. The types shown by this * method won't affect the app's layout. This field only takes effects if the caller has @@ -6116,6 +6141,55 @@ public interface WindowManager extends ViewManager { } } + /** + * Specifies the parameters of the insets provided by a window. + * + * @see WindowManager.LayoutParams#setInsetsParams(List) + * @see android.graphics.Insets + * + * @hide + */ + @FlaggedApi(android.companion.virtualdevice.flags.Flags.FLAG_STATUS_BAR_AND_INSETS) + @SystemApi + public static class InsetsParams { + + private final @InsetsType int mType; + private @Nullable Insets mInsets; + + /** + * Creates an instance of InsetsParams. + * + * @param type the type of insets to provide, e.g. {@link WindowInsets.Type#statusBars()}. + * @see WindowInsets.Type + */ + public InsetsParams(@InsetsType int type) { + mType = type; + } + + /** + * Sets the size of the provided insets. If {@code null}, then the provided insets will + * have the same size as the window frame. + */ + public @NonNull InsetsParams setInsetsSize(@Nullable Insets insets) { + mInsets = insets; + return this; + } + + /** + * Returns the type of provided insets. + */ + public @InsetsType int getType() { + return mType; + } + + /** + * Returns the size of the provided insets. + */ + public @Nullable Insets getInsetsSize() { + return mInsets; + } + } + /** * Holds the WM lock for the specified amount of milliseconds. * Intended for use by the tests that need to imitate lock contention. -- GitLab From 693341d3628018851721614c2d41b7188af6de87 Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Mon, 9 Sep 2024 15:18:31 +0000 Subject: [PATCH 114/492] Don't expect an error on log to proto We not longer throw an error here and instead log a message. Test: atest InternalTests:com.android.internal.protolog.PerfettoProtoLogImplTest Bug: 364255103 Flag: TEST_ONLY Change-Id: Ia6ed08621a3cd773831176a7ef09f137d26f32b5 --- .../protolog/PerfettoProtoLogImplTest.java | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/tests/Internal/src/com/android/internal/protolog/PerfettoProtoLogImplTest.java b/tests/Internal/src/com/android/internal/protolog/PerfettoProtoLogImplTest.java index 189de6bdb44a..e841d9ea0880 100644 --- a/tests/Internal/src/com/android/internal/protolog/PerfettoProtoLogImplTest.java +++ b/tests/Internal/src/com/android/internal/protolog/PerfettoProtoLogImplTest.java @@ -399,16 +399,12 @@ public class PerfettoProtoLogImplTest { TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true); TestProtoLogGroup.TEST_GROUP.setLogToProto(false); - var assertion = assertThrows(RuntimeException.class, () -> implSpy.log( - LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, - new Object[]{5})); + implSpy.log(LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, + new Object[]{5}); - verify(implSpy, never()).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq( - LogLevel.INFO), any()); + verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq( + LogLevel.INFO), eq("UNKNOWN MESSAGE args = (5)")); verify(sReader).getViewerString(eq(1234L)); - - Truth.assertThat(assertion).hasMessageThat() - .contains("Failed to get log message with hash 1234 and args (5)"); } @Test @@ -866,19 +862,6 @@ public class PerfettoProtoLogImplTest { .isEqualTo("This message should also be logged 567"); } - @Test - public void throwsOnLogToLogcatForProcessedMessageMissingLoadedDefinition() { - TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true); - var protolog = new PerfettoProtoLogImpl(TestProtoLogGroup.values()); - - var exception = assertThrows(RuntimeException.class, () -> { - protolog.log(LogLevel.DEBUG, TestProtoLogGroup.TEST_GROUP, 123, 0, new Object[0]); - }); - - Truth.assertThat(exception).hasMessageThat() - .contains("Failed to get log message with hash 123"); - } - private enum TestProtoLogGroup implements IProtoLogGroup { TEST_GROUP(true, true, false, "TEST_TAG"); -- GitLab From 064eb8ea5d4229a68350e87946a331ec59f76644 Mon Sep 17 00:00:00 2001 From: Utkarsh Nigam Date: Mon, 9 Sep 2024 14:03:00 +0000 Subject: [PATCH 115/492] Add test mapping for running unit tests in PRESUBMIT for system-server changes. Flag: EXEMPT adding a presubmit Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: I2843da70d8183ecc1c174556d54855f5a658c138 --- services/appfunctions/TEST_MAPPING | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 services/appfunctions/TEST_MAPPING diff --git a/services/appfunctions/TEST_MAPPING b/services/appfunctions/TEST_MAPPING new file mode 100644 index 000000000000..c7f5eeef8fa0 --- /dev/null +++ b/services/appfunctions/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "postsubmit": [ + { + "name": "FrameworksAppFunctionsTests" + } + ] +} \ No newline at end of file -- GitLab From 999c9eacabb1f4eafecc999adb8a31429e25eb7c Mon Sep 17 00:00:00 2001 From: "Torne (Richard Coles)" Date: Fri, 30 Aug 2024 14:35:51 -0400 Subject: [PATCH 116/492] Make the long-deprecated detachDrawGlFunctor a no-op. WebViewDelegate.detachDrawGlFunctor has been deprecated for a long time and is never used by any version of WebView that can run on current Android versions. Make it a no-op like the other deprecated draw functor methods, to remove the dependency on the hidden ViewRootImpl class. Bug: 310653407 Test: atest CtsWebkitTestCases Flag: android.webkit.mainline_apis Change-Id: I863e8f33ef2004cab4da57daddcdc49a92009991 --- core/java/android/webkit/WebViewDelegate.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/java/android/webkit/WebViewDelegate.java b/core/java/android/webkit/WebViewDelegate.java index 8501474b70a6..4c5802ccfcf5 100644 --- a/core/java/android/webkit/WebViewDelegate.java +++ b/core/java/android/webkit/WebViewDelegate.java @@ -137,9 +137,13 @@ public final class WebViewDelegate { */ @Deprecated public void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor) { - ViewRootImpl viewRootImpl = containerView.getViewRootImpl(); - if (nativeDrawGLFunctor != 0 && viewRootImpl != null) { - viewRootImpl.detachFunctor(nativeDrawGLFunctor); + if (Flags.mainlineApis()) { + throw new UnsupportedOperationException(); + } else { + ViewRootImpl viewRootImpl = containerView.getViewRootImpl(); + if (nativeDrawGLFunctor != 0 && viewRootImpl != null) { + viewRootImpl.detachFunctor(nativeDrawGLFunctor); + } } } -- GitLab From e6788998e01f30e68314cb26dea685ccb1fe98c2 Mon Sep 17 00:00:00 2001 From: Vladimir Komsiyski Date: Mon, 9 Sep 2024 15:47:31 +0000 Subject: [PATCH 117/492] Export flags used in FlaggedApi annotations Similar to ag/26428068 Bug: n/a Change-Id: I4fbcbc1e34772e5b0608cdd04743915dfe623286 Test: presubmit Flag: EXEMPT changes to flag definitions --- core/java/android/companion/virtual/flags/flags.aconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/java/android/companion/virtual/flags/flags.aconfig b/core/java/android/companion/virtual/flags/flags.aconfig index 748260bc8d5f..6f1327caf33d 100644 --- a/core/java/android/companion/virtual/flags/flags.aconfig +++ b/core/java/android/companion/virtual/flags/flags.aconfig @@ -43,6 +43,7 @@ flag { name: "virtual_display_insets" description: "APIs for specifying virtual display insets (via cutout)" bug: "350007135" + is_exported: true } flag { @@ -88,6 +89,7 @@ flag { name: "virtual_display_rotation_api" description: "API for on-demand rotation of virtual displays" bug: "291748430" + is_exported: true } flag { @@ -110,6 +112,7 @@ flag { name: "device_aware_display_power" description: "Device awareness in power and display APIs" bug: "285020111" + is_exported: true } flag { @@ -118,6 +121,7 @@ flag { description: "Make relevant PowerManager APIs display aware by default" bug: "365042486" is_fixed_read_only: true + is_exported: true } flag { @@ -125,4 +129,5 @@ flag { namespace: "virtual_devices" description: "Allow for status bar and insets on virtual devices" bug: "350007866" + is_exported: true } -- GitLab From 719b2fdb472b8706f3072fbee41d50fe907626e7 Mon Sep 17 00:00:00 2001 From: Ivan Chiang Date: Mon, 26 Aug 2024 07:29:45 +0000 Subject: [PATCH 118/492] [PM] Don't return the trimmed label Don't return the trimmed label. If the label is visible to the user, return the original label. Flag: android.content.pm.lightweight_invisible_label_detection Bug: 361029358 Test: atest CtsPackageManagerTestCases:LauncherAppsTest Test: atest LauncherActivityInfoTest Change-Id: Ic9ed9a21a2e6c8b50f160ba17e5a58f082a91fc0 --- .../content/pm/LauncherActivityInfo.java | 188 +++++---------- .../content/pm/LauncherActivityInfoTest.java | 218 +++++++++++++----- 2 files changed, 219 insertions(+), 187 deletions(-) diff --git a/core/java/android/content/pm/LauncherActivityInfo.java b/core/java/android/content/pm/LauncherActivityInfo.java index cb3455b266cd..bb91a37825e6 100644 --- a/core/java/android/content/pm/LauncherActivityInfo.java +++ b/core/java/android/content/pm/LauncherActivityInfo.java @@ -43,9 +43,11 @@ public class LauncherActivityInfo { private final PackageManager mPm; private final LauncherActivityInfoInternal mInternal; - private static final UnicodeSet TRIMMABLE_CHARACTERS = + private static final UnicodeSet INVISIBLE_CHARACTERS = new UnicodeSet("[[:White_Space:][:Default_Ignorable_Code_Point:][:gc=Cc:]]", /* ignoreWhitespace= */ false).freeze(); + // Only allow 3 consecutive invisible characters in the prefix of the string. + private static final int PREFIX_CONSECUTIVE_INVISIBLE_CHARACTERS_MAXIMUM = 3; /** * Create a launchable activity object for a given ResolveInfo and user. @@ -93,17 +95,21 @@ public class LauncherActivityInfo { return getActivityInfo().loadLabel(mPm); } - CharSequence label = trim(getActivityInfo().loadLabel(mPm)); - // If the trimmed label is empty, use application's label instead - if (TextUtils.isEmpty(label)) { - label = trim(getApplicationInfo().loadLabel(mPm)); - // If the trimmed label is still empty, use package name instead - if (TextUtils.isEmpty(label)) { - label = getComponentName().getPackageName(); - } + CharSequence label = getActivityInfo().loadLabel(mPm).toString().trim(); + // If the activity label is visible to the user, return the original activity label + if (isVisible(label)) { + return label; } - // TODO: Go through LauncherAppsService - return label; + + // Use application label instead + label = getApplicationInfo().loadLabel(mPm).toString().trim(); + // If the application label is visible to the user, return the original application label + if (isVisible(label)) { + return label; + } + + // Use package name instead + return getComponentName().getPackageName(); } /** @@ -207,147 +213,75 @@ public class LauncherActivityInfo { } /** - * If the {@code ch} is trimmable, return {@code true}. Otherwise, return - * {@code false}. If the count of the code points of {@code ch} doesn't - * equal 1, return {@code false}. + * Check whether the {@code sequence} is visible to the user or not. + *

+ * Return {@code false} when one of these conditions are satisfied: + * 1. The {@code sequence} starts with at least consecutive three invisible characters. + * 2. The sequence is composed of the invisible characters and non-glyph characters. *

- * There are two types of the trimmable characters. - * 1. The character is one of the Default_Ignorable_Code_Point in + * Invisible character is one of the Default_Ignorable_Code_Point in * * DerivedCoreProperties.txt, the White_Space in PropList.txt * or category Cc. *

- * 2. The character is not supported in the current system font. + * Non-glyph character means the character is not supported in the current system font. * {@link android.graphics.Paint#hasGlyph(String)} *

* - */ - private static boolean isTrimmable(@NonNull Paint paint, @NonNull CharSequence ch) { - Objects.requireNonNull(paint); - Objects.requireNonNull(ch); - - // if ch is empty or it is not a character (i,e, the count of code - // point doesn't equal one), return false - if (TextUtils.isEmpty(ch) - || Character.codePointCount(ch, /* beginIndex= */ 0, ch.length()) != 1) { - return false; - } - - // Return true for the cases as below: - // 1. The character is in the TRIMMABLE_CHARACTERS set - // 2. The character is not supported in the system font - return TRIMMABLE_CHARACTERS.contains(ch) || !paint.hasGlyph(ch.toString()); - } - - /** - * If the {@code sequence} has some leading trimmable characters, creates a new copy - * and removes the trimmable characters from the copy. Otherwise the given - * {@code sequence} is returned as it is. Use {@link #isTrimmable(Paint, CharSequence)} - * to determine whether the character is trimmable or not. - * - * @return the trimmed string or the original string that has no - * leading trimmable characters. - * @see #isTrimmable(Paint, CharSequence) - * @see #trim(CharSequence) - * @see #trimEnd(CharSequence) - * * @hide */ @VisibleForTesting - @NonNull - public static CharSequence trimStart(@NonNull CharSequence sequence) { + public static boolean isVisible(@NonNull CharSequence sequence) { Objects.requireNonNull(sequence); - if (TextUtils.isEmpty(sequence)) { - return sequence; + return false; } final Paint paint = new Paint(); - int trimCount = 0; + int invisibleCharCount = 0; + int notSupportedCharCount = 0; final int[] codePoints = sequence.codePoints().toArray(); for (int i = 0, length = codePoints.length; i < length; i++) { String ch = new String(new int[]{codePoints[i]}, /* offset= */ 0, /* count= */ 1); - if (!isTrimmable(paint, ch)) { - break; - } - trimCount += ch.length(); - } - if (trimCount == 0) { - return sequence; - } - return sequence.subSequence(trimCount, sequence.length()); - } - /** - * If the {@code sequence} has some trailing trimmable characters, creates a new copy - * and removes the trimmable characters from the copy. Otherwise the given - * {@code sequence} is returned as it is. Use {@link #isTrimmable(Paint, CharSequence)} - * to determine whether the character is trimmable or not. - * - * @return the trimmed sequence or the original sequence that has no - * trailing trimmable characters. - * @see #isTrimmable(Paint, CharSequence) - * @see #trimStart(CharSequence) - * @see #trim(CharSequence) - * - * @hide - */ - @VisibleForTesting - @NonNull - public static CharSequence trimEnd(@NonNull CharSequence sequence) { - Objects.requireNonNull(sequence); - - if (TextUtils.isEmpty(sequence)) { - return sequence; - } - - final Paint paint = new Paint(); - int trimCount = 0; - final int[] codePoints = sequence.codePoints().toArray(); - for (int i = codePoints.length - 1; i >= 0; i--) { - String ch = new String(new int[]{codePoints[i]}, /* offset= */ 0, /* count= */ 1); - if (!isTrimmable(paint, ch)) { - break; + // The check steps: + // 1. If the character is contained in INVISIBLE_CHARACTERS, invisibleCharCount++. + // 1.1 Check whether the invisibleCharCount is larger or equal to + // PREFIX_INVISIBLE_CHARACTERS_MAXIMUM when notSupportedCharCount is zero. + // It means that there are three consecutive invisible characters at the + // start of the string, return false. + // Otherwise, continue. + // 2. If the character is not supported on the system: + // notSupportedCharCount++, continue + // 3. If it does not continue or return on the above two cases, it means the + // character is visible and supported on the system, break. + // After going through the whole string, if the sum of invisibleCharCount + // and notSupportedCharCount is smaller than the length of the string, it + // means the string has the other visible characters, return true. + // Otherwise, return false. + if (INVISIBLE_CHARACTERS.contains(ch)) { + invisibleCharCount++; + // If there are three successive invisible characters at the start of the + // string, it is hard to visible to the user. + if (notSupportedCharCount == 0 + && invisibleCharCount >= PREFIX_CONSECUTIVE_INVISIBLE_CHARACTERS_MAXIMUM) { + return false; + } + continue; } - trimCount += ch.length(); - } - - if (trimCount == 0) { - return sequence; - } - return sequence.subSequence(0, sequence.length() - trimCount); - } - /** - * If the {@code sequence} has some leading or trailing trimmable characters, creates - * a new copy and removes the trimmable characters from the copy. Otherwise the given - * {@code sequence} is returned as it is. Use {@link #isTrimmable(Paint, CharSequence)} - * to determine whether the character is trimmable or not. - * - * @return the trimmed sequence or the original sequence that has no leading or - * trailing trimmable characters. - * @see #isTrimmable(Paint, CharSequence) - * @see #trimStart(CharSequence) - * @see #trimEnd(CharSequence) - * - * @hide - */ - @VisibleForTesting - @NonNull - public static CharSequence trim(@NonNull CharSequence sequence) { - Objects.requireNonNull(sequence); - - if (TextUtils.isEmpty(sequence)) { - return sequence; - } - - CharSequence result = trimStart(sequence); - if (TextUtils.isEmpty(result)) { - return result; + // The character is not supported on the system, but it may not be an invisible + // character. E.g. tofu (a rectangle). + if (!paint.hasGlyph(ch)) { + notSupportedCharCount++; + continue; + } + // The character is visible and supported on the system, break the for loop + break; } - return trimEnd(result); + return (invisibleCharCount + notSupportedCharCount < codePoints.length); } } diff --git a/core/tests/coretests/src/android/content/pm/LauncherActivityInfoTest.java b/core/tests/coretests/src/android/content/pm/LauncherActivityInfoTest.java index e19c4b15d300..3616ff5cc144 100644 --- a/core/tests/coretests/src/android/content/pm/LauncherActivityInfoTest.java +++ b/core/tests/coretests/src/android/content/pm/LauncherActivityInfoTest.java @@ -33,71 +33,169 @@ import org.junit.runner.RunWith; public class LauncherActivityInfoTest { @Test - public void testTrimStart() { - // Invisible case - assertThat(LauncherActivityInfo.trimStart("\u0009").toString()).isEmpty(); - // It is not supported in the system font - assertThat(LauncherActivityInfo.trimStart("\u0FE1").toString()).isEmpty(); - // Surrogates case - assertThat(LauncherActivityInfo.trimStart("\uD83E\uDD36").toString()) - .isEqualTo("\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trimStart("\u0009\u0FE1\uD83E\uDD36A").toString()) - .isEqualTo("\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trimStart("\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A\u0009\u0FE1"); - assertThat(LauncherActivityInfo.trimStart("A\uD83E\uDD36\u0009\u0FE1A").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A"); - assertThat(LauncherActivityInfo.trimStart( - "A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trimStart( - "\u0009\u0FE1\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A\u0009\u0FE1"); + public void testIsVisible_normal() { + // normal + assertThat(LauncherActivityInfo.isVisible("label")).isTrue(); + // 1 surrogates case + assertThat(LauncherActivityInfo.isVisible("\uD83E\uDD36")).isTrue(); } @Test - public void testTrimEnd() { - // Invisible case - assertThat(LauncherActivityInfo.trimEnd("\u0009").toString()).isEmpty(); - // It is not supported in the system font - assertThat(LauncherActivityInfo.trimEnd("\u0FE1").toString()).isEmpty(); - // Surrogates case - assertThat(LauncherActivityInfo.trimEnd("\uD83E\uDD36").toString()) - .isEqualTo("\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trimEnd("\u0009\u0FE1\uD83E\uDD36A").toString()) - .isEqualTo("\u0009\u0FE1\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trimEnd("\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trimEnd("A\uD83E\uDD36\u0009\u0FE1A").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A"); - assertThat(LauncherActivityInfo.trimEnd( - "A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trimEnd( - "\u0009\u0FE1\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\u0009\u0FE1\uD83E\uDD36A"); + public void testIsVisible_onlyInvisibleCharacter() { + // 1 invisible + assertThat(LauncherActivityInfo.isVisible("\u0009")).isFalse(); + // 2 invisible + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164")).isFalse(); + // 3 invisible + assertThat(LauncherActivityInfo.isVisible("\u3000\u0009\u3164")).isFalse(); + // 4 invisible + assertThat(LauncherActivityInfo.isVisible("\u200F\u3000\u0009\u3164")).isFalse(); } @Test - public void testTrim() { - // Invisible case - assertThat(LauncherActivityInfo.trim("\u0009").toString()).isEmpty(); - // It is not supported in the system font - assertThat(LauncherActivityInfo.trim("\u0FE1").toString()).isEmpty(); - // Surrogates case - assertThat(LauncherActivityInfo.trim("\uD83E\uDD36").toString()) - .isEqualTo("\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trim("\u0009\u0FE1\uD83E\uDD36A").toString()) - .isEqualTo("\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trim("\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trim("A\uD83E\uDD36\u0009\u0FE1A").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A"); - assertThat(LauncherActivityInfo.trim( - "A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trim( - "\u0009\u0FE1\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A"); + public void testIsVisible_onlyNotSupportedCharacter() { + // 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u0FE1")).isFalse(); + // 2 not supported + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2")).isFalse(); + // 3 not supported + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2\u0FE3")).isFalse(); + // 4 not supported + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + } + + @Test + public void testIsVisible_invisibleAndNotSupportedCharacter() { + // 1 invisible, 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1")).isFalse(); + // 1 invisible, 2 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\u0FE2")).isFalse(); + // 1 invisible, 3 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\u0FE2\u0FE3")).isFalse(); + // 1 invisible, 4 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + + // 2 invisible, 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\u0FE1")).isFalse(); + // 2 invisible, 2 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\u0FE1\u0FE2")).isFalse(); + // 2 invisible, 3 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\u0FE1\u0FE2\u0FE3")).isFalse(); + // 2 invisible, 4 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u0009\u3164\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + + // 3 invisible, 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u3000\u0009\u3164\u0FE1")).isFalse(); + // 3 invisible, 2 not supported + assertThat(LauncherActivityInfo.isVisible("\u3000\u0009\u3164\u0FE1\u0FE2")).isFalse(); + // 3 invisible, 3 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3")).isFalse(); + // 3 invisible, 4 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + + // 4 invisible, 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u200F\u3000\u0009\u3164\u0FE1")).isFalse(); + // 4 invisible, 2 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2")).isFalse(); + // 4 invisible, 3 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3")).isFalse(); + // 4 invisible, 4 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + + // 1 not supported, 1 invisible, + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0009")).isFalse(); + // 1 not supported, 2 invisible + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0009\u3164")).isFalse(); + // 1 not supported, 3 invisible + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u3000\u0009\u3164")).isFalse(); + // 1 not supported, 4 invisible + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u200F\u3000\u0009\u3164")).isFalse(); + } + + @Test + public void testIsVisible_invisibleAndNormalCharacter() { + // 1 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\uD83E\uDD36")).isTrue(); + // 2 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\uD83E\uDD36")).isTrue(); + // 3 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u3000\u0009\u3164\uD83E\uDD36")).isFalse(); + // 4 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\uD83E\uDD36")).isFalse(); + } + + @Test + public void testIsVisible_notSupportedAndNormalCharacter() { + // 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\uD83E\uDD36")).isTrue(); + // 2 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2\uD83E\uDD36")).isTrue(); + // 3 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2\u0FE3\uD83E\uDD36")).isTrue(); + // 4 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0FE1\u0FE2\u0FE3\u0FE4\uD83E\uDD36")).isTrue(); + } + + @Test + public void testIsVisible_mixAllCharacter() { + // 1 invisible, 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\uD83E\uDD36")).isTrue(); + // 1 invisible, 1 not supported, 1 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\u3164\uD83E\uDD36")).isTrue(); + // 1 invisible, 1 not supported, 2 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0009\u0FE1\u3000\u3164\uD83E\uDD36")).isTrue(); + // 1 invisible, 1 not supported, 3 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0009\u0FE1\u200F\u3000\u3164\uD83E\uDD36")).isTrue(); + + // 2 invisible, 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\u0FE1\uD83E\uDD36")).isTrue(); + // 2 invisible, 2 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0009\u3164\u0FE1\u0FE2\uD83E\uDD36")).isTrue(); + + // 3 invisible, 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\uD83E\uDD36")).isFalse(); + // 3 invisible, 2 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\u0FE2\uD83E\uDD36")).isFalse(); + // 3 invisible, 3 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\uD83E\uDD36")).isFalse(); + + // 4 invisible, 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\uD83E\uDD36")).isFalse(); + // 4 invisible, 2 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\uD83E\uDD36")).isFalse(); + // 4 invisible, 3 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\uD83E\uDD36")).isFalse(); + // 4 invisible, 4 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\u0FE4\uD83E\uDD36")).isFalse(); + + // 1 not supported, 1 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0009\uD83E\uDD36")).isTrue(); + // 1 not supported, 2 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0009\u3164\uD83E\uDD36")).isTrue(); + // 1 not supported, 3 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0FE1\u3000\u0009\u3164\uD83E\uDD36")).isTrue(); + // 1 not supported, 4 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0FE1\u200F\u3000\u0009\u3164\uD83E\uDD36")).isTrue(); + } } -- GitLab From cba24eff330a6b0a674fc12449c4f03bf1032a28 Mon Sep 17 00:00:00 2001 From: Diya Bera Date: Fri, 6 Sep 2024 22:10:33 +0000 Subject: [PATCH 119/492] Prioritize verify app not enabled error Flag: android.hardware.biometrics.flag.mandatory_biometrics Bug: 339910180 Test: atest PreAuthInfoTest Change-Id: I0002cf96335ce94ad8ff3a3263a75745b2f39c87 --- .../biometrics/BiometricConstants.java | 6 +++++ .../hardware/biometrics/BiometricManager.java | 7 +++++ .../server/biometrics/PreAuthInfo.java | 8 ++++++ .../com/android/server/biometrics/Utils.java | 8 +++++- .../biometrics/BiometricServiceTest.java | 27 +++++++++++++++++-- .../server/biometrics/PreAuthInfoTest.java | 24 +++++++++++++++++ 6 files changed, 77 insertions(+), 3 deletions(-) diff --git a/core/java/android/hardware/biometrics/BiometricConstants.java b/core/java/android/hardware/biometrics/BiometricConstants.java index 8975191b54c1..9355937b0963 100644 --- a/core/java/android/hardware/biometrics/BiometricConstants.java +++ b/core/java/android/hardware/biometrics/BiometricConstants.java @@ -169,6 +169,12 @@ public interface BiometricConstants { */ int BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE = 20; + /** + * Biometrics is not allowed to verify in apps. + * @hide + */ + int BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS = 21; + /** * This constant is only used by SystemUI. It notifies SystemUI that authentication was paused * because the authentication attempt was unsuccessful. diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java index 9bc46b9f382a..a4f7485fcaa5 100644 --- a/core/java/android/hardware/biometrics/BiometricManager.java +++ b/core/java/android/hardware/biometrics/BiometricManager.java @@ -93,6 +93,13 @@ public class BiometricManager { public static final int BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE = BiometricConstants.BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE; + /** + * Biometrics is not allowed to verify in apps. + * @hide + */ + public static final int BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS = + BiometricConstants.BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS; + /** * A security vulnerability has been discovered and the sensor is unavailable until a * security update has addressed this issue. This error can be received if for example, diff --git a/services/core/java/com/android/server/biometrics/PreAuthInfo.java b/services/core/java/com/android/server/biometrics/PreAuthInfo.java index ac3c02823d0a..b2c616ae5b3c 100644 --- a/services/core/java/com/android/server/biometrics/PreAuthInfo.java +++ b/services/core/java/com/android/server/biometrics/PreAuthInfo.java @@ -316,6 +316,7 @@ class PreAuthInfo { Pair sensorNotEnrolled = null; Pair sensorLockout = null; Pair hardwareNotDetected = null; + Pair biometricAppNotAllowed = null; for (Pair pair : ineligibleSensors) { final int status = pair.second; if (status == BIOMETRIC_LOCKOUT_TIMED || status == BIOMETRIC_LOCKOUT_PERMANENT) { @@ -327,6 +328,9 @@ class PreAuthInfo { if (status == BIOMETRIC_HARDWARE_NOT_DETECTED) { hardwareNotDetected = pair; } + if (status == BIOMETRIC_NOT_ENABLED_FOR_APPS) { + biometricAppNotAllowed = pair; + } } // If there is a sensor locked out, prioritize lockout over other sensor's error. @@ -339,6 +343,10 @@ class PreAuthInfo { return hardwareNotDetected; } + if (Flags.mandatoryBiometrics() && biometricAppNotAllowed != null) { + return biometricAppNotAllowed; + } + // If the caller requested STRONG, and the device contains both STRONG and non-STRONG // sensors, prioritize BIOMETRIC_NOT_ENROLLED over the weak sensor's // BIOMETRIC_INSUFFICIENT_STRENGTH error. diff --git a/services/core/java/com/android/server/biometrics/Utils.java b/services/core/java/com/android/server/biometrics/Utils.java index 871121472938..407ef1e41aa6 100644 --- a/services/core/java/com/android/server/biometrics/Utils.java +++ b/services/core/java/com/android/server/biometrics/Utils.java @@ -321,6 +321,9 @@ public class Utils { case BiometricConstants.BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE: biometricManagerCode = BiometricManager.BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE; break; + case BiometricConstants.BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS: + biometricManagerCode = BiometricManager.BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS; + break; default: Slog.e(BiometricService.TAG, "Unhandled result code: " + biometricConstantsCode); biometricManagerCode = BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE; @@ -384,9 +387,12 @@ public class Utils { return BiometricConstants.BIOMETRIC_ERROR_SENSOR_PRIVACY_ENABLED; case MANDATORY_BIOMETRIC_UNAVAILABLE_ERROR: return BiometricConstants.BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE; + case BIOMETRIC_NOT_ENABLED_FOR_APPS: + if (Flags.mandatoryBiometrics()) { + return BiometricConstants.BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS; + } case BIOMETRIC_DISABLED_BY_DEVICE_POLICY: case BIOMETRIC_HARDWARE_NOT_DETECTED: - case BIOMETRIC_NOT_ENABLED_FOR_APPS: default: return BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE; } diff --git a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java index 6b8e414255cd..b4b36125f770 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java @@ -558,7 +558,9 @@ public class BiometricServiceTest { waitForIdle(); verify(mReceiver1).onError( eq(BiometricAuthenticator.TYPE_NONE), - eq(BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE), + eq(Flags.mandatoryBiometrics() + ? BiometricConstants.BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS + : BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE), eq(0 /* vendorCode */)); // Enrolled, not disabled in settings, user requires confirmation in settings @@ -1450,7 +1452,9 @@ public class BiometricServiceTest { } @Test - public void testCanAuthenticate_whenBiometricsNotEnabledForApps() throws Exception { + @RequiresFlagsDisabled(Flags.FLAG_MANDATORY_BIOMETRICS) + public void testCanAuthenticate_whenBiometricsNotEnabledForApps_returnsHardwareUnavailable() + throws Exception { setupAuthForOnly(TYPE_FACE, Authenticators.BIOMETRIC_STRONG); when(mBiometricService.mSettingObserver.getEnabledForApps(anyInt())).thenReturn(false); when(mTrustManager.isDeviceSecure(anyInt(), anyInt())) @@ -1467,6 +1471,25 @@ public class BiometricServiceTest { invokeCanAuthenticate(mBiometricService, authenticators)); } + @Test + @RequiresFlagsEnabled(Flags.FLAG_MANDATORY_BIOMETRICS) + public void testCanAuthenticate_whenBiometricsNotEnabledForApps() throws Exception { + setupAuthForOnly(TYPE_FACE, Authenticators.BIOMETRIC_STRONG); + when(mBiometricService.mSettingObserver.getEnabledForApps(anyInt())).thenReturn(false); + when(mTrustManager.isDeviceSecure(anyInt(), anyInt())) + .thenReturn(true); + + // When only biometric is requested + int authenticators = Authenticators.BIOMETRIC_STRONG; + assertEquals(BiometricManager.BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS, + invokeCanAuthenticate(mBiometricService, authenticators)); + + // When credential and biometric are requested + authenticators = Authenticators.BIOMETRIC_STRONG | Authenticators.DEVICE_CREDENTIAL; + assertEquals(BiometricManager.BIOMETRIC_SUCCESS, + invokeCanAuthenticate(mBiometricService, authenticators)); + } + @Test public void testCanAuthenticate_whenNoBiometricSensor() throws Exception { mBiometricService = new BiometricService(mContext, mInjector, mBiometricHandlerProvider); diff --git a/services/tests/servicestests/src/com/android/server/biometrics/PreAuthInfoTest.java b/services/tests/servicestests/src/com/android/server/biometrics/PreAuthInfoTest.java index 760d38e855a6..b758f57ff407 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/PreAuthInfoTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/PreAuthInfoTest.java @@ -20,6 +20,7 @@ import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NO import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE; import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT; import static android.hardware.biometrics.BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE; +import static android.hardware.biometrics.BiometricManager.BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS; import static com.android.server.biometrics.sensors.LockoutTracker.LOCKOUT_NONE; @@ -264,6 +265,29 @@ public class PreAuthInfoTest { assertThat(preAuthInfo.eligibleSensors).hasSize(0); } + @Test + @RequiresFlagsEnabled(Flags.FLAG_MANDATORY_BIOMETRICS) + public void testCalculateByPriority() + throws Exception { + when(mFaceAuthenticator.hasEnrolledTemplates(anyInt(), any())).thenReturn(false); + when(mSettingObserver.getEnabledForApps(anyInt())).thenReturn(false); + + BiometricSensor faceSensor = getFaceSensor(); + BiometricSensor fingerprintSensor = getFingerprintSensor(); + PromptInfo promptInfo = new PromptInfo(); + promptInfo.setConfirmationRequested(false /* requireConfirmation */); + promptInfo.setAuthenticators(BiometricManager.Authenticators.BIOMETRIC_STRONG); + promptInfo.setDisallowBiometricsIfPolicyExists(false /* checkDevicePolicy */); + PreAuthInfo preAuthInfo = PreAuthInfo.create(mTrustManager, mDevicePolicyManager, + mSettingObserver, List.of(faceSensor, fingerprintSensor), + 0 /* userId */, promptInfo, TEST_PACKAGE_NAME, + false /* checkDevicePolicyManager */, mContext, mBiometricCameraManager); + + assertThat(preAuthInfo.eligibleSensors).hasSize(0); + assertThat(preAuthInfo.getCanAuthenticateResult()).isEqualTo( + BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS); + } + @Test @RequiresFlagsEnabled(Flags.FLAG_MANDATORY_BIOMETRICS) public void testMandatoryBiometricsNegativeButtonText_whenSet() -- GitLab From 6dae8db42fcf398ece446c6c3f07c1632ef2ba8d Mon Sep 17 00:00:00 2001 From: Yara Hassan Date: Mon, 9 Sep 2024 16:28:01 +0100 Subject: [PATCH 120/492] Move a11ychecker sources to an isolated dependency Per the discussions on ag/28470431 and ag/28136135, a11ychecker's "aatf" dependency can't be included in the system server since it pulls in test-only dependency. The goal of this CL is to remove the dependency from the system server while this is resolved. Bug: 364326163 Flag: com.android.server.accessibility.enable_a11y_checker_logging Test: N/A Change-Id: I0cf2cf6ddce2eff0a70d36d90c9b79101db9dab6 --- services/accessibility/Android.bp | 13 +------- .../accessibility/a11ychecker/Android.bp | 31 +++++++++++++++++++ services/tests/servicestests/Android.bp | 1 + 3 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 services/accessibility/java/com/android/server/accessibility/a11ychecker/Android.bp diff --git a/services/accessibility/Android.bp b/services/accessibility/Android.bp index 3d7ad0b94d1b..b97ff6217403 100644 --- a/services/accessibility/Android.bp +++ b/services/accessibility/Android.bp @@ -10,6 +10,7 @@ package { filegroup { name: "services.accessibility-sources", srcs: ["java/**/*.java"], + exclude_srcs: ["java/**/a11ychecker/*.java"], path: "java", visibility: ["//frameworks/base/services"], } @@ -26,16 +27,13 @@ java_library_static { }, srcs: [ ":services.accessibility-sources", - ":statslog-accessibility-java-gen", "//frameworks/base/packages/SettingsLib/RestrictedLockUtils:SettingsLibRestrictedLockUtilsSrc", ], libs: [ - "aatf", "services.core", "androidx.annotation_annotation", ], static_libs: [ - "accessibility_protos_lite", "com_android_server_accessibility_flags_lib", "//frameworks/base/packages/SystemUI/aconfig:com_android_systemui_flags_lib", ], @@ -70,12 +68,3 @@ java_aconfig_library { name: "com_android_server_accessibility_flags_lib", aconfig_declarations: "com_android_server_accessibility_flags", } - -genrule { - name: "statslog-accessibility-java-gen", - tools: ["stats-log-api-gen"], - cmd: "$(location stats-log-api-gen) --java $(out) --module accessibility" + - " --javaPackage com.android.server.accessibility.a11ychecker" + - " --javaClass AccessibilityCheckerStatsLog --minApiLevel 34", - out: ["java/com/android/server/accessibility/a11ychecker/AccessibilityCheckerStatsLog.java"], -} diff --git a/services/accessibility/java/com/android/server/accessibility/a11ychecker/Android.bp b/services/accessibility/java/com/android/server/accessibility/a11ychecker/Android.bp new file mode 100644 index 000000000000..e9ed202f3a49 --- /dev/null +++ b/services/accessibility/java/com/android/server/accessibility/a11ychecker/Android.bp @@ -0,0 +1,31 @@ +package { + default_applicable_licenses: ["frameworks_base_license"], +} + +// TODO(http://b/364326163): a11ychecker depends on aatf which currently can't be used in the system +// server as it pulls in test deps. We moved a11ychecker sources from services.accessibility to an +// isolated library while this is resolved. +java_library_static { + name: "a11ychecker", + srcs: [ + "*.java", + ":statslog-accessibility-java-gen", + ], + libs: [ + "aatf", + "androidx.annotation_annotation", + ], + static_libs: [ + "accessibility_protos_lite", + "com_android_server_accessibility_flags_lib", + ], +} + +genrule { + name: "statslog-accessibility-java-gen", + tools: ["stats-log-api-gen"], + cmd: "$(location stats-log-api-gen) --java $(out) --module accessibility" + + " --javaPackage com.android.server.accessibility.a11ychecker" + + " --javaClass AccessibilityCheckerStatsLog --minApiLevel 34", + out: ["java/com/android/server/accessibility/a11ychecker/AccessibilityCheckerStatsLog.java"], +} diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp index 09f81f736b36..3a7d206840a6 100644 --- a/services/tests/servicestests/Android.bp +++ b/services/tests/servicestests/Android.bp @@ -36,6 +36,7 @@ android_test { "-Werror", ], static_libs: [ + "a11ychecker", "aatf", "accessibility_protos_lite", "cts-input-lib", -- GitLab From 0b1b82b1083f1b4aa758f584ebc10bde56cafc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Kurucz?= Date: Mon, 9 Sep 2024 16:11:05 +0000 Subject: [PATCH 121/492] [Flexiglass] Remove getTopPadding() from NSSL dumps NSSL.getTopPadding() shouldn't be accessed any more, when the SceneContainer flag is enabled. Bug: 364830352 Test: dumpsysui NotificationStackScrollLayout Flag: com.android.systemui.scene_container Change-Id: I8956d62b19be076f6cf72b65ee14d6052d200689 --- .../notification/stack/NotificationStackScrollLayout.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 7c0178436268..5a0350d4cf61 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -5400,7 +5400,9 @@ public class NotificationStackScrollLayout println(pw, "intrinsicContentHeight", mIntrinsicContentHeight); println(pw, "contentHeight", mContentHeight); println(pw, "intrinsicPadding", mIntrinsicPadding); - println(pw, "topPadding", getTopPadding()); + if (!SceneContainerFlag.isEnabled()) { + println(pw, "topPadding", getTopPadding()); + } println(pw, "bottomPadding", mBottomPadding); dumpRoundedRectClipping(pw); println(pw, "requestedClipBounds", mRequestedClipBounds); -- GitLab From 6cb5cc36d6a825ccced5ebe42630e57d5f8a7114 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Mon, 9 Sep 2024 16:18:49 +0000 Subject: [PATCH 122/492] Immediately set lockscreen alpha to 0f on DOZING->OCCLUDED... ... when light reveal animation doesn't play. Otherwise the content will overlap. Fixes: 363869127 Test: manual, observe DOZING->OCCLUDED Flag: EXEMPT bugfix Change-Id: I1214638e6a0fa20eed376af3e5cea9090d133609 --- .../DozingToOccludedTransitionViewModel.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DozingToOccludedTransitionViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DozingToOccludedTransitionViewModel.kt index f33752fc04d4..12bcc7ecbab8 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DozingToOccludedTransitionViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DozingToOccludedTransitionViewModel.kt @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.ui.viewmodel import android.util.MathUtils +import com.android.systemui.Flags.lightRevealMigration import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.domain.interactor.FromAodTransitionInteractor import com.android.systemui.keyguard.shared.model.Edge @@ -55,8 +56,18 @@ constructor( var currentAlpha = 0f return transitionAnimation.sharedFlow( duration = 250.milliseconds, - startTime = 100.milliseconds, // Wait for the light reveal to "hit" the LS elements. - onStart = { currentAlpha = viewState.alpha() }, + startTime = if (lightRevealMigration()) { + 100.milliseconds // Wait for the light reveal to "hit" the LS elements. + } else { + 0.milliseconds + }, + onStart = { + if (lightRevealMigration()) { + currentAlpha = viewState.alpha() + } else { + currentAlpha = 0f + } + }, onStep = { MathUtils.lerp(currentAlpha, 0f, it) }, onCancel = { 0f }, ) -- GitLab From 2ea912c325ba9cc74a36c98f47af26de3a308f42 Mon Sep 17 00:00:00 2001 From: yumeichen Date: Fri, 2 Aug 2024 07:32:00 +0000 Subject: [PATCH 123/492] Enable the customised vibration of (1) default notification (2) channel notification. The audio uri with an extra specified vibration file is like: ``` content://&vibration_uri= ``` This change is to support the customised vibration of this format. Test: atest NotificationRecordTest Test: atest VibratorHelperTest Flag: com.android.server.notification.notification_vibration_in_sound_uri Bug: 358523917 Bug: 358524009 Change-Id: I864c42b5c30f41328633bd37fe8fb571fb9cdbe4 --- .../notification/NotificationRecord.java | 15 +++- .../server/notification/VibratorHelper.java | 31 +++++++ .../android/server/notification/flags.aconfig | 7 ++ .../notification/NotificationRecordTest.java | 87 +++++++++++++++++++ .../notification/VibratorHelperTest.java | 59 +++++++++++++ 5 files changed, 196 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java index e54124608a26..b9f0968b5864 100644 --- a/services/core/java/com/android/server/notification/NotificationRecord.java +++ b/services/core/java/com/android/server/notification/NotificationRecord.java @@ -330,10 +330,19 @@ public final class NotificationRecord { } final long[] vibrationPattern = channel.getVibrationPattern(); - if (vibrationPattern == null) { - return helper.createDefaultVibration(insistent); + if (vibrationPattern != null) { + return helper.createWaveformVibration(vibrationPattern, insistent); } - return helper.createWaveformVibration(vibrationPattern, insistent); + + if (com.android.server.notification.Flags.notificationVibrationInSoundUri()) { + final VibrationEffect vibrationEffectFromSoundUri = + helper.createVibrationEffectFromSoundUri(channel.getSound()); + if (vibrationEffectFromSoundUri != null) { + return vibrationEffectFromSoundUri; + } + } + + return helper.createDefaultVibration(insistent); } private VibrationEffect calculateVibration() { diff --git a/services/core/java/com/android/server/notification/VibratorHelper.java b/services/core/java/com/android/server/notification/VibratorHelper.java index 8a0e595176ec..fbe77720b9fc 100644 --- a/services/core/java/com/android/server/notification/VibratorHelper.java +++ b/services/core/java/com/android/server/notification/VibratorHelper.java @@ -24,6 +24,9 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.media.AudioAttributes; +import android.media.RingtoneManager; +import android.media.Utils; +import android.net.Uri; import android.os.Process; import android.os.VibrationAttributes; import android.os.VibrationEffect; @@ -51,6 +54,7 @@ public final class VibratorHelper { @Nullable private final float[] mDefaultPwlePattern; @Nullable private final float[] mFallbackPwlePattern; private final int mDefaultVibrationAmplitude; + private final Context mContext; public VibratorHelper(Context context) { mVibrator = context.getSystemService(Vibrator.class); @@ -68,6 +72,7 @@ public final class VibratorHelper { com.android.internal.R.array.config_notificationFallbackVibeWaveform); mDefaultVibrationAmplitude = context.getResources().getInteger( com.android.internal.R.integer.config_defaultVibrationAmplitude); + mContext = context; } /** @@ -184,6 +189,16 @@ public final class VibratorHelper { * @param insistent {@code true} if the vibration should loop until it is cancelled. */ public VibrationEffect createDefaultVibration(boolean insistent) { + if (com.android.server.notification.Flags.notificationVibrationInSoundUri()) { + final Uri defaultRingtoneUri = RingtoneManager.getActualDefaultRingtoneUri(mContext, + RingtoneManager.TYPE_NOTIFICATION); + final VibrationEffect vibrationEffectFromSoundUri = + createVibrationEffectFromSoundUri(defaultRingtoneUri); + if (vibrationEffectFromSoundUri != null) { + return vibrationEffectFromSoundUri; + } + } + if (mVibrator.hasFrequencyControl()) { VibrationEffect effect = createPwleWaveformVibration(mDefaultPwlePattern, insistent); if (effect != null) { @@ -193,6 +208,22 @@ public final class VibratorHelper { return createWaveformVibration(mDefaultPattern, insistent); } + /** + * Safely create a {@link VibrationEffect} from given an uri {@code Uri}. + * with query parameter "vibration_uri" + * + * Use this function if the {@code Uri} is with a query parameter "vibration_uri" and the + * vibration_uri represents a valid vibration effect in xml + * + * @param uri {@code Uri} an uri including query parameter "vibraiton_uri" + */ + public @Nullable VibrationEffect createVibrationEffectFromSoundUri(Uri uri) { + if (uri == null) { + return null; + } + return Utils.parseVibrationEffect(mVibrator, Utils.getVibrationUri(uri)); + } + /** Returns if a given vibration can be played by the vibrator that does notification buzz. */ public boolean areEffectComponentsSupported(VibrationEffect effect) { return mVibrator.areVibrationFeaturesSupported(effect); diff --git a/services/core/java/com/android/server/notification/flags.aconfig b/services/core/java/com/android/server/notification/flags.aconfig index aac2c404fd38..be3adc142fa4 100644 --- a/services/core/java/com/android/server/notification/flags.aconfig +++ b/services/core/java/com/android/server/notification/flags.aconfig @@ -156,3 +156,10 @@ flag { description: "This flag enables forced auto-grouping conversations" bug: "336488844" } + +flag { + name: "notification_vibration_in_sound_uri" + namespace: "systemui" + description: "This flag enables sound uri with vibration source" + bug: "358524009" +} diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationRecordTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationRecordTest.java index f572e7aa1706..50a5f658f059 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationRecordTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationRecordTest.java @@ -62,6 +62,8 @@ import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.Icon; import android.media.AudioAttributes; +import android.media.RingtoneManager; +import android.media.Utils; import android.metrics.LogMaker; import android.net.Uri; import android.os.Build; @@ -69,6 +71,7 @@ import android.os.Bundle; import android.os.UserHandle; import android.os.VibrationEffect; import android.os.Vibrator; +import android.os.VibratorInfo; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; @@ -93,6 +96,9 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.util.ArrayList; @SmallTest @@ -141,6 +147,7 @@ public class NotificationRecordTest extends UiServiceTestCase { when(mMockContext.getSystemService(eq(Vibrator.class))).thenReturn(mVibrator); when(mVibrator.areVibrationFeaturesSupported(any())).thenReturn(true); + when(mVibrator.getInfo()).thenReturn(VibratorInfo.EMPTY_VIBRATOR_INFO); final Resources res = mContext.getResources(); when(mMockContext.getResources()).thenReturn(res); when(mMockContext.getPackageManager()).thenReturn(mPm); @@ -510,6 +517,51 @@ public class NotificationRecordTest extends UiServiceTestCase { assertNull(record.getVibration()); } + @Test + @EnableFlags(com.android.server.notification.Flags.FLAG_NOTIFICATION_VIBRATION_IN_SOUND_URI) + public void testVibration_customVibrationForSound_withoutVibrationUri() { + // prepare testing data + Uri backupDefaultUri = RingtoneManager.getActualDefaultRingtoneUri(mMockContext, + RingtoneManager.TYPE_NOTIFICATION); + RingtoneManager.setActualDefaultRingtoneUri(mMockContext, RingtoneManager.TYPE_NOTIFICATION, + Settings.System.DEFAULT_NOTIFICATION_URI); + defaultChannel.enableVibration(true); + defaultChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI, CUSTOM_ATTRIBUTES); + StatusBarNotification sbn = getNotification( + /* channelVibrationPattern= */ null, + /* channelVibrationEffect= */ null, + /* insistent= */ false); + NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); + + try { + assertEquals( + new VibratorHelper(mMockContext).createDefaultVibration(false), + record.getVibration()); + } finally { + // restore the data + RingtoneManager.setActualDefaultRingtoneUri(mMockContext, + RingtoneManager.TYPE_NOTIFICATION, + backupDefaultUri); + } + } + + @Test + @EnableFlags(com.android.server.notification.Flags.FLAG_NOTIFICATION_VIBRATION_IN_SOUND_URI) + public void testVibration_customVibrationForSound_withVibrationUri() throws IOException { + defaultChannel.enableVibration(true); + VibrationInfo vibration = getTestingVibration(mVibrator); + Uri uriWithVibration = getVibrationUriAppended( + Settings.System.DEFAULT_NOTIFICATION_URI, vibration.mUri); + defaultChannel.setSound(uriWithVibration, CUSTOM_ATTRIBUTES); + StatusBarNotification sbn = getNotification( + /* channelVibrationPattern= */ null, + /* channelVibrationEffect= */ null, + /* insistent= */ false); + NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); + + assertEquals(vibration.mVibrationEffect, record.getVibration()); + } + @Test public void testImportance_preUpgrade() { StatusBarNotification sbn = getNotification(PKG_N_MR1, true /* noisy */, @@ -1594,4 +1646,39 @@ public class NotificationRecordTest extends UiServiceTestCase { assertThat(record.getAudioAttributes().getUsage()).isEqualTo(USAGE_ALARM); } + + static class VibrationInfo { + public VibrationEffect mVibrationEffect; + public Uri mUri; + VibrationInfo(VibrationEffect vibrationEffect, Uri uri) { + mVibrationEffect = vibrationEffect; + mUri = uri; + } + } + + private static VibrationInfo getTestingVibration(Vibrator vibrator) throws IOException { + File tempVibrationFile = File.createTempFile("test_vibration_file", ".xml"); + FileWriter writer = new FileWriter(tempVibrationFile); + writer.write("\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""); // Your test XML content + writer.close(); + Uri vibrationUri = Uri.parse(tempVibrationFile.toURI().toString()); + + VibrationEffect vibrationEffect = Utils.parseVibrationEffect(vibrator, vibrationUri); + return new VibrationInfo(vibrationEffect, vibrationUri); + } + + private static Uri getVibrationUriAppended(Uri audioUri, Uri vibrationUri) { + Uri.Builder builder = audioUri.buildUpon(); + builder.appendQueryParameter(Utils.VIBRATION_URI_PARAM, vibrationUri.toString()); + return builder.build(); + } } diff --git a/services/tests/uiservicestests/src/com/android/server/notification/VibratorHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/VibratorHelperTest.java index 0993bec42c6a..4d2396c78d16 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/VibratorHelperTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/VibratorHelperTest.java @@ -22,8 +22,12 @@ import static junit.framework.Assert.assertTrue; import static org.mockito.Mockito.when; +import android.media.Utils; +import android.net.Uri; import android.os.VibrationEffect; import android.os.Vibrator; +import android.os.VibratorInfo; +import android.provider.Settings; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -36,6 +40,10 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + @SmallTest @RunWith(AndroidJUnit4.class) public class VibratorHelperTest extends UiServiceTestCase { @@ -85,8 +93,35 @@ public class VibratorHelperTest extends UiServiceTestCase { assertNull(VibratorHelper.createPwleWaveformVibration(new float[] { 0, 0, 0 }, false)); } + @Test + public void createVibrationEffectFromSoundUri_nullInput() { + assertNull(mVibratorHelper.createVibrationEffectFromSoundUri(null)); + } + + @Test + public void createVibrationEffectFromSoundUri_emptyUri() { + assertNull(mVibratorHelper.createVibrationEffectFromSoundUri(Uri.EMPTY)); + } + + @Test + public void createVibrationEffectFromSoundUri_uriWithoutRequiredQueryParameter() { + Uri uri = Settings.System.DEFAULT_NOTIFICATION_URI; + assertNull(mVibratorHelper.createVibrationEffectFromSoundUri(uri)); + } + + @Test + public void createVibrationEffectFromSoundUri_uriWithVibrationUri() throws IOException { + // prepare the uri with vibration + when(mVibrator.getInfo()).thenReturn(VibratorInfo.EMPTY_VIBRATOR_INFO); + Uri validUri = getVibrationUriAppended(Settings.System.DEFAULT_NOTIFICATION_URI); + + assertSingleVibration(mVibratorHelper.createVibrationEffectFromSoundUri(validUri)); + } + @Test public void createVibration_insistent_createsRepeatingVibration() { + when(mVibrator.getInfo()).thenReturn(VibratorInfo.EMPTY_VIBRATOR_INFO); + when(mVibrator.hasFrequencyControl()).thenReturn(false); assertRepeatingVibration(mVibratorHelper.createDefaultVibration(/* insistent= */ true)); assertRepeatingVibration(mVibratorHelper.createFallbackVibration(/* insistent= */ true)); @@ -98,6 +133,8 @@ public class VibratorHelperTest extends UiServiceTestCase { @Test public void createVibration_nonInsistent_createsSingleShotVibration() { + when(mVibrator.getInfo()).thenReturn(VibratorInfo.EMPTY_VIBRATOR_INFO); + when(mVibrator.hasFrequencyControl()).thenReturn(false); assertSingleVibration(mVibratorHelper.createDefaultVibration(/* insistent= */ false)); assertSingleVibration(mVibratorHelper.createFallbackVibration(/* insistent= */ false)); @@ -120,4 +157,26 @@ public class VibratorHelperTest extends UiServiceTestCase { effect instanceof VibrationEffect.Composed); return ((VibrationEffect.Composed) effect).getRepeatIndex(); } + + private static Uri getVibrationUriAppended(Uri baseUri) throws IOException { + File tempVibrationFile = File.createTempFile("test_vibration_file", ".xml"); + FileWriter writer = new FileWriter(tempVibrationFile); + writer.write("\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""); // Your test XML content + writer.close(); + + Uri.Builder builder = baseUri.buildUpon(); + builder.appendQueryParameter( + Utils.VIBRATION_URI_PARAM, + tempVibrationFile.toURI().toString()); + return builder.build(); + } } -- GitLab From 6e521b228d5d9b26636a4189d8b68cd5bb5cfff9 Mon Sep 17 00:00:00 2001 From: Michal Brzezinski Date: Mon, 9 Sep 2024 17:57:44 +0100 Subject: [PATCH 124/492] Add broadcast listener launching tutorial for keyboard and touchpad Required when tutorial is launched by non-system apps as it needs to be launched as user 0. Bug: 361518125 Flag: com.android.systemui.shared.new_touchpad_gestures_tutorial Test: KeyboardTouchpadTutorialCoreStartableTest Change-Id: Idfa70d61322aa55eca85b7a7f71b055110b4f0fd --- .../KeyboardTouchpadTutorialCoreStartable.kt | 36 ++++++++++- ...yboardTouchpadTutorialCoreStartableTest.kt | 60 +++++++++++++++++++ 2 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 packages/SystemUI/tests/src/com/android/systemui/inputdevice/tutorial/KeyboardTouchpadTutorialCoreStartableTest.kt diff --git a/packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/KeyboardTouchpadTutorialCoreStartable.kt b/packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/KeyboardTouchpadTutorialCoreStartable.kt index 7ecacdc7cf16..092a25aa1cad 100644 --- a/packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/KeyboardTouchpadTutorialCoreStartable.kt +++ b/packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/KeyboardTouchpadTutorialCoreStartable.kt @@ -16,9 +16,17 @@ package com.android.systemui.inputdevice.tutorial +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.os.UserHandle import com.android.systemui.CoreStartable +import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.inputdevice.tutorial.ui.TutorialNotificationCoordinator +import com.android.systemui.inputdevice.tutorial.ui.view.KeyboardTouchpadTutorialActivity import com.android.systemui.shared.Flags.newTouchpadGesturesTutorial import dagger.Lazy import javax.inject.Inject @@ -27,11 +35,35 @@ import javax.inject.Inject @SysUISingleton class KeyboardTouchpadTutorialCoreStartable @Inject -constructor(private val tutorialNotificationCoordinator: Lazy) : - CoreStartable { +constructor( + private val tutorialNotificationCoordinator: Lazy, + private val broadcastDispatcher: BroadcastDispatcher, + @Application private val applicationContext: Context, +) : CoreStartable { override fun start() { if (newTouchpadGesturesTutorial()) { tutorialNotificationCoordinator.get().start() + registerTutorialBroadcastReceiver() } } + + private fun registerTutorialBroadcastReceiver() { + broadcastDispatcher.registerReceiver( + receiver = + object : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + applicationContext.startActivityAsUser( + Intent( + applicationContext, + KeyboardTouchpadTutorialActivity::class.java + ), + UserHandle.SYSTEM + ) + } + }, + filter = IntentFilter("com.android.systemui.action.KEYBOARD_TOUCHPAD_TUTORIAL"), + flags = Context.RECEIVER_EXPORTED, + user = UserHandle.ALL, + ) + } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/inputdevice/tutorial/KeyboardTouchpadTutorialCoreStartableTest.kt b/packages/SystemUI/tests/src/com/android/systemui/inputdevice/tutorial/KeyboardTouchpadTutorialCoreStartableTest.kt new file mode 100644 index 000000000000..9da68853a5aa --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/inputdevice/tutorial/KeyboardTouchpadTutorialCoreStartableTest.kt @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.inputdevice.tutorial + +import android.content.Context +import android.content.Intent +import android.os.UserHandle +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.systemui.SysuiTestCase +import com.android.systemui.broadcast.broadcastDispatcher +import com.android.systemui.inputdevice.tutorial.ui.TutorialNotificationCoordinator +import com.android.systemui.testKosmos +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.kotlin.any +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify + +@SmallTest +@RunWith(AndroidJUnit4::class) +class KeyboardTouchpadTutorialCoreStartableTest : SysuiTestCase() { + + private val kosmos = testKosmos() + private val broadcastDispatcher = kosmos.broadcastDispatcher + private val context = mock() + private val underTest = + KeyboardTouchpadTutorialCoreStartable( + { mock() }, + broadcastDispatcher, + context + ) + + @Test + fun registersBroadcastReceiverStartingActivityAsSystemUser() { + underTest.start() + + broadcastDispatcher.sendIntentToMatchingReceiversOnly( + context, + Intent("com.android.systemui.action.KEYBOARD_TOUCHPAD_TUTORIAL") + ) + + verify(context).startActivityAsUser(any(), eq(UserHandle.SYSTEM)) + } +} -- GitLab From ad7c2b9d3d4c69cf5818aa9784d6bec9742cc74c Mon Sep 17 00:00:00 2001 From: Anton Potapov Date: Mon, 9 Sep 2024 17:55:34 +0100 Subject: [PATCH 125/492] Use setRingerModeInternal in the AudioRepository instead of setRingerMode to align the behaviour with the volume sliders in the Settings app. Flag: EXEMPT bugfix Test: atest AudioRepositoryTest Test: manual of foldable. Make sure that adjusting ringe volume while DnD is ON doesn't change DnD state. Fixes: 364168680 Change-Id: I18aaa5cd048b4415ab574e9ee8287c783c7b3450 --- .../volume/data/repository/AudioRepository.kt | 6 ++--- .../interactor/AudioVolumeInteractor.kt | 2 +- .../data/repository/AudioRepositoryTest.kt | 23 +++++++++++++++++-- .../data/repository/FakeAudioRepository.kt | 8 ++----- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt b/packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt index 3e2d8328f21e..d3c345deebad 100644 --- a/packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt +++ b/packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt @@ -98,7 +98,7 @@ interface AudioRepository { */ suspend fun setMuted(audioStream: AudioStream, isMuted: Boolean): Boolean - suspend fun setRingerMode(audioStream: AudioStream, mode: RingerMode) + suspend fun setRingerModeInternal(audioStream: AudioStream, mode: RingerMode) /** Gets audio device category. */ @AudioDeviceCategory suspend fun getBluetoothAudioDeviceCategory(bluetoothAddress: String): Int @@ -248,8 +248,8 @@ class AudioRepositoryImpl( } } - override suspend fun setRingerMode(audioStream: AudioStream, mode: RingerMode) { - withContext(backgroundCoroutineContext) { audioManager.ringerMode = mode.value } + override suspend fun setRingerModeInternal(audioStream: AudioStream, mode: RingerMode) { + withContext(backgroundCoroutineContext) { audioManager.ringerModeInternal = mode.value } } @AudioDeviceCategory diff --git a/packages/SettingsLib/src/com/android/settingslib/volume/domain/interactor/AudioVolumeInteractor.kt b/packages/SettingsLib/src/com/android/settingslib/volume/domain/interactor/AudioVolumeInteractor.kt index 08863b56cbe0..dca890d34bc0 100644 --- a/packages/SettingsLib/src/com/android/settingslib/volume/domain/interactor/AudioVolumeInteractor.kt +++ b/packages/SettingsLib/src/com/android/settingslib/volume/domain/interactor/AudioVolumeInteractor.kt @@ -68,7 +68,7 @@ class AudioVolumeInteractor( if (audioStream.value == AudioManager.STREAM_RING) { val mode = if (isMuted) AudioManager.RINGER_MODE_VIBRATE else AudioManager.RINGER_MODE_NORMAL - audioRepository.setRingerMode(audioStream, RingerMode(mode)) + audioRepository.setRingerModeInternal(audioStream, RingerMode(mode)) } val mutedChanged = audioRepository.setMuted(audioStream, isMuted) if (mutedChanged && !isMuted) { diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/volume/data/repository/AudioRepositoryTest.kt b/packages/SettingsLib/tests/integ/src/com/android/settingslib/volume/data/repository/AudioRepositoryTest.kt index 52e639172af5..8a3b1dfb0846 100644 --- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/volume/data/repository/AudioRepositoryTest.kt +++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/volume/data/repository/AudioRepositoryTest.kt @@ -74,6 +74,8 @@ class AudioRepositoryTest { private lateinit var underTest: AudioRepository + private var ringerModeInternal: RingerMode = RingerMode(AudioManager.RINGER_MODE_NORMAL) + @Before fun setup() { MockitoAnnotations.initMocks(this) @@ -82,7 +84,7 @@ class AudioRepositoryTest { `when`(audioManager.communicationDevice).thenReturn(communicationDevice) `when`(audioManager.getStreamMinVolume(anyInt())).thenReturn(MIN_VOLUME) `when`(audioManager.getStreamMaxVolume(anyInt())).thenReturn(MAX_VOLUME) - `when`(audioManager.ringerModeInternal).thenReturn(AudioManager.RINGER_MODE_NORMAL) + `when`(audioManager.ringerModeInternal).then { ringerModeInternal.value } `when`(audioManager.setStreamVolume(anyInt(), anyInt(), anyInt())).then { val streamType = it.arguments[0] as Int volumeByStream[it.arguments[0] as Int] = it.arguments[1] as Int @@ -103,6 +105,10 @@ class AudioRepositoryTest { `when`(audioManager.isStreamMute(anyInt())).thenAnswer { isMuteByStream.getOrDefault(it.arguments[0] as Int, false) } + `when`(audioManager.setRingerModeInternal(anyInt())).then { + ringerModeInternal = RingerMode(it.arguments[0] as Int) + Unit + } underTest = AudioRepositoryImpl( @@ -137,7 +143,7 @@ class AudioRepositoryTest { underTest.ringerMode.onEach { modes.add(it) }.launchIn(backgroundScope) runCurrent() - `when`(audioManager.ringerModeInternal).thenReturn(AudioManager.RINGER_MODE_SILENT) + ringerModeInternal = RingerMode(AudioManager.RINGER_MODE_SILENT) triggerEvent(AudioManagerEvent.InternalRingerModeChanged) runCurrent() @@ -149,6 +155,19 @@ class AudioRepositoryTest { } } + @Test + fun changingRingerMode_changesRingerModeInternal() { + testScope.runTest { + underTest.setRingerModeInternal( + AudioStream(AudioManager.STREAM_SYSTEM), + RingerMode(AudioManager.RINGER_MODE_SILENT), + ) + runCurrent() + + assertThat(ringerModeInternal).isEqualTo(RingerMode(AudioManager.RINGER_MODE_SILENT)) + } + } + @Test fun communicationDeviceChanges_repositoryEmits() { testScope.runTest { diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/data/repository/FakeAudioRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/data/repository/FakeAudioRepository.kt index 888351f0a882..ba6ffd742611 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/data/repository/FakeAudioRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/data/repository/FakeAudioRepository.kt @@ -33,11 +33,7 @@ import kotlinx.coroutines.flow.update class FakeAudioRepository : AudioRepository { - private val unMutableStreams = - setOf( - AudioManager.STREAM_VOICE_CALL, - AudioManager.STREAM_ALARM, - ) + private val unMutableStreams = setOf(AudioManager.STREAM_VOICE_CALL, AudioManager.STREAM_ALARM) private val mutableMode = MutableStateFlow(AudioManager.MODE_NORMAL) override val mode: StateFlow = mutableMode.asStateFlow() @@ -126,7 +122,7 @@ class FakeAudioRepository : AudioRepository { lastAudibleVolumes[audioStream] = volume } - override suspend fun setRingerMode(audioStream: AudioStream, mode: RingerMode) { + override suspend fun setRingerModeInternal(audioStream: AudioStream, mode: RingerMode) { mutableRingerMode.value = mode } -- GitLab From 5c8b06b83dc1fb650910a32dcbf31d002474ac0f Mon Sep 17 00:00:00 2001 From: Ted Bauer Date: Mon, 9 Sep 2024 17:21:29 +0000 Subject: [PATCH 126/492] Switch to using override type enum Bug: 360205436 Test: m Change-Id: Ic91a9a48a6517d277ce21e463cf3d6df57216c82 --- .../com/android/server/am/SettingsToPropertiesMapper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java index cbea7aa9a92c..5c3640fa375d 100644 --- a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java +++ b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java @@ -445,7 +445,9 @@ public class SettingsToPropertiesMapper { proto.write(StorageRequestMessage.FlagOverrideMessage.PACKAGE_NAME, packageName); proto.write(StorageRequestMessage.FlagOverrideMessage.FLAG_NAME, flagName); proto.write(StorageRequestMessage.FlagOverrideMessage.FLAG_VALUE, flagValue); - proto.write(StorageRequestMessage.FlagOverrideMessage.IS_LOCAL, isLocal); + proto.write(StorageRequestMessage.FlagOverrideMessage.OVERRIDE_TYPE, isLocal + ? StorageRequestMessage.LOCAL_ON_REBOOT + : StorageRequestMessage.SERVER_ON_REBOOT); proto.end(msgToken); proto.end(msgsToken); } -- GitLab From 2384119ccc7d0ab15074b9e7eb22140d9f9d1d94 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Mon, 9 Sep 2024 10:25:14 -0700 Subject: [PATCH 127/492] Camera: Remove code for log_ultrawide_usage Flag: EXEMPT removing log_ultrawide_usage Test: Build Bug: 365555185 Change-Id: I750a19d997aaa91ecf17e0ae282d3b282ef23b27 --- .../java/com/android/server/camera/CameraServiceProxy.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/camera/CameraServiceProxy.java b/services/core/java/com/android/server/camera/CameraServiceProxy.java index 17835b2d085b..ec61d4d39aa0 100644 --- a/services/core/java/com/android/server/camera/CameraServiceProxy.java +++ b/services/core/java/com/android/server/camera/CameraServiceProxy.java @@ -379,9 +379,7 @@ public class CameraServiceProxy extends SystemService streamCount = mStreamStats.size(); } if (CameraServiceProxy.DEBUG) { - String ultrawideDebug = Flags.logUltrawideUsage() - ? ", wideAngleUsage " + mUsedUltraWide - : ""; + String ultrawideDebug = ", wideAngleUsage " + mUsedUltraWide; String zoomOverrideDebug = Flags.logZoomOverrideUsage() ? ", zoomOverrideUsage " + mUsedZoomOverride : ""; @@ -1338,7 +1336,7 @@ public class CameraServiceProxy extends SystemService List streamStats = cameraState.getStreamStats(); String userTag = cameraState.getUserTag(); int videoStabilizationMode = cameraState.getVideoStabilizationMode(); - boolean usedUltraWide = Flags.logUltrawideUsage() ? cameraState.getUsedUltraWide() : false; + boolean usedUltraWide = cameraState.getUsedUltraWide(); boolean usedZoomOverride = Flags.logZoomOverrideUsage() ? cameraState.getUsedZoomOverride() : false; long logId = cameraState.getLogId(); -- GitLab From a7b7ae82c972c3cbbe4c578cd6180bce1f00fa83 Mon Sep 17 00:00:00 2001 From: Tudor Magirescu Date: Fri, 30 Aug 2024 10:45:40 +0000 Subject: [PATCH 128/492] Migrate PermissionAnnotationDetector to global lint checks PermissionAnnotationDetector will no longer be a local lint check which could optionally be added to build targets, but instead a global lint check ran on every build. New AIDL Interfaces part of the system_server process will need to use @EnforcePermission annotations. The detector does not enforce old AIDL Interfaces to use the annotations. These are included in the exemptAidlInterfaces set generated by ExemptAidlInterfacesGenerator. The CL removes the reference to the PermissionAnnotationDetector from the Accessibility Service build targets. Instead the already-annotated AIDL Interfaces are removed from exemptAidlInterfaces, achieving the same effect. Bug: 363248121 Test: PermissionAnnotationDetectorTest Flag: EXEMPT lint check Change-Id: I2cad77cbc7883087dd95b9558d3543fcb321bbc8 --- services/accessibility/Android.bp | 5 - .../AccessibilityInputFilter.java | 1 - .../FingerprintGestureDispatcher.java | 1 - .../lint/aidl/EnforcePermissionUtils.kt | 23 ++ .../lint/AndroidFrameworkIssueRegistry.kt | 2 - .../lint/PermissionAnnotationDetectorTest.kt | 134 ---------- .../lint/AndroidGlobalIssueRegistry.kt | 2 + .../android/lint/aidl/ExemptAidlInterfaces.kt | 8 - .../aidl}/PermissionAnnotationDetector.kt | 9 +- .../aidl/PermissionAnnotationDetectorTest.kt | 230 ++++++++++++++++++ .../aidl/ExemptAidlInterfacesGenerator.kt | 15 +- 11 files changed, 263 insertions(+), 167 deletions(-) delete mode 100644 tools/lint/framework/checks/src/test/java/com/google/android/lint/PermissionAnnotationDetectorTest.kt rename tools/lint/{framework/checks/src/main/java/com/google/android/lint => global/checks/src/main/java/com/google/android/lint/aidl}/PermissionAnnotationDetector.kt (92%) create mode 100644 tools/lint/global/checks/src/test/java/com/google/android/lint/aidl/PermissionAnnotationDetectorTest.kt diff --git a/services/accessibility/Android.bp b/services/accessibility/Android.bp index 3d7ad0b94d1b..34b9a5db580f 100644 --- a/services/accessibility/Android.bp +++ b/services/accessibility/Android.bp @@ -19,11 +19,6 @@ java_library_static { defaults: [ "platform_service_defaults", ], - lint: { - error_checks: ["MissingPermissionAnnotation"], - baseline_filename: "lint-baseline.xml", - - }, srcs: [ ":services.accessibility-sources", ":statslog-accessibility-java-gen", diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java index 1b2447e2c58a..617cca9d3075 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java @@ -67,7 +67,6 @@ import java.util.StringJoiner; * * NOTE: This class has to be created and poked only from the main thread. */ -@SuppressWarnings("MissingPermissionAnnotation") class AccessibilityInputFilter extends InputFilter implements EventStreamTransformation { private static final String TAG = AccessibilityInputFilter.class.getSimpleName(); diff --git a/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java b/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java index e10e87c51d59..c9ec16edc54e 100644 --- a/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java +++ b/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java @@ -33,7 +33,6 @@ import java.util.List; /** * Encapsulate fingerprint gesture logic */ -@SuppressWarnings("MissingPermissionAnnotation") public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallback.Stub implements Handler.Callback{ private static final int MSG_REGISTER = 1; diff --git a/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt b/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt index f5af99ec39ac..b79563f740ee 100644 --- a/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt +++ b/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt @@ -103,3 +103,26 @@ fun getHelperMethodFix( return fix.build() } + +/** + * PermissionAnnotationDetector uses this method to determine whether a specific file should be + * checked for unannotated methods. Only files located in directories whose paths begin with one + * of these prefixes will be considered. + */ +fun isSystemServicePath(context: JavaContext): Boolean { + val systemServicePathPrefixes = setOf( + "frameworks/base/services", + "frameworks/base/apex", + "frameworks/opt/wear", + "packages/modules" + ) + + val filePath = context.file.path + + // We perform `filePath.contains` instead of `filePath.startsWith` since getting the + // relative path of a source file is non-trivial. That is because `context.file.path` + // returns the path to where soong builds the file (i.e. /out/soong/...). Moreover, the + // logic to extract the relative path would need to consider several /out/soong/... + // locations patterns. + return systemServicePathPrefixes.any { filePath.contains(it) } +} diff --git a/tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt b/tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt index 5c6469706e18..af753e5963a3 100644 --- a/tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt +++ b/tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt @@ -20,7 +20,6 @@ import com.android.tools.lint.client.api.IssueRegistry import com.android.tools.lint.client.api.Vendor import com.android.tools.lint.detector.api.CURRENT_API import com.google.android.lint.parcel.SaferParcelChecker -import com.google.android.lint.aidl.PermissionAnnotationDetector import com.google.auto.service.AutoService @AutoService(IssueRegistry::class) @@ -38,7 +37,6 @@ class AndroidFrameworkIssueRegistry : IssueRegistry() { SaferParcelChecker.ISSUE_UNSAFE_API_USAGE, // TODO: Currently crashes due to OOM issue // PackageVisibilityDetector.ISSUE_PACKAGE_NAME_NO_PACKAGE_VISIBILITY_FILTERS, - PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION, PermissionMethodDetector.ISSUE_PERMISSION_METHOD_USAGE, PermissionMethodDetector.ISSUE_CAN_BE_PERMISSION_METHOD, FeatureAutomotiveDetector.ISSUE, diff --git a/tools/lint/framework/checks/src/test/java/com/google/android/lint/PermissionAnnotationDetectorTest.kt b/tools/lint/framework/checks/src/test/java/com/google/android/lint/PermissionAnnotationDetectorTest.kt deleted file mode 100644 index bce848a2e3a7..000000000000 --- a/tools/lint/framework/checks/src/test/java/com/google/android/lint/PermissionAnnotationDetectorTest.kt +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.lint.aidl - -import com.android.tools.lint.checks.infrastructure.LintDetectorTest -import com.android.tools.lint.checks.infrastructure.TestFile -import com.android.tools.lint.checks.infrastructure.TestLintTask -import com.android.tools.lint.detector.api.Detector -import com.android.tools.lint.detector.api.Issue - -@Suppress("UnstableApiUsage") -class PermissionAnnotationDetectorTest : LintDetectorTest() { - override fun getDetector(): Detector = PermissionAnnotationDetector() - - override fun getIssues(): List = listOf( - PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION, - ) - - override fun lint(): TestLintTask = super.lint().allowMissingSdk(true) - - /** No issue scenario */ - - fun testDoesNotDetectIssuesInCorrectScenario() { - lint().files( - java( - """ - public class Foo extends IFoo.Stub { - @Override - @android.annotation.EnforcePermission("android.Manifest.permission.READ_CONTACTS") - public void testMethod() { } - } - """ - ).indented(), - *stubs - ) - .run() - .expectClean() - } - - fun testMissingAnnotation() { - lint().files( - java( - """ - public class Bar extends IBar.Stub { - public void testMethod() { } - } - """ - ).indented(), - *stubs - ) - .run() - .expect( - """ - src/Bar.java:2: Error: The method testMethod is not permission-annotated. [MissingPermissionAnnotation] - public void testMethod() { } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1 errors, 0 warnings - """ - ) - } - - fun testNoIssueWhenExtendingWithAnotherSubclass() { - lint().files( - java( - """ - public class Foo extends IFoo.Stub { - @Override - @android.annotation.EnforcePermission(android.Manifest.permission.READ_PHONE_STATE) - public void testMethod() { } - // not an AIDL method, just another method - public void someRandomMethod() { } - } - """).indented(), - java( - """ - public class Baz extends Bar { - @Override - public void someRandomMethod() { } - } - """).indented(), - *stubs - ) - .run() - .expectClean() - } - - /* Stubs */ - - // A service with permission annotation on the method. - private val interfaceIFoo: TestFile = java( - """ - public interface IFoo extends android.os.IInterface { - public static abstract class Stub extends android.os.Binder implements IFoo { - } - @Override - @android.annotation.EnforcePermission(android.Manifest.permission.READ_PHONE_STATE) - public void testMethod(); - @Override - @android.annotation.RequiresNoPermission - public void testMethodNoPermission(); - @Override - @android.annotation.PermissionManuallyEnforced - public void testMethodManual(); - } - """ - ).indented() - - // A service with no permission annotation. - private val interfaceIBar: TestFile = java( - """ - public interface IBar extends android.os.IInterface { - public static abstract class Stub extends android.os.Binder implements IBar { - } - public void testMethod(); - } - """ - ).indented() - - private val stubs = arrayOf(interfaceIFoo, interfaceIBar) -} diff --git a/tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt b/tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt index 28eab8f62e74..290e7be9f6c4 100644 --- a/tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt +++ b/tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt @@ -20,6 +20,7 @@ import com.android.tools.lint.client.api.IssueRegistry import com.android.tools.lint.client.api.Vendor import com.android.tools.lint.detector.api.CURRENT_API import com.google.android.lint.aidl.EnforcePermissionDetector +import com.google.android.lint.aidl.PermissionAnnotationDetector import com.google.android.lint.aidl.SimpleManualPermissionEnforcementDetector import com.google.auto.service.AutoService @@ -31,6 +32,7 @@ class AndroidGlobalIssueRegistry : IssueRegistry() { EnforcePermissionDetector.ISSUE_MISMATCHING_ENFORCE_PERMISSION, EnforcePermissionDetector.ISSUE_ENFORCE_PERMISSION_HELPER, EnforcePermissionDetector.ISSUE_MISUSING_ENFORCE_PERMISSION, + PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION, SimpleManualPermissionEnforcementDetector.ISSUE_SIMPLE_MANUAL_PERMISSION_ENFORCEMENT, ) diff --git a/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt index 8777712b0f04..675a59e6ae3e 100644 --- a/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt +++ b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt @@ -20,12 +20,8 @@ package com.google.android.lint.aidl * The exemptAidlInterfaces set was generated by running ExemptAidlInterfacesGenerator on the * entire source tree. To reproduce the results, run generate-exempt-aidl-interfaces.sh * located in tools/lint/utils. - * - * TODO: b/363248121 - Use the exemptAidlInterfaces set inside PermissionAnnotationDetector when it - * gets migrated to a global lint check. */ val exemptAidlInterfaces = setOf( - "android.accessibilityservice.IAccessibilityServiceConnection", "android.accessibilityservice.IBrailleDisplayConnection", "android.accounts.IAccountAuthenticatorResponse", "android.accounts.IAccountManager", @@ -663,10 +659,6 @@ val exemptAidlInterfaces = setOf( "android.uwb.IUwbOemExtensionCallback", "android.uwb.IUwbRangingCallbacks", "android.uwb.IUwbVendorUciCallback", - "android.view.accessibility.IAccessibilityInteractionConnectionCallback", - "android.view.accessibility.IAccessibilityManager", - "android.view.accessibility.IMagnificationConnectionCallback", - "android.view.accessibility.IRemoteMagnificationAnimationCallback", "android.view.autofill.IAutoFillManager", "android.view.autofill.IAutofillWindowPresenter", "android.view.contentcapture.IContentCaptureManager", diff --git a/tools/lint/framework/checks/src/main/java/com/google/android/lint/PermissionAnnotationDetector.kt b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/PermissionAnnotationDetector.kt similarity index 92% rename from tools/lint/framework/checks/src/main/java/com/google/android/lint/PermissionAnnotationDetector.kt rename to tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/PermissionAnnotationDetector.kt index 6b50cfd9e5ab..d44c271e734c 100644 --- a/tools/lint/framework/checks/src/main/java/com/google/android/lint/PermissionAnnotationDetector.kt +++ b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/PermissionAnnotationDetector.kt @@ -43,8 +43,14 @@ class PermissionAnnotationDetector : AidlImplementationDetector() { interfaceName: String, body: UBlockExpression ) { + if (!isSystemServicePath(context)) return + if (context.evaluator.isAbstract(node)) return + val fullyQualifiedInterfaceName = + getContainingAidlInterfaceQualified(context, node) ?: return + if (exemptAidlInterfaces.contains(fullyQualifiedInterfaceName)) return + if (AIDL_PERMISSION_ANNOTATIONS.any { node.hasAnnotation(it) }) return context.report( @@ -80,8 +86,7 @@ class PermissionAnnotationDetector : AidlImplementationDetector() { implementation = Implementation( PermissionAnnotationDetector::class.java, Scope.JAVA_FILE_SCOPE - ), - enabledByDefault = false + ) ) } } diff --git a/tools/lint/global/checks/src/test/java/com/google/android/lint/aidl/PermissionAnnotationDetectorTest.kt b/tools/lint/global/checks/src/test/java/com/google/android/lint/aidl/PermissionAnnotationDetectorTest.kt new file mode 100644 index 000000000000..92d0829911bf --- /dev/null +++ b/tools/lint/global/checks/src/test/java/com/google/android/lint/aidl/PermissionAnnotationDetectorTest.kt @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.lint.aidl + +import com.android.tools.lint.checks.infrastructure.LintDetectorTest +import com.android.tools.lint.checks.infrastructure.TestFile +import com.android.tools.lint.checks.infrastructure.TestLintTask +import com.android.tools.lint.detector.api.Detector +import com.android.tools.lint.detector.api.Issue + +@Suppress("UnstableApiUsage") +class PermissionAnnotationDetectorTest : LintDetectorTest() { + override fun getDetector(): Detector = + PermissionAnnotationDetector() + + override fun getIssues(): List = listOf( + PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION, + ) + + override fun lint(): TestLintTask = super.lint().allowMissingSdk(true) + + /** No issue scenario */ + + fun testDoesNotDetectIssuesInCorrectScenario() { + lint() + .files( + java( + createVisitedPath("Foo.java"), + """ + package com.android.server; + public class Foo extends IFoo.Stub { + @Override + @android.annotation.EnforcePermission("android.Manifest.permission.READ_CONTACTS") + public void testMethod() { } + } + """ + ) + .indented(), + *stubs + ) + .run() + .expectClean() + } + + fun testMissingAnnotation() { + lint() + .files( + java( + createVisitedPath("Bar.java"), + """ + package com.android.server; + public class Bar extends IBar.Stub { + public void testMethod() { } + } + """ + ) + .indented(), + *stubs + ) + .run() + .expect( + """ + src/frameworks/base/services/java/com/android/server/Bar.java:3: Error: The method testMethod is not permission-annotated. [MissingPermissionAnnotation] + public void testMethod() { } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 errors, 0 warnings + """ + ) + } + + fun testMissingAnnotationInIgnoredDirectory() { + lint() + .files( + java( + ignoredPath, + """ + package com.android.server; + public class Bar extends IBar.Stub { + public void testMethod() { } + } + """ + ) + .indented(), + *stubs + ) + .run() + .expectClean() + } + + // If this test fails, consider the following steps: + // 1. Pick the first entry (interface) from `exemptAidlInterfaces`. + // 2. Change `interfaceIExempted` to use that interface. + // 3. Change this test's class to extend the interface's Stub. + fun testMissingAnnotationAidlInterfaceExempted() { + lint() + .files( + java( + createVisitedPath("Bar.java"), + """ + package com.android.server; + public class Bar extends android.accessibilityservice.IBrailleDisplayConnection.Stub { + public void testMethod() { } + } + """ + ) + .indented(), + *stubs + ) + .run() + .expectClean() + } + + fun testMissingAnnotationAidlInterfaceAbstractMethod() { + lint() + .files( + java( + createVisitedPath("Bar.java"), + """ + package com.android.server; + public abstract class Bar extends IBar.Stub { + public abstract void testMethod(); + } + """ + ) + .indented(), + *stubs + ) + .run() + .expectClean() + } + + fun testNoIssueWhenExtendingWithAnotherSubclass() { + lint() + .files( + java( + createVisitedPath("Foo.java"), + """ + package com.android.server; + public class Foo extends IFoo.Stub { + @Override + @android.annotation.EnforcePermission(android.Manifest.permission.READ_PHONE_STATE) + public void testMethod() { } + // not an AIDL method, just another method + public void someRandomMethod() { } + } + """ + ) + .indented(), + java( + createVisitedPath("Baz.java"), + """ + package com.android.server; + public class Baz extends Bar { + @Override + public void someRandomMethod() { } + } + """ + ) + .indented(), + *stubs + ) + .run() + .expectClean() + } + + /* Stubs */ + + // A service with permission annotation on the method. + private val interfaceIFoo: TestFile = java( + """ + public interface IFoo extends android.os.IInterface { + public static abstract class Stub extends android.os.Binder implements IFoo { + } + @Override + @android.annotation.EnforcePermission(android.Manifest.permission.READ_PHONE_STATE) + public void testMethod(); + @Override + @android.annotation.RequiresNoPermission + public void testMethodNoPermission(); + @Override + @android.annotation.PermissionManuallyEnforced + public void testMethodManual(); + } + """ + ).indented() + + // A service with no permission annotation. + private val interfaceIBar: TestFile = java( + """ + public interface IBar extends android.os.IInterface { + public static abstract class Stub extends android.os.Binder implements IBar { + } + public void testMethod(); + } + """ + ).indented() + + // A service whose AIDL Interface is exempted. + private val interfaceIExempted: TestFile = java( + """ + package android.accessibilityservice; + public interface IBrailleDisplayConnection extends android.os.IInterface { + public static abstract class Stub extends android.os.Binder implements IBrailleDisplayConnection { + } + public void testMethod(); + } + """ + ).indented() + + private val stubs = arrayOf(interfaceIFoo, interfaceIBar, interfaceIExempted) + + private fun createVisitedPath(filename: String) = + "src/frameworks/base/services/java/com/android/server/$filename" + + private val ignoredPath = "src/test/pkg/TestClass.java" +} diff --git a/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt b/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt index 6ad223c87a29..57c2e5aa9767 100644 --- a/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt +++ b/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt @@ -33,12 +33,6 @@ import org.jetbrains.uast.UMethod */ class ExemptAidlInterfacesGenerator : AidlImplementationDetector() { private val targetExemptAidlInterfaceNames = mutableSetOf() - private val systemServicePathPrefixes = setOf( - "frameworks/base/services", - "frameworks/base/apex", - "frameworks/opt/wear", - "packages/modules" - ) // We could've improved performance by visiting classes rather than methods, however, this lint // check won't be run regularly, hence we've decided not to add extra overrides to @@ -49,14 +43,7 @@ class ExemptAidlInterfacesGenerator : AidlImplementationDetector() { interfaceName: String, body: UBlockExpression ) { - val filePath = context.file.path - - // We perform `filePath.contains` instead of `filePath.startsWith` since getting the - // relative path of a source file is non-trivial. That is because `context.file.path` - // returns the path to where soong builds the file (i.e. /out/soong/...). Moreover, the - // logic to extract the relative path would need to consider several /out/soong/... - // locations patterns. - if (systemServicePathPrefixes.none { filePath.contains(it) }) return + if (!isSystemServicePath(context)) return val fullyQualifiedInterfaceName = getContainingAidlInterfaceQualified(context, node) ?: return -- GitLab From 6277c9fa8298afd625339dda00cb6ce1f0c4c8b8 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Mon, 9 Sep 2024 10:28:24 -0700 Subject: [PATCH 129/492] Camera: Remove code for log_zoom_override_usage Flag: EXEMPT removing log_zoom_override_usage Test: Build Bug: 365555185 Change-Id: I2700299f7f681e0d45d65eef014b06c01a5bea13 --- .../java/com/android/server/camera/CameraServiceProxy.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/camera/CameraServiceProxy.java b/services/core/java/com/android/server/camera/CameraServiceProxy.java index ec61d4d39aa0..05fc6bc869ca 100644 --- a/services/core/java/com/android/server/camera/CameraServiceProxy.java +++ b/services/core/java/com/android/server/camera/CameraServiceProxy.java @@ -380,9 +380,7 @@ public class CameraServiceProxy extends SystemService } if (CameraServiceProxy.DEBUG) { String ultrawideDebug = ", wideAngleUsage " + mUsedUltraWide; - String zoomOverrideDebug = Flags.logZoomOverrideUsage() - ? ", zoomOverrideUsage " + mUsedZoomOverride - : ""; + String zoomOverrideDebug = ", zoomOverrideUsage " + mUsedZoomOverride; String mostRequestedFpsRangeDebug = Flags.analytics24q3() ? ", mostRequestedFpsRange " + mMostRequestedFpsRange : ""; @@ -1337,8 +1335,7 @@ public class CameraServiceProxy extends SystemService String userTag = cameraState.getUserTag(); int videoStabilizationMode = cameraState.getVideoStabilizationMode(); boolean usedUltraWide = cameraState.getUsedUltraWide(); - boolean usedZoomOverride = - Flags.logZoomOverrideUsage() ? cameraState.getUsedZoomOverride() : false; + boolean usedZoomOverride = cameraState.getUsedZoomOverride(); long logId = cameraState.getLogId(); int sessionIdx = cameraState.getSessionIndex(); CameraExtensionSessionStats extSessionStats = cameraState.getExtensionSessionStats(); -- GitLab From 7f125f08fa6304344ddf0063a64f24908604d917 Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Wed, 4 Sep 2024 21:12:37 +0000 Subject: [PATCH 130/492] [SB][RONs] Support multiple ongoing activity chips. This CL updates the left side of the status bar to show up to 2 ongoing activity chips if there are multiple activities present. It does this by: 1) Adding a second ongoing_activity_chip to status_bar.xml 2) Adding a new flow to OngoingActivityChipsViewModel that emits the *2* chips that should be shown, instead of just 1 3) Updating CollapsedStatusBarViewBinder to bind each chip separately 4) Updating CollapsedStatusBarFragment to show/hide each chip. Notably: If the primary chip gets demoted to the secondary chip, then the *data* moves from the primary view to the secondary view. The chip views themselves *never* move. This is much cleaner from an implementation standpoint, but it means that there is no transition animation. Still to come: - Don't show the secondary chip at all if there isn't enough room - Some amount of animation? Bug: 364653005 Flag: com.android.systemui.status_bar_ron_chips Test: With ron flag off, verify the single chip model still works as expected in all cases (prioritizes the right one, swaps appropriately, etc.) Test: With the ron flag on, trigger multiple chips at once (e.g. be on a phone call then start a screen recording) -> verify both chips show with their specific data, verify tapping works as expected Change-Id: Iaebcfce3d823760cfbf70b0a10eeea1823b193f8 Change-Id: Iefbffe0e1334f41d2990bd1144914862a2d1a69c --- packages/SystemUI/res/layout/status_bar.xml | 4 +- .../chips/shared/StatusBarRonChips.kt | 61 ++ .../MultipleOngoingActivityChipsModel.kt | 37 ++ .../OngoingActivityChipsViewModel.kt | 327 ++++++++--- .../fragment/CollapsedStatusBarFragment.java | 70 ++- .../CollapsedStatusBarFragmentLogger.kt | 41 +- .../fragment/StatusBarVisibilityModel.kt | 14 +- .../ui/binder/CollapsedStatusBarViewBinder.kt | 37 +- .../viewmodel/CollapsedStatusBarViewModel.kt | 9 + .../OngoingActivityChipsViewModelTest.kt | 46 +- ...goingActivityChipsWithRonsViewModelTest.kt | 534 ++++++++++++++++++ .../CollapsedStatusBarFragmentLoggerTest.kt | 15 +- .../CollapsedStatusBarFragmentTest.java | 234 +++++++- .../fragment/StatusBarVisibilityModelTest.kt | 13 +- .../FakeCollapsedStatusBarViewModel.kt | 3 + 15 files changed, 1250 insertions(+), 195 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/chips/shared/StatusBarRonChips.kt create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/model/MultipleOngoingActivityChipsModel.kt create mode 100644 packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithRonsViewModelTest.kt diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml index ee75b3145aef..c00326b2a1bf 100644 --- a/packages/SystemUI/res/layout/status_bar.xml +++ b/packages/SystemUI/res/layout/status_bar.xml @@ -102,7 +102,9 @@ - + = + private data class ChipBundle( + val screenRecord: OngoingActivityChipModel = OngoingActivityChipModel.Hidden(), + val shareToApp: OngoingActivityChipModel = OngoingActivityChipModel.Hidden(), + val castToOtherDevice: OngoingActivityChipModel = OngoingActivityChipModel.Hidden(), + val call: OngoingActivityChipModel = OngoingActivityChipModel.Hidden(), + val demoRon: OngoingActivityChipModel = OngoingActivityChipModel.Hidden(), + ) + + /** Bundles all the incoming chips into one object to easily pass to various flows. */ + private val incomingChipBundle = combine( - screenRecordChipViewModel.chip, - shareToAppChipViewModel.chip, - castToOtherDeviceChipViewModel.chip, - callChipViewModel.chip, - demoRonChipViewModel.chip, - ) { screenRecord, shareToApp, castToOtherDevice, call, demoRon -> - logger.log( - TAG, - LogLevel.INFO, - { - str1 = screenRecord.logName - str2 = shareToApp.logName - str3 = castToOtherDevice.logName - }, - { "Chips: ScreenRecord=$str1 > ShareToApp=$str2 > CastToOther=$str3..." }, - ) - logger.log( - TAG, - LogLevel.INFO, - { - str1 = call.logName - str2 = demoRon.logName - }, - { "... > Call=$str1 > DemoRon=$str2" } - ) - // This `when` statement shows the priority order of the chips. - when { - // Screen recording also activates the media projection APIs, so whenever the - // screen recording chip is active, the media projection chip would also be - // active. We want the screen-recording-specific chip shown in this case, so we - // give the screen recording chip priority. See b/296461748. - screenRecord is OngoingActivityChipModel.Shown -> - InternalChipModel.Shown(ChipType.ScreenRecord, screenRecord) - shareToApp is OngoingActivityChipModel.Shown -> - InternalChipModel.Shown(ChipType.ShareToApp, shareToApp) - castToOtherDevice is OngoingActivityChipModel.Shown -> - InternalChipModel.Shown(ChipType.CastToOtherDevice, castToOtherDevice) - call is OngoingActivityChipModel.Shown -> - InternalChipModel.Shown(ChipType.Call, call) - demoRon is OngoingActivityChipModel.Shown -> { - StatusBarRonChips.assertInNewMode() - InternalChipModel.Shown(ChipType.DemoRon, demoRon) - } - else -> { - // We should only get here if all chip types are hidden - check(screenRecord is OngoingActivityChipModel.Hidden) - check(shareToApp is OngoingActivityChipModel.Hidden) - check(castToOtherDevice is OngoingActivityChipModel.Hidden) - check(call is OngoingActivityChipModel.Hidden) - check(demoRon is OngoingActivityChipModel.Hidden) - InternalChipModel.Hidden( - screenRecord = screenRecord, - shareToApp = shareToApp, - castToOtherDevice = castToOtherDevice, - call = call, - demoRon = demoRon, - ) - } + screenRecordChipViewModel.chip, + shareToAppChipViewModel.chip, + castToOtherDeviceChipViewModel.chip, + callChipViewModel.chip, + demoRonChipViewModel.chip, + ) { screenRecord, shareToApp, castToOtherDevice, call, demoRon -> + logger.log( + TAG, + LogLevel.INFO, + { + str1 = screenRecord.logName + str2 = shareToApp.logName + str3 = castToOtherDevice.logName + }, + { "Chips: ScreenRecord=$str1 > ShareToApp=$str2 > CastToOther=$str3..." }, + ) + logger.log( + TAG, + LogLevel.INFO, + { + str1 = call.logName + str2 = demoRon.logName + }, + { "... > Call=$str1 > DemoRon=$str2" } + ) + ChipBundle( + screenRecord = screenRecord, + shareToApp = shareToApp, + castToOtherDevice = castToOtherDevice, + call = call, + demoRon = demoRon, + ) } - } + // Some of the chips could have timers in them and we don't want the start time + // for those timers to get reset for any reason. So, as soon as any subscriber has + // requested the chip information, we maintain it forever by using + // [SharingStarted.Lazily]. See b/347726238. + .stateIn(scope, SharingStarted.Lazily, ChipBundle()) + + private val internalChip: Flow = + incomingChipBundle.map { bundle -> pickMostImportantChip(bundle).mostImportantChip } /** * A flow modeling the primary chip that should be shown in the status bar after accounting for @@ -160,37 +152,188 @@ constructor( val primaryChip: StateFlow = internalChip .pairwise(initialValue = DEFAULT_INTERNAL_HIDDEN_MODEL) - .map { (old, new) -> - if (old is InternalChipModel.Shown && new is InternalChipModel.Hidden) { - // If we're transitioning from showing the chip to hiding the chip, different - // chips require different animation behaviors. For example, the screen share - // chips shouldn't animate if the user stopped the screen share from the dialog - // (see b/353249803#comment4), but the call chip should always animate. - // - // This `when` block makes sure that when we're transitioning from Shown to - // Hidden, we check what chip type was previously showing and we use that chip - // type's hide animation behavior. - when (old.type) { - ChipType.ScreenRecord -> new.screenRecord - ChipType.ShareToApp -> new.shareToApp - ChipType.CastToOtherDevice -> new.castToOtherDevice - ChipType.Call -> new.call - ChipType.DemoRon -> new.demoRon - } - } else if (new is InternalChipModel.Shown) { - // If we have a chip to show, always show it. - new.model - } else { - // In the Hidden -> Hidden transition, it shouldn't matter which hidden model we - // choose because no animation should happen regardless. - OngoingActivityChipModel.Hidden() + .map { (old, new) -> createOutputModel(old, new) } + .stateIn(scope, SharingStarted.Lazily, OngoingActivityChipModel.Hidden()) + + /** + * Equivalent to [MultipleOngoingActivityChipsModel] but using the internal models to do some + * state tracking before we get the final output. + */ + private data class InternalMultipleOngoingActivityChipsModel( + val primary: InternalChipModel, + val secondary: InternalChipModel, + ) + + private val internalChips: Flow = + incomingChipBundle.map { bundle -> + // First: Find the most important chip. + val primaryChipResult = pickMostImportantChip(bundle) + val primaryChip = primaryChipResult.mostImportantChip + if (primaryChip is InternalChipModel.Hidden) { + // If the primary chip is hidden, the secondary chip will also be hidden, so just + // pass the same Hidden model for both. + InternalMultipleOngoingActivityChipsModel(primaryChip, primaryChip) + } else { + // Then: Find the next most important chip. + val secondaryChip = + pickMostImportantChip(primaryChipResult.remainingChips).mostImportantChip + InternalMultipleOngoingActivityChipsModel(primaryChip, secondaryChip) + } + } + + /** + * A flow modeling the primary chip that should be shown in the status bar after accounting for + * possibly multiple ongoing activities and animation requirements. + * + * [com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment] is responsible for + * actually displaying the chip. + */ + val chips: StateFlow = + if (!Flags.statusBarRonChips()) { + // Multiple chips are only allowed with RONs. If the flag isn't on, use just the + // primary chip. + primaryChip + .map { + MultipleOngoingActivityChipsModel( + primary = it, + secondary = OngoingActivityChipModel.Hidden(), + ) } + .stateIn( + scope, + SharingStarted.Lazily, + MultipleOngoingActivityChipsModel(), + ) + } else { + internalChips + .pairwise(initialValue = DEFAULT_MULTIPLE_INTERNAL_HIDDEN_MODEL) + .map { (old, new) -> + val correctPrimary = createOutputModel(old.primary, new.primary) + val correctSecondary = createOutputModel(old.secondary, new.secondary) + MultipleOngoingActivityChipsModel(correctPrimary, correctSecondary) + } + .stateIn( + scope, + SharingStarted.Lazily, + MultipleOngoingActivityChipsModel(), + ) + } + + /** A data class representing the return result of [pickMostImportantChip]. */ + private data class MostImportantChipResult( + val mostImportantChip: InternalChipModel, + val remainingChips: ChipBundle, + ) + + /** + * Finds the most important chip from the given [bundle]. + * + * This function returns that most important chip, and it also returns any remaining chips that + * still want to be shown after filtering out the most important chip. + */ + private fun pickMostImportantChip(bundle: ChipBundle): MostImportantChipResult { + // This `when` statement shows the priority order of the chips. + return when { + bundle.screenRecord is OngoingActivityChipModel.Shown -> + MostImportantChipResult( + mostImportantChip = + InternalChipModel.Shown(ChipType.ScreenRecord, bundle.screenRecord), + remainingChips = + bundle.copy( + screenRecord = OngoingActivityChipModel.Hidden(), + // Screen recording also activates the media projection APIs, which + // means that whenever the screen recording chip is active, the + // share-to-app chip would also be active. (Screen recording is a + // special case of share-to-app, where the app receiving the share is + // specifically System UI.) + // We want only the screen-recording-specific chip to be shown in this + // case. If we did have screen recording as the primary chip, we need to + // suppress the share-to-app chip to make sure they don't both show. + // See b/296461748. + shareToApp = OngoingActivityChipModel.Hidden(), + ) + ) + bundle.shareToApp is OngoingActivityChipModel.Shown -> + MostImportantChipResult( + mostImportantChip = + InternalChipModel.Shown(ChipType.ShareToApp, bundle.shareToApp), + remainingChips = bundle.copy(shareToApp = OngoingActivityChipModel.Hidden()), + ) + bundle.castToOtherDevice is OngoingActivityChipModel.Shown -> + MostImportantChipResult( + mostImportantChip = + InternalChipModel.Shown( + ChipType.CastToOtherDevice, + bundle.castToOtherDevice, + ), + remainingChips = + bundle.copy(castToOtherDevice = OngoingActivityChipModel.Hidden()), + ) + bundle.call is OngoingActivityChipModel.Shown -> + MostImportantChipResult( + mostImportantChip = InternalChipModel.Shown(ChipType.Call, bundle.call), + remainingChips = bundle.copy(call = OngoingActivityChipModel.Hidden()), + ) + bundle.demoRon is OngoingActivityChipModel.Shown -> { + StatusBarRonChips.assertInNewMode() + MostImportantChipResult( + mostImportantChip = InternalChipModel.Shown(ChipType.DemoRon, bundle.demoRon), + remainingChips = bundle.copy(demoRon = OngoingActivityChipModel.Hidden()), + ) } - // Some of the chips could have timers in them and we don't want the start time - // for those timers to get reset for any reason. So, as soon as any subscriber has - // requested the chip information, we maintain it forever by using - // [SharingStarted.Lazily]. See b/347726238. - .stateIn(scope, SharingStarted.Lazily, OngoingActivityChipModel.Hidden()) + else -> { + // We should only get here if all chip types are hidden + check(bundle.screenRecord is OngoingActivityChipModel.Hidden) + check(bundle.shareToApp is OngoingActivityChipModel.Hidden) + check(bundle.castToOtherDevice is OngoingActivityChipModel.Hidden) + check(bundle.call is OngoingActivityChipModel.Hidden) + check(bundle.demoRon is OngoingActivityChipModel.Hidden) + MostImportantChipResult( + mostImportantChip = + InternalChipModel.Hidden( + screenRecord = bundle.screenRecord, + shareToApp = bundle.shareToApp, + castToOtherDevice = bundle.castToOtherDevice, + call = bundle.call, + demoRon = bundle.demoRon, + ), + // All the chips are already hidden, so no need to filter anything out of the + // bundle. + remainingChips = bundle, + ) + } + } + } + + private fun createOutputModel( + old: InternalChipModel, + new: InternalChipModel, + ): OngoingActivityChipModel { + return if (old is InternalChipModel.Shown && new is InternalChipModel.Hidden) { + // If we're transitioning from showing the chip to hiding the chip, different + // chips require different animation behaviors. For example, the screen share + // chips shouldn't animate if the user stopped the screen share from the dialog + // (see b/353249803#comment4), but the call chip should always animate. + // + // This `when` block makes sure that when we're transitioning from Shown to + // Hidden, we check what chip type was previously showing and we use that chip + // type's hide animation behavior. + return when (old.type) { + ChipType.ScreenRecord -> new.screenRecord + ChipType.ShareToApp -> new.shareToApp + ChipType.CastToOtherDevice -> new.castToOtherDevice + ChipType.Call -> new.call + ChipType.DemoRon -> new.demoRon + } + } else if (new is InternalChipModel.Shown) { + // If we have a chip to show, always show it. + new.model + } else { + // In the Hidden -> Hidden transition, it shouldn't matter which hidden model we + // choose because no animation should happen regardless. + OngoingActivityChipModel.Hidden() + } + } companion object { private const val TAG = "ChipsViewModel" @@ -203,5 +346,11 @@ constructor( call = OngoingActivityChipModel.Hidden(), demoRon = OngoingActivityChipModel.Hidden(), ) + + private val DEFAULT_MULTIPLE_INTERNAL_HIDDEN_MODEL = + InternalMultipleOngoingActivityChipsModel( + primary = DEFAULT_INTERNAL_HIDDEN_MODEL, + secondary = DEFAULT_INTERNAL_HIDDEN_MODEL, + ) } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java index 4a0fdeebe82b..659cee3023a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java @@ -55,6 +55,7 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.OperatorNameView; import com.android.systemui.statusbar.OperatorNameViewController; import com.android.systemui.statusbar.StatusBarState; +import com.android.systemui.statusbar.chips.shared.StatusBarRonChips; import com.android.systemui.statusbar.disableflags.DisableFlagsLogger.DisableState; import com.android.systemui.statusbar.events.SystemStatusAnimationCallback; import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler; @@ -122,6 +123,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private LinearLayout mEndSideContent; private View mClockView; private View mPrimaryOngoingActivityChip; + private View mSecondaryOngoingActivityChip; private View mNotificationIconAreaInner; // Visibilities come in from external system callers via disable flags, but we also sometimes // modify the visibilities internally. We need to store both so that we don't accidentally @@ -212,9 +214,16 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private boolean mHomeStatusBarAllowedByScene = true; /** - * True if there's an active ongoing activity that should be showing a chip and false otherwise. + * True if there's a primary active ongoing activity that should be showing a chip and false + * otherwise. */ - private boolean mHasOngoingActivity; + private boolean mHasPrimaryOngoingActivity; + + /** + * True if there's a secondary active ongoing activity that should be showing a chip and false + * otherwise. + */ + private boolean mHasSecondaryOngoingActivity; /** * Listener that updates {@link #mWaitingForWindowStateChangeAfterCameraLaunch} when it receives @@ -355,6 +364,8 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue mEndSideAlphaController = new MultiSourceMinAlphaController(mEndSideContent); mClockView = mStatusBar.findViewById(R.id.clock); mPrimaryOngoingActivityChip = mStatusBar.findViewById(R.id.ongoing_activity_chip_primary); + mSecondaryOngoingActivityChip = + mStatusBar.findViewById(R.id.ongoing_activity_chip_secondary); showEndSideContent(false); showClock(false); initOperatorName(); @@ -508,8 +519,11 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue @Override public void onOngoingActivityStatusChanged( - boolean hasOngoingActivity, boolean shouldAnimate) { - mHasOngoingActivity = hasOngoingActivity; + boolean hasPrimaryOngoingActivity, + boolean hasSecondaryOngoingActivity, + boolean shouldAnimate) { + mHasPrimaryOngoingActivity = hasPrimaryOngoingActivity; + mHasSecondaryOngoingActivity = hasSecondaryOngoingActivity; updateStatusBarVisibilities(shouldAnimate); } @@ -554,7 +568,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue boolean notifsChanged = newModel.getShowNotificationIcons() != previousModel.getShowNotificationIcons(); boolean ongoingActivityChanged = - newModel.getShowOngoingActivityChip() != previousModel.getShowOngoingActivityChip(); + newModel.isOngoingActivityStatusDifferentFrom(previousModel); if (notifsChanged || ongoingActivityChanged) { updateNotificationIconAreaAndOngoingActivityChip(animate); } @@ -597,21 +611,26 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue boolean showClock = externalModel.getShowClock() && !headsUpVisible; - boolean showOngoingActivityChip; + boolean showPrimaryOngoingActivityChip; if (Flags.statusBarScreenSharingChips()) { // If this flag is on, the ongoing activity status comes from - // CollapsedStatusBarViewBinder, which updates the mHasOngoingActivity variable. - showOngoingActivityChip = mHasOngoingActivity; + // CollapsedStatusBarViewBinder, which updates the mHasPrimaryOngoingActivity variable. + showPrimaryOngoingActivityChip = mHasPrimaryOngoingActivity; } else { // If this flag is off, the only ongoing activity is the ongoing call, and we pull it // from the controller directly. - showOngoingActivityChip = mOngoingCallController.hasOngoingCall(); + showPrimaryOngoingActivityChip = mOngoingCallController.hasOngoingCall(); } + boolean showSecondaryOngoingActivityChip = + Flags.statusBarScreenSharingChips() + && StatusBarRonChips.isEnabled() + && mHasSecondaryOngoingActivity; return new StatusBarVisibilityModel( showClock, externalModel.getShowNotificationIcons(), - showOngoingActivityChip && !headsUpVisible, + showPrimaryOngoingActivityChip && !headsUpVisible, + showSecondaryOngoingActivityChip && !headsUpVisible, externalModel.getShowSystemInfo()); } @@ -622,7 +641,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private void updateNotificationIconAreaAndOngoingActivityChip(boolean animate) { StatusBarVisibilityModel visibilityModel = mLastModifiedVisibility; boolean disableNotifications = !visibilityModel.getShowNotificationIcons(); - boolean hasOngoingActivity = visibilityModel.getShowOngoingActivityChip(); + boolean hasOngoingActivity = visibilityModel.getShowPrimaryOngoingActivityChip(); // Hide notifications if the disable flag is set or we have an ongoing activity. if (disableNotifications || hasOngoingActivity) { @@ -634,12 +653,24 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue // Show the ongoing activity chip only if there is an ongoing activity *and* notification // icons are allowed. (The ongoing activity chip occupies the same area as the notification, // icons so if the icons are disabled then the activity chip should be, too.) - boolean showOngoingActivityChip = hasOngoingActivity && !disableNotifications; - if (showOngoingActivityChip) { + boolean showPrimaryOngoingActivityChip = + visibilityModel.getShowPrimaryOngoingActivityChip() && !disableNotifications; + if (showPrimaryOngoingActivityChip) { showPrimaryOngoingActivityChip(animate); } else { hidePrimaryOngoingActivityChip(animate); } + + boolean showSecondaryOngoingActivityChip = + // Secondary chips are only supported when RONs are enabled. + StatusBarRonChips.isEnabled() + && visibilityModel.getShowSecondaryOngoingActivityChip() + && !disableNotifications; + if (showSecondaryOngoingActivityChip) { + showSecondaryOngoingActivityChip(animate); + } else { + hideSecondaryOngoingActivityChip(animate); + } } private boolean shouldHideStatusBar() { @@ -745,6 +776,15 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue animateShow(mPrimaryOngoingActivityChip, animate); } + private void hideSecondaryOngoingActivityChip(boolean animate) { + animateHiddenState(mSecondaryOngoingActivityChip, View.GONE, animate); + } + + private void showSecondaryOngoingActivityChip(boolean animate) { + StatusBarRonChips.assertInNewMode(); + animateShow(mSecondaryOngoingActivityChip, animate); + } + /** * If panel is expanded/expanding it usually means QS shade is opening, so * don't set the clock GONE otherwise it'll mess up the animation. @@ -850,6 +890,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private void initOngoingCallChip() { mOngoingCallController.addCallback(mOngoingCallListener); + // TODO(b/364653005): Do we also need to set the secondary activity chip? mOngoingCallController.setChipView(mPrimaryOngoingActivityChip); } @@ -908,7 +949,8 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue @Override public void dump(PrintWriter printWriter, String[] args) { IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, /* singleIndent= */" "); - pw.println("mHasOngoingActivity=" + mHasOngoingActivity); + pw.println("mHasPrimaryOngoingActivity=" + mHasPrimaryOngoingActivity); + pw.println("mHasSecondaryOngoingActivity=" + mHasSecondaryOngoingActivity); pw.println("mAnimationsEnabled=" + mAnimationsEnabled); StatusBarFragmentComponent component = mStatusBarFragmentComponent; if (component == null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLogger.kt index 0a19023d9e8c..deef88635f27 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLogger.kt @@ -16,16 +16,18 @@ package com.android.systemui.statusbar.phone.fragment -import com.android.systemui.log.dagger.CollapsedSbFragmentLog import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel +import com.android.systemui.log.dagger.CollapsedSbFragmentLog import com.android.systemui.statusbar.disableflags.DisableFlagsLogger import javax.inject.Inject /** Used by [CollapsedStatusBarFragment] to log messages to a [LogBuffer]. */ -class CollapsedStatusBarFragmentLogger @Inject constructor( - @CollapsedSbFragmentLog private val buffer: LogBuffer, - private val disableFlagsLogger: DisableFlagsLogger, +class CollapsedStatusBarFragmentLogger +@Inject +constructor( + @CollapsedSbFragmentLog private val buffer: LogBuffer, + private val disableFlagsLogger: DisableFlagsLogger, ) { /** @@ -38,17 +40,17 @@ class CollapsedStatusBarFragmentLogger @Inject constructor( new: DisableFlagsLogger.DisableState, ) { buffer.log( - TAG, - LogLevel.INFO, - { - int1 = new.disable1 - int2 = new.disable2 - }, - { - disableFlagsLogger.getDisableFlagsString( - DisableFlagsLogger.DisableState(int1, int2), - ) - } + TAG, + LogLevel.INFO, + { + int1 = new.disable1 + int2 = new.disable2 + }, + { + disableFlagsLogger.getDisableFlagsString( + DisableFlagsLogger.DisableState(int1, int2), + ) + } ) } @@ -59,13 +61,16 @@ class CollapsedStatusBarFragmentLogger @Inject constructor( { bool1 = model.showClock bool2 = model.showNotificationIcons - bool3 = model.showOngoingActivityChip + bool3 = model.showPrimaryOngoingActivityChip + int1 = if (model.showSecondaryOngoingActivityChip) 1 else 0 bool4 = model.showSystemInfo }, - { "New visibilities calculated internally. " + + { + "New visibilities calculated internally. " + "showClock=$bool1 " + "showNotificationIcons=$bool2 " + - "showOngoingActivityChip=$bool3 " + + "showPrimaryOngoingActivityChip=$bool3 " + + "showSecondaryOngoingActivityChip=${if (int1 == 1) "true" else "false"}" + "showSystemInfo=$bool4" } ) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModel.kt index 9255e6323d31..e9e9a4ef6625 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModel.kt @@ -26,9 +26,15 @@ import android.app.StatusBarManager.DISABLE_SYSTEM_INFO data class StatusBarVisibilityModel( val showClock: Boolean, val showNotificationIcons: Boolean, - val showOngoingActivityChip: Boolean, + val showPrimaryOngoingActivityChip: Boolean, + val showSecondaryOngoingActivityChip: Boolean, val showSystemInfo: Boolean, ) { + fun isOngoingActivityStatusDifferentFrom(other: StatusBarVisibilityModel): Boolean { + return this.showPrimaryOngoingActivityChip != other.showPrimaryOngoingActivityChip || + this.showSecondaryOngoingActivityChip != other.showSecondaryOngoingActivityChip + } + companion object { /** Creates the default model. */ @JvmStatic @@ -42,7 +48,8 @@ data class StatusBarVisibilityModel( return StatusBarVisibilityModel( showClock = false, showNotificationIcons = false, - showOngoingActivityChip = false, + showPrimaryOngoingActivityChip = false, + showSecondaryOngoingActivityChip = false, showSystemInfo = false, ) } @@ -59,7 +66,8 @@ data class StatusBarVisibilityModel( showNotificationIcons = (disabled1 and DISABLE_NOTIFICATION_ICONS) == 0, // TODO(b/279899176): [CollapsedStatusBarFragment] always overwrites this with the // value of [OngoingCallController]. Do we need to process the flag here? - showOngoingActivityChip = (disabled1 and DISABLE_ONGOING_CALL_CHIP) == 0, + showPrimaryOngoingActivityChip = (disabled1 and DISABLE_ONGOING_CALL_CHIP) == 0, + showSecondaryOngoingActivityChip = (disabled1 and DISABLE_ONGOING_CALL_CHIP) == 0, showSystemInfo = (disabled1 and DISABLE_SYSTEM_INFO) == 0 && (disabled2 and DISABLE2_SYSTEM_ICONS) == 0 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/CollapsedStatusBarViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/CollapsedStatusBarViewBinder.kt index 87d0e6420128..49eabba5c2b0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/CollapsedStatusBarViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/CollapsedStatusBarViewBinder.kt @@ -80,7 +80,7 @@ class CollapsedStatusBarViewBinderImpl @Inject constructor() : CollapsedStatusBa } } - if (Flags.statusBarScreenSharingChips()) { + if (Flags.statusBarScreenSharingChips() && !Flags.statusBarRonChips()) { val primaryChipView: View = view.requireViewById(R.id.ongoing_activity_chip_primary) launch { @@ -89,12 +89,14 @@ class CollapsedStatusBarViewBinderImpl @Inject constructor() : CollapsedStatusBa when (primaryChipModel) { is OngoingActivityChipModel.Shown -> listener.onOngoingActivityStatusChanged( - hasOngoingActivity = true, + hasPrimaryOngoingActivity = true, + hasSecondaryOngoingActivity = false, shouldAnimate = true, ) is OngoingActivityChipModel.Hidden -> listener.onOngoingActivityStatusChanged( - hasOngoingActivity = false, + hasPrimaryOngoingActivity = false, + hasSecondaryOngoingActivity = false, shouldAnimate = primaryChipModel.shouldAnimate, ) } @@ -102,6 +104,29 @@ class CollapsedStatusBarViewBinderImpl @Inject constructor() : CollapsedStatusBa } } + if (Flags.statusBarScreenSharingChips() && Flags.statusBarRonChips()) { + val primaryChipView: View = + view.requireViewById(R.id.ongoing_activity_chip_primary) + val secondaryChipView: View = + view.requireViewById(R.id.ongoing_activity_chip_secondary) + launch { + viewModel.ongoingActivityChips.collect { chips -> + OngoingActivityChipBinder.bind(chips.primary, primaryChipView) + // TODO(b/364653005): Don't show the secondary chip if there isn't + // enough space for it. + OngoingActivityChipBinder.bind(chips.secondary, secondaryChipView) + listener.onOngoingActivityStatusChanged( + hasPrimaryOngoingActivity = + chips.primary is OngoingActivityChipModel.Shown, + hasSecondaryOngoingActivity = + chips.secondary is OngoingActivityChipModel.Shown, + // TODO(b/364653005): Figure out the animation story here. + shouldAnimate = true, + ) + } + } + } + if (SceneContainerFlag.isEnabled) { launch { viewModel.isHomeStatusBarAllowedByScene.collect { @@ -161,7 +186,11 @@ interface StatusBarVisibilityChangeListener { * @param shouldAnimate true if the chip should animate in/out, and false if the chip should * immediately appear/disappear. */ - fun onOngoingActivityStatusChanged(hasOngoingActivity: Boolean, shouldAnimate: Boolean) + fun onOngoingActivityStatusChanged( + hasPrimaryOngoingActivity: Boolean, + hasSecondaryOngoingActivity: Boolean, + shouldAnimate: Boolean, + ) /** * Called when the scene state has changed such that the home status bar is newly allowed or no diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModel.kt index 547423156eb8..9cce2b8fb72b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModel.kt @@ -27,6 +27,7 @@ import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.model.Scenes +import com.android.systemui.statusbar.chips.ui.model.MultipleOngoingActivityChipsModel import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel import com.android.systemui.statusbar.chips.ui.viewmodel.OngoingActivityChipsViewModel import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor @@ -70,6 +71,12 @@ interface CollapsedStatusBarViewModel { */ val primaryOngoingActivityChip: StateFlow + /** + * The multiple ongoing activity chips that should be shown on the left-hand side of the status + * bar. + */ + val ongoingActivityChips: StateFlow + /** * True if the current scene can show the home status bar (aka this status bar), and false if * the current scene should never show the home status bar. @@ -113,6 +120,8 @@ constructor( override val primaryOngoingActivityChip = ongoingActivityChipsViewModel.primaryChip + override val ongoingActivityChips = ongoingActivityChipsViewModel.chips + override val isHomeStatusBarAllowedByScene: StateFlow = combine( sceneInteractor.currentScene, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt index f528ebbd9e63..26ce7b956fde 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt @@ -19,8 +19,9 @@ package com.android.systemui.statusbar.chips.ui.viewmodel import android.content.DialogInterface import android.content.packageManager import android.content.pm.PackageManager +import android.graphics.Bitmap import android.graphics.drawable.BitmapDrawable -import android.platform.test.annotations.EnableFlags +import android.platform.test.annotations.DisableFlags import android.view.View import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest @@ -39,11 +40,9 @@ import com.android.systemui.screenrecord.data.model.ScreenRecordModel import com.android.systemui.screenrecord.data.repository.screenRecordRepository import com.android.systemui.statusbar.chips.mediaprojection.domain.interactor.MediaProjectionChipInteractorTest.Companion.NORMAL_PACKAGE import com.android.systemui.statusbar.chips.mediaprojection.domain.interactor.MediaProjectionChipInteractorTest.Companion.setUpPackageManagerForMediaProjection -import com.android.systemui.statusbar.chips.ron.demo.ui.viewmodel.DemoRonChipViewModelTest.Companion.addDemoRonChip import com.android.systemui.statusbar.chips.ron.demo.ui.viewmodel.demoRonChipViewModel import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel import com.android.systemui.statusbar.chips.ui.view.ChipBackgroundContainer -import com.android.systemui.statusbar.commandline.commandRegistry import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.statusbar.phone.mockSystemUIDialogFactory import com.android.systemui.statusbar.phone.ongoingcall.data.repository.ongoingCallRepository @@ -51,8 +50,6 @@ import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCall import com.android.systemui.statusbar.phone.ongoingcall.shared.model.inCallModel import com.android.systemui.util.time.fakeSystemClock import com.google.common.truth.Truth.assertThat -import java.io.PrintWriter -import java.io.StringWriter import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -69,21 +66,22 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.whenever +/** + * Tests for [OngoingActivityChipsViewModel] when the [FLAG_STATUS_BAR_RON_CHIPS] flag is disabled. + */ @SmallTest @RunWith(AndroidJUnit4::class) @OptIn(ExperimentalCoroutinesApi::class) +@DisableFlags(FLAG_STATUS_BAR_RON_CHIPS) class OngoingActivityChipsViewModelTest : SysuiTestCase() { private val kosmos = Kosmos().also { it.testCase = this } private val testScope = kosmos.testScope private val systemClock = kosmos.fakeSystemClock - private val commandRegistry = kosmos.commandRegistry private val screenRecordState = kosmos.screenRecordRepository.screenRecordState private val mediaProjectionState = kosmos.fakeMediaProjectionRepository.mediaProjectionState private val callRepo = kosmos.ongoingCallRepository - private val pw = PrintWriter(StringWriter()) - private val mockSystemUIDialog = mock() private val chipBackgroundView = mock() private val chipView = @@ -102,8 +100,12 @@ class OngoingActivityChipsViewModelTest : SysuiTestCase() { fun setUp() { setUpPackageManagerForMediaProjection(kosmos) kosmos.demoRonChipViewModel.start() - whenever(kosmos.packageManager.getApplicationIcon(any())) - .thenReturn(BitmapDrawable()) + val icon = + BitmapDrawable( + context.resources, + Bitmap.createBitmap(/* width= */ 100, /* height= */ 100, Bitmap.Config.ARGB_8888) + ) + whenever(kosmos.packageManager.getApplicationIcon(any())).thenReturn(icon) } @Test @@ -183,24 +185,16 @@ class OngoingActivityChipsViewModelTest : SysuiTestCase() { } @Test - @EnableFlags(FLAG_STATUS_BAR_RON_CHIPS) fun primaryChip_higherPriorityChipAdded_lowerPriorityChipReplaced() = testScope.runTest { // Start with just the lowest priority chip shown - addDemoRonChip(commandRegistry, pw) + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) // And everything else hidden - callRepo.setOngoingCallState(OngoingCallModel.NoCall) mediaProjectionState.value = MediaProjectionState.NotProjecting screenRecordState.value = ScreenRecordModel.DoingNothing val latest by collectLastValue(underTest.primaryChip) - assertIsDemoRonChip(latest) - - // WHEN the higher priority call chip is added - callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) - - // THEN the higher priority call chip is used assertIsCallChip(latest) // WHEN the higher priority media projection chip is added @@ -222,7 +216,6 @@ class OngoingActivityChipsViewModelTest : SysuiTestCase() { } @Test - @EnableFlags(FLAG_STATUS_BAR_RON_CHIPS) fun primaryChip_highestPriorityChipRemoved_showsNextPriorityChip() = testScope.runTest { // WHEN all chips are active @@ -230,7 +223,6 @@ class OngoingActivityChipsViewModelTest : SysuiTestCase() { mediaProjectionState.value = MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) - addDemoRonChip(commandRegistry, pw) val latest by collectLastValue(underTest.primaryChip) @@ -248,12 +240,6 @@ class OngoingActivityChipsViewModelTest : SysuiTestCase() { // THEN the lower priority call is used assertIsCallChip(latest) - - // WHEN the higher priority call is removed - callRepo.setOngoingCallState(OngoingCallModel.NoCall) - - // THEN the lower priority demo RON is used - assertIsDemoRonChip(latest) } /** Regression test for b/347726238. */ @@ -390,11 +376,5 @@ class OngoingActivityChipsViewModelTest : SysuiTestCase() { .impl as Icon.Resource assertThat(icon.res).isEqualTo(com.android.internal.R.drawable.ic_phone) } - - fun assertIsDemoRonChip(latest: OngoingActivityChipModel?) { - assertThat(latest).isInstanceOf(OngoingActivityChipModel.Shown::class.java) - assertThat((latest as OngoingActivityChipModel.Shown).icon) - .isInstanceOf(OngoingActivityChipModel.ChipIcon.FullColorAppIcon::class.java) - } } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithRonsViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithRonsViewModelTest.kt new file mode 100644 index 000000000000..631120b39805 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithRonsViewModelTest.kt @@ -0,0 +1,534 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.chips.ui.viewmodel + +import android.content.DialogInterface +import android.content.packageManager +import android.graphics.Bitmap +import android.graphics.drawable.BitmapDrawable +import android.platform.test.annotations.EnableFlags +import android.view.View +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.systemui.Flags.FLAG_STATUS_BAR_RON_CHIPS +import com.android.systemui.SysuiTestCase +import com.android.systemui.coroutines.collectLastValue +import com.android.systemui.kosmos.testScope +import com.android.systemui.mediaprojection.data.model.MediaProjectionState +import com.android.systemui.mediaprojection.data.repository.fakeMediaProjectionRepository +import com.android.systemui.mediaprojection.taskswitcher.FakeActivityTaskManager.Companion.createTask +import com.android.systemui.res.R +import com.android.systemui.screenrecord.data.model.ScreenRecordModel +import com.android.systemui.screenrecord.data.repository.screenRecordRepository +import com.android.systemui.statusbar.chips.mediaprojection.domain.interactor.MediaProjectionChipInteractorTest.Companion.NORMAL_PACKAGE +import com.android.systemui.statusbar.chips.mediaprojection.domain.interactor.MediaProjectionChipInteractorTest.Companion.setUpPackageManagerForMediaProjection +import com.android.systemui.statusbar.chips.ron.demo.ui.viewmodel.DemoRonChipViewModelTest.Companion.addDemoRonChip +import com.android.systemui.statusbar.chips.ron.demo.ui.viewmodel.demoRonChipViewModel +import com.android.systemui.statusbar.chips.ui.model.MultipleOngoingActivityChipsModel +import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel +import com.android.systemui.statusbar.chips.ui.view.ChipBackgroundContainer +import com.android.systemui.statusbar.chips.ui.viewmodel.OngoingActivityChipsViewModelTest.Companion.assertIsCallChip +import com.android.systemui.statusbar.chips.ui.viewmodel.OngoingActivityChipsViewModelTest.Companion.assertIsScreenRecordChip +import com.android.systemui.statusbar.chips.ui.viewmodel.OngoingActivityChipsViewModelTest.Companion.assertIsShareToAppChip +import com.android.systemui.statusbar.chips.ui.viewmodel.OngoingActivityChipsViewModelTest.Companion.getStopActionFromDialog +import com.android.systemui.statusbar.commandline.commandRegistry +import com.android.systemui.statusbar.phone.SystemUIDialog +import com.android.systemui.statusbar.phone.ongoingcall.data.repository.ongoingCallRepository +import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel +import com.android.systemui.statusbar.phone.ongoingcall.shared.model.inCallModel +import com.android.systemui.testKosmos +import com.android.systemui.util.time.fakeSystemClock +import com.google.common.truth.Truth.assertThat +import java.io.PrintWriter +import java.io.StringWriter +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.test.runCurrent +import kotlinx.coroutines.test.runTest +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.kotlin.any +import org.mockito.kotlin.mock +import org.mockito.kotlin.whenever + +/** + * Tests for [OngoingActivityChipsViewModel] when the [FLAG_STATUS_BAR_RON_CHIPS] flag is enabled. + */ +@SmallTest +@RunWith(AndroidJUnit4::class) +@OptIn(ExperimentalCoroutinesApi::class) +@EnableFlags(FLAG_STATUS_BAR_RON_CHIPS) +class OngoingActivityChipsWithRonsViewModelTest : SysuiTestCase() { + private val kosmos = testKosmos() + private val testScope = kosmos.testScope + private val systemClock = kosmos.fakeSystemClock + private val commandRegistry = kosmos.commandRegistry + + private val screenRecordState = kosmos.screenRecordRepository.screenRecordState + private val mediaProjectionState = kosmos.fakeMediaProjectionRepository.mediaProjectionState + private val callRepo = kosmos.ongoingCallRepository + + private val pw = PrintWriter(StringWriter()) + + private val mockSystemUIDialog = mock() + private val chipBackgroundView = mock() + private val chipView = + mock().apply { + whenever( + this.requireViewById( + R.id.ongoing_activity_chip_background + ) + ) + .thenReturn(chipBackgroundView) + } + + private val underTest = kosmos.ongoingActivityChipsViewModel + + @Before + fun setUp() { + setUpPackageManagerForMediaProjection(kosmos) + kosmos.demoRonChipViewModel.start() + val icon = + BitmapDrawable( + context.resources, + Bitmap.createBitmap(/* width= */ 100, /* height= */ 100, Bitmap.Config.ARGB_8888) + ) + whenever(kosmos.packageManager.getApplicationIcon(any())).thenReturn(icon) + } + + // Even though the `primaryChip` flow isn't used when the RONs flag is on, still test that the + // flow has the right behavior to verify that we don't break any existing functionality. + + @Test + fun primaryChip_allHidden_hidden() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.DoingNothing + mediaProjectionState.value = MediaProjectionState.NotProjecting + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + val latest by collectLastValue(underTest.primaryChip) + + assertThat(latest).isInstanceOf(OngoingActivityChipModel.Hidden::class.java) + } + + @Test + fun chips_allHidden_bothPrimaryAndSecondaryHidden() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.DoingNothing + mediaProjectionState.value = MediaProjectionState.NotProjecting + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + val latest by collectLastValue(underTest.chips) + + assertThat(latest!!.primary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java) + assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java) + } + + @Test + fun primaryChip_screenRecordShow_restHidden_screenRecordShown() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.Recording + mediaProjectionState.value = MediaProjectionState.NotProjecting + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + val latest by collectLastValue(underTest.primaryChip) + + assertIsScreenRecordChip(latest) + } + + @Test + fun chips_screenRecordShow_restHidden_primaryIsScreenRecordSecondaryIsHidden() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.Recording + mediaProjectionState.value = MediaProjectionState.NotProjecting + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + val latest by collectLastValue(underTest.chips) + + assertIsScreenRecordChip(latest!!.primary) + assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java) + } + + @Test + fun primaryChip_screenRecordShowAndCallShow_screenRecordShown() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.Recording + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + + val latest by collectLastValue(underTest.primaryChip) + + assertIsScreenRecordChip(latest) + } + + @Test + fun chips_screenRecordShowAndCallShow_primaryIsScreenRecordSecondaryIsCall() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.Recording + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + + val latest by collectLastValue(underTest.chips) + + assertIsScreenRecordChip(latest!!.primary) + assertIsCallChip(latest!!.secondary) + } + + @Test + fun primaryChip_screenRecordShowAndShareToAppShow_screenRecordShown() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.Recording + mediaProjectionState.value = + MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + val latest by collectLastValue(underTest.primaryChip) + + assertIsScreenRecordChip(latest) + } + + @Test + fun chips_screenRecordShowAndShareToAppShow_primaryIsScreenRecordSecondaryIsHidden() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.Recording + mediaProjectionState.value = + MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + val latest by collectLastValue(underTest.chips) + + assertIsScreenRecordChip(latest!!.primary) + // Even though share-to-app is active, we suppress it because this share-to-app is + // represented by screen record being active. See b/296461748. + assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java) + } + + @Test + fun primaryChip_shareToAppShowAndCallShow_shareToAppShown() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.DoingNothing + mediaProjectionState.value = + MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + + val latest by collectLastValue(underTest.primaryChip) + + assertIsShareToAppChip(latest) + } + + @Test + fun chips_shareToAppShowAndCallShow_primaryIsShareToAppSecondaryIsCall() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.DoingNothing + mediaProjectionState.value = + MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + + val latest by collectLastValue(underTest.chips) + + assertIsShareToAppChip(latest!!.primary) + assertIsCallChip(latest!!.secondary) + } + + @Test + fun chips_threeActiveChips_topTwoShown() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.Recording + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + addDemoRonChip(commandRegistry, pw) + + val latest by collectLastValue(underTest.chips) + + assertIsScreenRecordChip(latest!!.primary) + assertIsCallChip(latest!!.secondary) + // Demo RON chip is dropped + } + + @Test + fun primaryChip_onlyCallShown_callShown() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.DoingNothing + // MediaProjection covers both share-to-app and cast-to-other-device + mediaProjectionState.value = MediaProjectionState.NotProjecting + + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + + val latest by collectLastValue(underTest.primaryChip) + + assertIsCallChip(latest) + } + + @Test + fun chips_onlyCallShown_primaryIsCallSecondaryIsHidden() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.DoingNothing + // MediaProjection covers both share-to-app and cast-to-other-device + mediaProjectionState.value = MediaProjectionState.NotProjecting + + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + + val latest by collectLastValue(underTest.chips) + + assertIsCallChip(latest!!.primary) + assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java) + } + + @Test + fun primaryChip_higherPriorityChipAdded_lowerPriorityChipReplaced() = + testScope.runTest { + // Start with just the lowest priority chip shown + addDemoRonChip(commandRegistry, pw) + // And everything else hidden + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + mediaProjectionState.value = MediaProjectionState.NotProjecting + screenRecordState.value = ScreenRecordModel.DoingNothing + + val latest by collectLastValue(underTest.primaryChip) + + assertIsDemoRonChip(latest) + + // WHEN the higher priority call chip is added + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + + // THEN the higher priority call chip is used + assertIsCallChip(latest) + + // WHEN the higher priority media projection chip is added + mediaProjectionState.value = + MediaProjectionState.Projecting.SingleTask( + NORMAL_PACKAGE, + hostDeviceName = null, + createTask(taskId = 1), + ) + + // THEN the higher priority media projection chip is used + assertIsShareToAppChip(latest) + + // WHEN the higher priority screen record chip is added + screenRecordState.value = ScreenRecordModel.Recording + + // THEN the higher priority screen record chip is used + assertIsScreenRecordChip(latest) + } + + @Test + fun primaryChip_highestPriorityChipRemoved_showsNextPriorityChip() = + testScope.runTest { + // WHEN all chips are active + screenRecordState.value = ScreenRecordModel.Recording + mediaProjectionState.value = + MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + addDemoRonChip(commandRegistry, pw) + + val latest by collectLastValue(underTest.primaryChip) + + // THEN the highest priority screen record is used + assertIsScreenRecordChip(latest) + + // WHEN the higher priority screen record is removed + screenRecordState.value = ScreenRecordModel.DoingNothing + + // THEN the lower priority media projection is used + assertIsShareToAppChip(latest) + + // WHEN the higher priority media projection is removed + mediaProjectionState.value = MediaProjectionState.NotProjecting + + // THEN the lower priority call is used + assertIsCallChip(latest) + + // WHEN the higher priority call is removed + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + // THEN the lower priority demo RON is used + assertIsDemoRonChip(latest) + } + + @Test + fun chips_movesChipsAroundAccordingToPriority() = + testScope.runTest { + // Start with just the lowest priority chip shown + addDemoRonChip(commandRegistry, pw) + // And everything else hidden + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + mediaProjectionState.value = MediaProjectionState.NotProjecting + screenRecordState.value = ScreenRecordModel.DoingNothing + + val latest by collectLastValue(underTest.chips) + + assertIsDemoRonChip(latest!!.primary) + assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java) + + // WHEN the higher priority call chip is added + callRepo.setOngoingCallState(inCallModel(startTimeMs = 34)) + + // THEN the higher priority call chip is used as primary and demo ron is demoted to + // secondary + assertIsCallChip(latest!!.primary) + assertIsDemoRonChip(latest!!.secondary) + + // WHEN the higher priority media projection chip is added + mediaProjectionState.value = + MediaProjectionState.Projecting.SingleTask( + NORMAL_PACKAGE, + hostDeviceName = null, + createTask(taskId = 1), + ) + + // THEN the higher priority media projection chip is used as primary and call is demoted + // to secondary (and demo RON is dropped altogether) + assertIsShareToAppChip(latest!!.primary) + assertIsCallChip(latest!!.secondary) + + // WHEN the higher priority screen record chip is added + screenRecordState.value = ScreenRecordModel.Recording + + // THEN the higher priority screen record chip is used + assertIsScreenRecordChip(latest!!.primary) + + // WHEN screen record and call is dropped + screenRecordState.value = ScreenRecordModel.DoingNothing + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + // THEN media projection and demo RON remain + assertIsShareToAppChip(latest!!.primary) + assertIsDemoRonChip(latest!!.secondary) + + // WHEN media projection is dropped + mediaProjectionState.value = MediaProjectionState.NotProjecting + + // THEN demo RON is promoted to primary + assertIsDemoRonChip(latest!!.primary) + assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java) + } + + /** Regression test for b/347726238. */ + @Test + fun primaryChip_timerDoesNotResetAfterSubscribersRestart() = + testScope.runTest { + var latest: OngoingActivityChipModel? = null + + val job1 = underTest.primaryChip.onEach { latest = it }.launchIn(this) + + // Start a chip with a timer + systemClock.setElapsedRealtime(1234) + screenRecordState.value = ScreenRecordModel.Recording + + runCurrent() + + assertThat((latest as OngoingActivityChipModel.Shown.Timer).startTimeMs).isEqualTo(1234) + + // Stop subscribing to the chip flow + job1.cancel() + + // Let time pass + systemClock.setElapsedRealtime(5678) + + // WHEN we re-subscribe to the chip flow + val job2 = underTest.primaryChip.onEach { latest = it }.launchIn(this) + + runCurrent() + + // THEN the old start time is still used + assertThat((latest as OngoingActivityChipModel.Shown.Timer).startTimeMs).isEqualTo(1234) + + job2.cancel() + } + + /** Regression test for b/347726238. */ + @Test + fun chips_timerDoesNotResetAfterSubscribersRestart() = + testScope.runTest { + var latest: MultipleOngoingActivityChipsModel? = null + + val job1 = underTest.chips.onEach { latest = it }.launchIn(this) + + // Start a chip with a timer + systemClock.setElapsedRealtime(1234) + screenRecordState.value = ScreenRecordModel.Recording + + runCurrent() + + val primaryChip = latest!!.primary as OngoingActivityChipModel.Shown.Timer + assertThat(primaryChip.startTimeMs).isEqualTo(1234) + + // Stop subscribing to the chip flow + job1.cancel() + + // Let time pass + systemClock.setElapsedRealtime(5678) + + // WHEN we re-subscribe to the chip flow + val job2 = underTest.chips.onEach { latest = it }.launchIn(this) + + runCurrent() + + // THEN the old start time is still used + val newPrimaryChip = latest!!.primary as OngoingActivityChipModel.Shown.Timer + assertThat(newPrimaryChip.startTimeMs).isEqualTo(1234) + + job2.cancel() + } + + @Test + fun primaryChip_screenRecordStoppedViaDialog_chipHiddenWithoutAnimation() = + testScope.runTest { + screenRecordState.value = ScreenRecordModel.Recording + mediaProjectionState.value = MediaProjectionState.NotProjecting + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + val latest by collectLastValue(underTest.primaryChip) + + assertIsScreenRecordChip(latest) + + // WHEN screen record gets stopped via dialog + val dialogStopAction = + getStopActionFromDialog(latest, chipView, mockSystemUIDialog, kosmos) + dialogStopAction.onClick(mock(), 0) + + // THEN the chip is immediately hidden with no animation + assertThat(latest).isEqualTo(OngoingActivityChipModel.Hidden(shouldAnimate = false)) + } + + @Test + fun primaryChip_projectionStoppedViaDialog_chipHiddenWithoutAnimation() = + testScope.runTest { + mediaProjectionState.value = + MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) + screenRecordState.value = ScreenRecordModel.DoingNothing + callRepo.setOngoingCallState(OngoingCallModel.NoCall) + + val latest by collectLastValue(underTest.primaryChip) + + assertIsShareToAppChip(latest) + + // WHEN media projection gets stopped via dialog + val dialogStopAction = + getStopActionFromDialog(latest, chipView, mockSystemUIDialog, kosmos) + dialogStopAction.onClick(mock(), 0) + + // THEN the chip is immediately hidden with no animation + assertThat(latest).isEqualTo(OngoingActivityChipModel.Hidden(shouldAnimate = false)) + } + + private fun assertIsDemoRonChip(latest: OngoingActivityChipModel?) { + assertThat(latest).isInstanceOf(OngoingActivityChipModel.Shown::class.java) + assertThat((latest as OngoingActivityChipModel.Shown).icon) + .isInstanceOf(OngoingActivityChipModel.ChipIcon.FullColorAppIcon::class.java) + } +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt index 219b16f1e0ef..d7fb12944965 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt @@ -34,12 +34,13 @@ import org.mockito.Mockito.mock @RunWith(AndroidJUnit4::class) class CollapsedStatusBarFragmentLoggerTest : SysuiTestCase() { - private val buffer = LogBufferFactory(DumpManager(), mock(LogcatEchoTracker::class.java)) - .create("buffer", 10) - private val disableFlagsLogger = DisableFlagsLogger( + private val buffer = + LogBufferFactory(DumpManager(), mock(LogcatEchoTracker::class.java)).create("buffer", 10) + private val disableFlagsLogger = + DisableFlagsLogger( listOf(DisableFlagsLogger.DisableFlag(0b001, 'A', 'a')), listOf(DisableFlagsLogger.DisableFlag(0b001, 'B', 'b')) - ) + ) private val logger = CollapsedStatusBarFragmentLogger(buffer, disableFlagsLogger) @Test @@ -66,7 +67,8 @@ class CollapsedStatusBarFragmentLoggerTest : SysuiTestCase() { StatusBarVisibilityModel( showClock = false, showNotificationIcons = true, - showOngoingActivityChip = false, + showPrimaryOngoingActivityChip = false, + showSecondaryOngoingActivityChip = false, showSystemInfo = true, ) ) @@ -77,7 +79,8 @@ class CollapsedStatusBarFragmentLoggerTest : SysuiTestCase() { assertThat(actualString).contains("showClock=false") assertThat(actualString).contains("showNotificationIcons=true") - assertThat(actualString).contains("showOngoingActivityChip=false") + assertThat(actualString).contains("showPrimaryOngoingActivityChip=false") + assertThat(actualString).contains("showSecondaryOngoingActivityChip=false") assertThat(actualString).contains("showSystemInfo=true") } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java index 6e337efd68af..135fab877d57 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.phone.fragment; import static android.view.Display.DEFAULT_DISPLAY; +import static com.android.systemui.Flags.FLAG_STATUS_BAR_RON_CHIPS; import static com.android.systemui.Flags.FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS; import static com.android.systemui.shade.ShadeExpansionStateManagerKt.STATE_CLOSED; import static com.android.systemui.shade.ShadeExpansionStateManagerKt.STATE_OPEN; @@ -526,7 +527,9 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { // WHEN there's *no* ongoing activity via new callback mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ false, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ false, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); // THEN the old callback value is used, so the view is shown assertEquals(View.VISIBLE, getPrimaryOngoingActivityChipView().getVisibility()); @@ -535,12 +538,15 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { when(mOngoingCallController.hasOngoingCall()).thenReturn(false); fragment.disable(DEFAULT_DISPLAY, 0, 0, false); - // WHEN there *is* an ongoing activity via new callback + // WHEN there *are* ongoing activities via new callback mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ true, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ true, + /* shouldAnimate= */ false); - // THEN the old callback value is used, so the view is hidden + // THEN the old callback value is used, so the views are hidden assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); + assertEquals(View.GONE, getSecondaryOngoingActivityChipView().getVisibility()); } @Test @@ -553,18 +559,22 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { // listener, but I'm unable to get the fragment to get attached so that the binder starts // listening to flows. mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ false, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ false, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); } @Test @EnableFlags(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS) - public void hasOngoingActivity_chipDisplayedAndNotificationIconsHidden() { + public void hasPrimaryOngoingActivity_primaryChipDisplayedAndNotificationIconsHidden() { resumeAndGetFragment(); mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ true, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); assertEquals(View.VISIBLE, getPrimaryOngoingActivityChipView().getVisibility()); assertEquals(View.INVISIBLE, getNotificationAreaView().getVisibility()); @@ -572,11 +582,42 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { @Test @EnableFlags(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS) - public void hasOngoingActivityButNotificationIconsDisabled_chipHidden() { + @DisableFlags(FLAG_STATUS_BAR_RON_CHIPS) + public void hasSecondaryOngoingActivity_butRonsFlagOff_secondaryChipHidden() { + resumeAndGetFragment(); + + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ true, + /* shouldAnimate= */ false); + + assertEquals(View.GONE, getSecondaryOngoingActivityChipView().getVisibility()); + } + + @Test + @EnableFlags({FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, FLAG_STATUS_BAR_RON_CHIPS}) + public void hasSecondaryOngoingActivity_flagOn_secondaryChipShownAndNotificationIconsHidden() { + resumeAndGetFragment(); + + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ true, + /* shouldAnimate= */ false); + + assertEquals(View.VISIBLE, getSecondaryOngoingActivityChipView().getVisibility()); + assertEquals(View.INVISIBLE, getNotificationAreaView().getVisibility()); + } + + @Test + @EnableFlags(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS) + @DisableFlags(FLAG_STATUS_BAR_RON_CHIPS) + public void hasOngoingActivityButNotificationIconsDisabled_chipHidden_ronsFlagOff() { CollapsedStatusBarFragment fragment = resumeAndGetFragment(); mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ true, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); fragment.disable(DEFAULT_DISPLAY, StatusBarManager.DISABLE_NOTIFICATION_ICONS, 0, false); @@ -584,13 +625,33 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); } + @Test + @EnableFlags({FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, FLAG_STATUS_BAR_RON_CHIPS}) + public void hasOngoingActivitiesButNotificationIconsDisabled_chipsHidden_ronsFlagOn() { + CollapsedStatusBarFragment fragment = resumeAndGetFragment(); + + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ true, + /* shouldAnimate= */ false); + + fragment.disable(DEFAULT_DISPLAY, + StatusBarManager.DISABLE_NOTIFICATION_ICONS, 0, false); + + assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); + assertEquals(View.GONE, getSecondaryOngoingActivityChipView().getVisibility()); + } + @Test @EnableFlags(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS) - public void hasOngoingActivityButAlsoHun_chipHidden() { + @DisableFlags(FLAG_STATUS_BAR_RON_CHIPS) + public void hasOngoingActivityButAlsoHun_chipHidden_ronsFlagOff() { CollapsedStatusBarFragment fragment = resumeAndGetFragment(); mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ true, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); when(mHeadsUpAppearanceController.shouldBeVisible()).thenReturn(true); fragment.disable(DEFAULT_DISPLAY, 0, 0, false); @@ -598,34 +659,121 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); } + @Test + @EnableFlags({FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, FLAG_STATUS_BAR_RON_CHIPS}) + public void hasOngoingActivitiesButAlsoHun_chipsHidden_ronsFlagOn() { + CollapsedStatusBarFragment fragment = resumeAndGetFragment(); + + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ true, + /* shouldAnimate= */ false); + when(mHeadsUpAppearanceController.shouldBeVisible()).thenReturn(true); + + fragment.disable(DEFAULT_DISPLAY, 0, 0, false); + + assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); + assertEquals(View.GONE, getSecondaryOngoingActivityChipView().getVisibility()); + } + @Test @EnableFlags(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS) - public void ongoingActivityEnded_chipHidden() { + @DisableFlags(FLAG_STATUS_BAR_RON_CHIPS) + public void primaryOngoingActivityEnded_chipHidden_ronsFlagOff() { + resumeAndGetFragment(); + + // Ongoing activity started + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); + + assertEquals(View.VISIBLE, getPrimaryOngoingActivityChipView().getVisibility()); + + // Ongoing activity ended + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ false, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); + + assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); + } + + @Test + @EnableFlags({FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, FLAG_STATUS_BAR_RON_CHIPS}) + public void primaryOngoingActivityEnded_chipHidden_ronsFlagOn() { resumeAndGetFragment(); // Ongoing activity started mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ true, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); assertEquals(View.VISIBLE, getPrimaryOngoingActivityChipView().getVisibility()); // Ongoing activity ended mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ false, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ false, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); } + @Test + @EnableFlags({FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, FLAG_STATUS_BAR_RON_CHIPS}) + public void secondaryOngoingActivityEnded_chipHidden() { + resumeAndGetFragment(); + + // Secondary ongoing activity started + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ true, + /* shouldAnimate= */ false); + + assertEquals(View.VISIBLE, getSecondaryOngoingActivityChipView().getVisibility()); + + // Ongoing activity ended + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); + + assertEquals(View.GONE, getSecondaryOngoingActivityChipView().getVisibility()); + } + @Test @EnableFlags(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS) - public void hasOngoingActivity_hidesNotifsWithoutAnimation() { + @DisableFlags(FLAG_STATUS_BAR_RON_CHIPS) + public void hasOngoingActivity_hidesNotifsWithoutAnimation_ronsFlagOff() { CollapsedStatusBarFragment fragment = resumeAndGetFragment(); // Enable animations for testing so that we can verify we still aren't animating fragment.enableAnimationsForTesting(); - // Ongoing call started + // Ongoing activity started mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ true, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); + + // Notification area is hidden without delay + assertEquals(0f, getNotificationAreaView().getAlpha(), 0.01); + assertEquals(View.INVISIBLE, getNotificationAreaView().getVisibility()); + } + + @Test + @EnableFlags({FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, FLAG_STATUS_BAR_RON_CHIPS}) + public void hasOngoingActivity_hidesNotifsWithoutAnimation_ronsFlagOn() { + CollapsedStatusBarFragment fragment = resumeAndGetFragment(); + // Enable animations for testing so that we can verify we still aren't animating + fragment.enableAnimationsForTesting(); + + // Ongoing activity started + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); // Notification area is hidden without delay assertEquals(0f, getNotificationAreaView().getAlpha(), 0.01); @@ -634,7 +782,8 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { @Test @EnableFlags(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS) - public void screenSharingChipsEnabled_ignoresOngoingCallController() { + @DisableFlags(FLAG_STATUS_BAR_RON_CHIPS) + public void screenSharingChipsEnabled_ignoresOngoingCallController_ronsFlagOff() { CollapsedStatusBarFragment fragment = resumeAndGetFragment(); // WHEN there *is* an ongoing call via old callback @@ -643,7 +792,9 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { // WHEN there's *no* ongoing activity via new callback mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ false, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ false, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); // THEN the new callback value is used, so the view is hidden assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); @@ -652,14 +803,49 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { when(mOngoingCallController.hasOngoingCall()).thenReturn(false); fragment.disable(DEFAULT_DISPLAY, 0, 0, false); - // WHEN there *is* an ongoing activity via new callback + // WHEN there *are* ongoing activities via new callback mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( - /* hasOngoingActivity= */ true, /* shouldAnimate= */ false); + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); - // THEN the new callback value is used, so the view is shown + // THEN the new callback value is used, so the views are shown assertEquals(View.VISIBLE, getPrimaryOngoingActivityChipView().getVisibility()); } + @Test + @EnableFlags({FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, FLAG_STATUS_BAR_RON_CHIPS}) + public void screenSharingChipsEnabled_ignoresOngoingCallController_ronsFlagOn() { + CollapsedStatusBarFragment fragment = resumeAndGetFragment(); + + // WHEN there *is* an ongoing call via old callback + when(mOngoingCallController.hasOngoingCall()).thenReturn(true); + fragment.disable(DEFAULT_DISPLAY, 0, 0, true); + + // WHEN there's *no* ongoing activity via new callback + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ false, + /* hasSecondaryOngoingActivity= */ false, + /* shouldAnimate= */ false); + + // THEN the new callback value is used, so the view is hidden + assertEquals(View.GONE, getPrimaryOngoingActivityChipView().getVisibility()); + + // WHEN there's *no* ongoing call via old callback + when(mOngoingCallController.hasOngoingCall()).thenReturn(false); + fragment.disable(DEFAULT_DISPLAY, 0, 0, false); + + // WHEN there *are* ongoing activities via new callback + mCollapsedStatusBarViewBinder.getListener().onOngoingActivityStatusChanged( + /* hasPrimaryOngoingActivity= */ true, + /* hasSecondaryOngoingActivity= */ true, + /* shouldAnimate= */ false); + + // THEN the new callback value is used, so the views are shown + assertEquals(View.VISIBLE, getPrimaryOngoingActivityChipView().getVisibility()); + assertEquals(View.VISIBLE, getSecondaryOngoingActivityChipView().getVisibility()); + } + @Test @EnableSceneContainer public void isHomeStatusBarAllowedByScene_false_everythingHidden() { @@ -1010,4 +1196,8 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { private View getPrimaryOngoingActivityChipView() { return mFragment.getView().findViewById(R.id.ongoing_activity_chip_primary); } + + private View getSecondaryOngoingActivityChipView() { + return mFragment.getView().findViewById(R.id.ongoing_activity_chip_secondary); + } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt index 9f6f51a28764..d47a90364a43 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt @@ -39,7 +39,8 @@ class StatusBarVisibilityModelTest : SysuiTestCase() { StatusBarVisibilityModel( showClock = true, showNotificationIcons = true, - showOngoingActivityChip = true, + showPrimaryOngoingActivityChip = true, + showSecondaryOngoingActivityChip = true, showSystemInfo = true, ) @@ -75,17 +76,19 @@ class StatusBarVisibilityModelTest : SysuiTestCase() { } @Test - fun createModelFromFlags_ongoingCallChipNotDisabled_showOngoingActivityChipTrue() { + fun createModelFromFlags_ongoingCallChipNotDisabled_showOngoingActivityChipsTrue() { val result = createModelFromFlags(disabled1 = 0, disabled2 = 0) - assertThat(result.showOngoingActivityChip).isTrue() + assertThat(result.showPrimaryOngoingActivityChip).isTrue() + assertThat(result.showSecondaryOngoingActivityChip).isTrue() } @Test - fun createModelFromFlags_ongoingCallChipDisabled_showOngoingActivityChipFalse() { + fun createModelFromFlags_ongoingCallChipDisabled_showOngoingActivityChipsFalse() { val result = createModelFromFlags(disabled1 = DISABLE_ONGOING_CALL_CHIP, disabled2 = 0) - assertThat(result.showOngoingActivityChip).isFalse() + assertThat(result.showPrimaryOngoingActivityChip).isFalse() + assertThat(result.showSecondaryOngoingActivityChip).isFalse() } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewModel.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewModel.kt index e71f5217095c..4834d367d4be 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewModel.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewModel.kt @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.pipeline.shared.ui.viewmodel +import com.android.systemui.statusbar.chips.ui.model.MultipleOngoingActivityChipsModel import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow @@ -31,6 +32,8 @@ class FakeCollapsedStatusBarViewModel : CollapsedStatusBarViewModel { override val primaryOngoingActivityChip: MutableStateFlow = MutableStateFlow(OngoingActivityChipModel.Hidden()) + override val ongoingActivityChips = MutableStateFlow(MultipleOngoingActivityChipsModel()) + override val isHomeStatusBarAllowedByScene = MutableStateFlow(false) override fun areNotificationsLightsOut(displayId: Int): Flow = areNotificationLightsOut -- GitLab From 79e3576e2d345f56637856d28f47053fcdf88f4b Mon Sep 17 00:00:00 2001 From: Alejandro Nijamkin Date: Fri, 6 Sep 2024 10:40:00 -0700 Subject: [PATCH 131/492] [flexiglass] Extracts shadeMode from ShadeInteractor Creates a smaller ShadeModeInteractor and extract the shadeMode and isShadeLayoutWide to it then makes ShadeInteractor depend on it and implement the extracted interface by delegation. The CL also makes the two SceneResolver implementations that depended on ShadeInteractor just for shadeMode use ShadeModeInteractor instead. The second part is what breaks a runtime dependency cycle that was making the CustomizationProvider content provider fail to be injected with dependencies, leading to the attached bugs. Fix: 361328659 Fix: 361382372 Test: unit tests extracted to new file/class Test: manually verified that the lockscreen shortcuts and lockscreen preview features in Wallpaper Picker work as intended Test: manually verified that the exceptions in the AppComponentFactory logcat tag are gone (were visible when starting sysui and when opening wallpaper picker) Flag: com.android.systemui.scene_container Change-Id: Ic1218557867828ccacdb93384ef34d380acc3cb9 --- .../interactor/ShadeInteractorImplTest.kt | 126 ++---------------- .../interactor/ShadeModeInteractorImplTest.kt | 109 +++++++++++++++ .../interactor/KeyguardBlueprintInteractor.kt | 5 +- .../resolver/NotifShadeSceneFamilyResolver.kt | 14 +- .../QuickSettingsSceneFamilyResolver.kt | 14 +- .../systemui/shade/ShadeEmptyImplModule.kt | 6 + .../com/android/systemui/shade/ShadeModule.kt | 18 ++- .../domain/interactor/ShadeInteractor.kt | 2 +- .../domain/interactor/ShadeInteractorImpl.kt | 40 +----- .../domain/interactor/ShadeModeInteractor.kt | 113 ++++++++++++++++ ...tificationPanelViewControllerBaseTest.java | 5 +- .../QuickSettingsControllerImplBaseTest.java | 5 +- .../systemui/kosmos/KosmosJavaAdapter.kt | 2 + .../domain/resolver/SceneResolverKosmos.kt | 6 +- .../interactor/ShadeInteractorKosmos.kt | 4 +- .../interactor/ShadeModeInteractorKosmos.kt | 29 ++++ 16 files changed, 310 insertions(+), 188 deletions(-) create mode 100644 packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt create mode 100644 packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt create mode 100644 packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorKosmos.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt index 9464c75eeb71..d163abf66b05 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt @@ -19,8 +19,6 @@ package com.android.systemui.shade.domain.interactor import android.app.StatusBarManager.DISABLE2_NONE import android.app.StatusBarManager.DISABLE2_NOTIFICATION_SHADE import android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS -import android.platform.test.annotations.DisableFlags -import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase @@ -38,11 +36,7 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.power.data.repository.fakePowerRepository import com.android.systemui.power.shared.model.WakeSleepReason import com.android.systemui.power.shared.model.WakefulnessState -import com.android.systemui.shade.data.repository.fakeShadeRepository -import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.shade.shadeTestUtil -import com.android.systemui.shade.shared.flag.DualShade -import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.statusbar.disableflags.data.model.DisableFlagsModel import com.android.systemui.statusbar.disableflags.data.repository.fakeDisableFlagsRepository import com.android.systemui.statusbar.phone.dozeParameters @@ -73,7 +67,6 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { private val keyguardRepository by lazy { kosmos.fakeKeyguardRepository } private val keyguardTransitionRepository by lazy { kosmos.fakeKeyguardTransitionRepository } private val powerRepository by lazy { kosmos.fakePowerRepository } - private val shadeRepository by lazy { kosmos.fakeShadeRepository } private val shadeTestUtil by lazy { kosmos.shadeTestUtil } private val userRepository by lazy { kosmos.fakeUserRepository } private val userSetupRepository by lazy { kosmos.fakeUserSetupRepository } @@ -142,9 +135,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { userSetupRepository.setUserSetUp(true) disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_NOTIFICATION_SHADE, - ) + DisableFlagsModel(disable2 = DISABLE2_NOTIFICATION_SHADE) val actual by collectLastValue(underTest.isExpandToQsEnabled) @@ -158,9 +149,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { userSetupRepository.setUserSetUp(true) disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_QUICK_SETTINGS, - ) + DisableFlagsModel(disable2 = DISABLE2_QUICK_SETTINGS) val actual by collectLastValue(underTest.isExpandToQsEnabled) assertThat(actual).isFalse() @@ -171,10 +160,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { testScope.runTest { deviceProvisioningRepository.setDeviceProvisioned(true) userSetupRepository.setUserSetUp(true) - disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_NONE, - ) + disableFlagsRepository.disableFlags.value = DisableFlagsModel(disable2 = DISABLE2_NONE) keyguardRepository.setIsDozing(true) @@ -188,10 +174,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { testScope.runTest { deviceProvisioningRepository.setDeviceProvisioned(true) keyguardRepository.setIsDozing(false) - disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_NONE, - ) + disableFlagsRepository.disableFlags.value = DisableFlagsModel(disable2 = DISABLE2_NONE) userSetupRepository.setUserSetUp(true) @@ -205,10 +188,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { testScope.runTest { deviceProvisioningRepository.setDeviceProvisioned(true) keyguardRepository.setIsDozing(false) - disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_NONE, - ) + disableFlagsRepository.disableFlags.value = DisableFlagsModel(disable2 = DISABLE2_NONE) userRepository.setSettings(UserSwitcherSettingsModel(isSimpleUserSwitcher = false)) @@ -222,10 +202,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { testScope.runTest { deviceProvisioningRepository.setDeviceProvisioned(true) keyguardRepository.setIsDozing(false) - disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_NONE, - ) + disableFlagsRepository.disableFlags.value = DisableFlagsModel(disable2 = DISABLE2_NONE) userSetupRepository.setUserSetUp(true) val actual by collectLastValue(underTest.isExpandToQsEnabled) @@ -250,10 +227,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { testScope.runTest { deviceProvisioningRepository.setDeviceProvisioned(true) keyguardRepository.setIsDozing(false) - disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_NONE, - ) + disableFlagsRepository.disableFlags.value = DisableFlagsModel(disable2 = DISABLE2_NONE) userSetupRepository.setUserSetUp(true) val actual by collectLastValue(underTest.isExpandToQsEnabled) @@ -262,17 +236,12 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { // WHEN QS is disabled disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_QUICK_SETTINGS, - ) + DisableFlagsModel(disable2 = DISABLE2_QUICK_SETTINGS) // THEN expand is disabled assertThat(actual).isFalse() // WHEN QS is enabled - disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_NONE, - ) + disableFlagsRepository.disableFlags.value = DisableFlagsModel(disable2 = DISABLE2_NONE) // THEN expand is enabled assertThat(actual).isTrue() } @@ -282,10 +251,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { testScope.runTest { deviceProvisioningRepository.setDeviceProvisioned(true) keyguardRepository.setIsDozing(false) - disableFlagsRepository.disableFlags.value = - DisableFlagsModel( - disable2 = DISABLE2_NONE, - ) + disableFlagsRepository.disableFlags.value = DisableFlagsModel(disable2 = DISABLE2_NONE) userSetupRepository.setUserSetUp(true) val actual by collectLastValue(underTest.isExpandToQsEnabled) @@ -359,9 +325,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { ) ) keyguardRepository.setDozeTransitionModel( - DozeTransitionModel( - to = DozeStateModel.DOZE_AOD, - ) + DozeTransitionModel(to = DozeStateModel.DOZE_AOD) ) val isShadeTouchable by collectLastValue(underTest.isShadeTouchable) assertThat(isShadeTouchable).isFalse() @@ -385,9 +349,7 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { ) ) keyguardRepository.setDozeTransitionModel( - DozeTransitionModel( - to = DozeStateModel.DOZE_PULSING, - ) + DozeTransitionModel(to = DozeStateModel.DOZE_PULSING) ) val isShadeTouchable by collectLastValue(underTest.isShadeTouchable) assertThat(isShadeTouchable).isTrue() @@ -450,71 +412,9 @@ class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { lastSleepReason = WakeSleepReason.OTHER, ) keyguardTransitionRepository.sendTransitionStep( - TransitionStep( - transitionState = TransitionState.STARTED, - ) + TransitionStep(transitionState = TransitionState.STARTED) ) val isShadeTouchable by collectLastValue(underTest.isShadeTouchable) assertThat(isShadeTouchable).isTrue() } - - @Test - @DisableFlags(DualShade.FLAG_NAME) - fun legacyShadeMode_narrowScreen_singleShade() = - testScope.runTest { - val shadeMode by collectLastValue(underTest.shadeMode) - kosmos.shadeRepository.setShadeLayoutWide(false) - - assertThat(shadeMode).isEqualTo(ShadeMode.Single) - } - - @Test - @DisableFlags(DualShade.FLAG_NAME) - fun legacyShadeMode_wideScreen_splitShade() = - testScope.runTest { - val shadeMode by collectLastValue(underTest.shadeMode) - kosmos.shadeRepository.setShadeLayoutWide(true) - - assertThat(shadeMode).isEqualTo(ShadeMode.Split) - } - - @Test - @EnableFlags(DualShade.FLAG_NAME) - fun shadeMode_wideScreen_isDual() = - testScope.runTest { - val shadeMode by collectLastValue(underTest.shadeMode) - kosmos.shadeRepository.setShadeLayoutWide(true) - - assertThat(shadeMode).isEqualTo(ShadeMode.Dual) - } - - @Test - @EnableFlags(DualShade.FLAG_NAME) - fun shadeMode_narrowScreen_isDual() = - testScope.runTest { - val shadeMode by collectLastValue(underTest.shadeMode) - kosmos.shadeRepository.setShadeLayoutWide(false) - - assertThat(shadeMode).isEqualTo(ShadeMode.Dual) - } - - @Test - fun getTopEdgeSplitFraction_narrowScreen_splitInHalf() = - testScope.runTest { - // Ensure isShadeLayoutWide is collected. - val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) - shadeRepository.setShadeLayoutWide(false) - - assertThat(underTest.getTopEdgeSplitFraction()).isEqualTo(0.5f) - } - - @Test - fun getTopEdgeSplitFraction_wideScreen_leftSideLarger() = - testScope.runTest { - // Ensure isShadeLayoutWide is collected. - val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) - shadeRepository.setShadeLayoutWide(true) - - assertThat(underTest.getTopEdgeSplitFraction()).isGreaterThan(0.5f) - } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt new file mode 100644 index 000000000000..2a2817b9af73 --- /dev/null +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.shade.domain.interactor + +import android.platform.test.annotations.DisableFlags +import android.platform.test.annotations.EnableFlags +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.systemui.SysuiTestCase +import com.android.systemui.coroutines.collectLastValue +import com.android.systemui.kosmos.testScope +import com.android.systemui.shade.data.repository.shadeRepository +import com.android.systemui.shade.shared.flag.DualShade +import com.android.systemui.shade.shared.model.ShadeMode +import com.android.systemui.testKosmos +import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.test.runTest +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +@SmallTest +@RunWith(AndroidJUnit4::class) +class ShadeModeInteractorImplTest : SysuiTestCase() { + + private val kosmos = testKosmos() + private val testScope = kosmos.testScope + + private lateinit var underTest: ShadeModeInteractor + + @Before + fun setUp() { + underTest = kosmos.shadeModeInteractor + } + + @Test + @DisableFlags(DualShade.FLAG_NAME) + fun legacyShadeMode_narrowScreen_singleShade() = + testScope.runTest { + val shadeMode by collectLastValue(underTest.shadeMode) + kosmos.shadeRepository.setShadeLayoutWide(false) + + assertThat(shadeMode).isEqualTo(ShadeMode.Single) + } + + @Test + @DisableFlags(DualShade.FLAG_NAME) + fun legacyShadeMode_wideScreen_splitShade() = + testScope.runTest { + val shadeMode by collectLastValue(underTest.shadeMode) + kosmos.shadeRepository.setShadeLayoutWide(true) + + assertThat(shadeMode).isEqualTo(ShadeMode.Split) + } + + @Test + @EnableFlags(DualShade.FLAG_NAME) + fun shadeMode_wideScreen_isDual() = + testScope.runTest { + val shadeMode by collectLastValue(underTest.shadeMode) + kosmos.shadeRepository.setShadeLayoutWide(true) + + assertThat(shadeMode).isEqualTo(ShadeMode.Dual) + } + + @Test + @EnableFlags(DualShade.FLAG_NAME) + fun shadeMode_narrowScreen_isDual() = + testScope.runTest { + val shadeMode by collectLastValue(underTest.shadeMode) + kosmos.shadeRepository.setShadeLayoutWide(false) + + assertThat(shadeMode).isEqualTo(ShadeMode.Dual) + } + + @Test + fun getTopEdgeSplitFraction_narrowScreen_splitInHalf() = + testScope.runTest { + // Ensure isShadeLayoutWide is collected. + val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) + kosmos.shadeRepository.setShadeLayoutWide(false) + + assertThat(underTest.getTopEdgeSplitFraction()).isEqualTo(0.5f) + } + + @Test + fun getTopEdgeSplitFraction_wideScreen_leftSideLarger() = + testScope.runTest { + // Ensure isShadeLayoutWide is collected. + val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) + kosmos.shadeRepository.setShadeLayoutWide(true) + + assertThat(underTest.getTopEdgeSplitFraction()).isGreaterThan(0.5f) + } +} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBlueprintInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBlueprintInteractor.kt index e2bb540f6645..7afc7596a994 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBlueprintInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBlueprintInteractor.kt @@ -80,10 +80,7 @@ constructor( } applicationScope.launch { val refreshConfig = - Config( - Type.NoTransition, - rebuildSections = listOf(smartspaceSection), - ) + Config(Type.NoTransition, rebuildSections = listOf(smartspaceSection)) configurationInteractor.onAnyConfigurationChange.collect { refreshBlueprint(refreshConfig) } diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/resolver/NotifShadeSceneFamilyResolver.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/resolver/NotifShadeSceneFamilyResolver.kt index 99e554ea5595..a3132736fe33 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/domain/resolver/NotifShadeSceneFamilyResolver.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/domain/resolver/NotifShadeSceneFamilyResolver.kt @@ -21,7 +21,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.scene.shared.model.SceneFamilies import com.android.systemui.scene.shared.model.Scenes -import com.android.systemui.shade.domain.interactor.ShadeInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor import com.android.systemui.shade.shared.model.ShadeMode import dagger.Binds import dagger.Module @@ -38,17 +38,17 @@ class NotifShadeSceneFamilyResolver @Inject constructor( @Application applicationScope: CoroutineScope, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, ) : SceneResolver { override val targetFamily: SceneKey = SceneFamilies.NotifShade override val resolvedScene: StateFlow = - shadeInteractor.shadeMode + shadeModeInteractor.shadeMode .map(::notifShadeScene) .stateIn( applicationScope, started = SharingStarted.Eagerly, - initialValue = notifShadeScene(shadeInteractor.shadeMode.value), + initialValue = notifShadeScene(shadeModeInteractor.shadeMode.value), ) override fun includesScene(scene: SceneKey): Boolean = scene in notifShadeScenes @@ -61,11 +61,7 @@ constructor( } companion object { - val notifShadeScenes = - setOf( - Scenes.NotificationsShade, - Scenes.Shade, - ) + val notifShadeScenes = setOf(Scenes.NotificationsShade, Scenes.Shade) } } diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/resolver/QuickSettingsSceneFamilyResolver.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/resolver/QuickSettingsSceneFamilyResolver.kt index 2962a3ec903d..923e712af15d 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/domain/resolver/QuickSettingsSceneFamilyResolver.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/domain/resolver/QuickSettingsSceneFamilyResolver.kt @@ -21,7 +21,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.scene.shared.model.SceneFamilies import com.android.systemui.scene.shared.model.Scenes -import com.android.systemui.shade.domain.interactor.ShadeInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor import com.android.systemui.shade.shared.model.ShadeMode import dagger.Binds import dagger.Module @@ -38,17 +38,17 @@ class QuickSettingsSceneFamilyResolver @Inject constructor( @Application applicationScope: CoroutineScope, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, ) : SceneResolver { override val targetFamily: SceneKey = SceneFamilies.QuickSettings override val resolvedScene: StateFlow = - shadeInteractor.shadeMode + shadeModeInteractor.shadeMode .map(::quickSettingsScene) .stateIn( applicationScope, started = SharingStarted.Eagerly, - initialValue = quickSettingsScene(shadeInteractor.shadeMode.value), + initialValue = quickSettingsScene(shadeModeInteractor.shadeMode.value), ) override fun includesScene(scene: SceneKey): Boolean = scene in quickSettingsScenes @@ -62,11 +62,7 @@ constructor( companion object { val quickSettingsScenes = - setOf( - Scenes.QuickSettings, - Scenes.QuickSettingsShade, - Scenes.Shade, - ) + setOf(Scenes.QuickSettings, Scenes.QuickSettingsShade, Scenes.Shade) } } diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt index 7425807b716d..99ff94605c39 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt @@ -28,6 +28,8 @@ import com.android.systemui.shade.domain.interactor.ShadeBackActionInteractor import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.shade.domain.interactor.ShadeInteractorEmptyImpl import com.android.systemui.shade.domain.interactor.ShadeLockscreenInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractorEmptyImpl import dagger.Binds import dagger.Module @@ -75,4 +77,8 @@ abstract class ShadeEmptyImplModule { @Binds @SysUISingleton abstract fun bindsPrivacyChipRepository(impl: PrivacyChipRepositoryImpl): PrivacyChipRepository + + @Binds + @SysUISingleton + abstract fun bindShadeModeInteractor(impl: ShadeModeInteractorEmptyImpl): ShadeModeInteractor } diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt index da2024b4ef18..2348a110eb3a 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt @@ -41,6 +41,8 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractorLegacyImpl import com.android.systemui.shade.domain.interactor.ShadeInteractorSceneContainerImpl import com.android.systemui.shade.domain.interactor.ShadeLockscreenInteractor import com.android.systemui.shade.domain.interactor.ShadeLockscreenInteractorImpl +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractorImpl import dagger.Binds import dagger.Module import dagger.Provides @@ -54,7 +56,7 @@ abstract class ShadeModule { @SysUISingleton fun provideBaseShadeInteractor( sceneContainerOn: Provider, - sceneContainerOff: Provider + sceneContainerOff: Provider, ): BaseShadeInteractor { return if (SceneContainerFlag.isEnabled) { sceneContainerOn.get() @@ -67,7 +69,7 @@ abstract class ShadeModule { @SysUISingleton fun provideShadeController( sceneContainerOn: Provider, - sceneContainerOff: Provider + sceneContainerOff: Provider, ): ShadeController { return if (SceneContainerFlag.isEnabled) { sceneContainerOn.get() @@ -80,7 +82,7 @@ abstract class ShadeModule { @SysUISingleton fun provideShadeAnimationInteractor( sceneContainerOn: Provider, - sceneContainerOff: Provider + sceneContainerOff: Provider, ): ShadeAnimationInteractor { return if (SceneContainerFlag.isEnabled) { sceneContainerOn.get() @@ -93,7 +95,7 @@ abstract class ShadeModule { @SysUISingleton fun provideShadeBackActionInteractor( sceneContainerOn: Provider, - sceneContainerOff: Provider + sceneContainerOff: Provider, ): ShadeBackActionInteractor { return if (SceneContainerFlag.isEnabled) { sceneContainerOn.get() @@ -106,7 +108,7 @@ abstract class ShadeModule { @SysUISingleton fun provideShadeLockscreenInteractor( sceneContainerOn: Provider, - sceneContainerOff: Provider + sceneContainerOff: Provider, ): ShadeLockscreenInteractor { return if (SceneContainerFlag.isEnabled) { sceneContainerOn.get() @@ -119,7 +121,7 @@ abstract class ShadeModule { @SysUISingleton fun providePanelExpansionInteractor( sceneContainerOn: Provider, - sceneContainerOff: Provider + sceneContainerOff: Provider, ): PanelExpansionInteractor { return if (SceneContainerFlag.isEnabled) { sceneContainerOn.get() @@ -170,4 +172,8 @@ abstract class ShadeModule { @Binds @SysUISingleton abstract fun bindsPrivacyChipRepository(impl: PrivacyChipRepositoryImpl): PrivacyChipRepository + + @Binds + @SysUISingleton + abstract fun bindShadeModeInteractor(impl: ShadeModeInteractorImpl): ShadeModeInteractor } diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt index 3cd91be469c1..6fb96da2c186 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt @@ -145,7 +145,7 @@ interface BaseShadeInteractor { fun createAnyExpansionFlow( scope: CoroutineScope, shadeExpansion: Flow, - qsExpansion: Flow + qsExpansion: Flow, ): StateFlow { return combine(shadeExpansion, qsExpansion) { shadeExp, qsExp -> maxOf(shadeExp, qsExp) } .stateIn(scope, SharingStarted.Eagerly, 0f) diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt index b8d2dd2a764f..3eab02ad30d5 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt @@ -16,7 +16,6 @@ package com.android.systemui.shade.domain.interactor -import androidx.annotation.FloatRange import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.data.repository.KeyguardRepository @@ -25,9 +24,6 @@ import com.android.systemui.keyguard.shared.model.DozeStateModel import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.power.domain.interactor.PowerInteractor -import com.android.systemui.shade.data.repository.ShadeRepository -import com.android.systemui.shade.shared.flag.DualShade -import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.statusbar.disableflags.data.repository.DisableFlagsRepository import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.policy.data.repository.UserSetupRepository @@ -55,11 +51,14 @@ constructor( keyguardRepository: KeyguardRepository, keyguardTransitionInteractor: KeyguardTransitionInteractor, powerInteractor: PowerInteractor, - private val shadeRepository: ShadeRepository, userSetupRepository: UserSetupRepository, userSwitcherInteractor: UserSwitcherInteractor, private val baseShadeInteractor: BaseShadeInteractor, -) : ShadeInteractor, BaseShadeInteractor by baseShadeInteractor { + shadeModeInteractor: ShadeModeInteractor, +) : + ShadeInteractor, + BaseShadeInteractor by baseShadeInteractor, + ShadeModeInteractor by shadeModeInteractor { override val isShadeEnabled: StateFlow = disableFlagsRepository.disableFlags .map { it.isShadeEnabled() } @@ -103,27 +102,6 @@ constructor( } } - override val isShadeLayoutWide: StateFlow = shadeRepository.isShadeLayoutWide - - @FloatRange(from = 0.0, to = 1.0) - override fun getTopEdgeSplitFraction(): Float { - // Note: this implicitly relies on isShadeLayoutWide being hot (i.e. collected). This - // assumption allows us to query its value on demand (during swipe source detection) instead - // of running another infinite coroutine. - // TODO(b/338577208): Instead of being fixed at 0.8f, this should dynamically updated based - // on the position of system-status icons in the status bar. - return if (shadeRepository.isShadeLayoutWide.value) 0.8f else 0.5f - } - - override val shadeMode: StateFlow = - isShadeLayoutWide - .map(this::determineShadeMode) - .stateIn( - scope, - SharingStarted.Eagerly, - initialValue = determineShadeMode(isShadeLayoutWide.value) - ) - override val isExpandToQsEnabled: Flow = combine( disableFlagsRepository.disableFlags, @@ -140,12 +118,4 @@ constructor( disableFlags.isQuickSettingsEnabled() && !isDozing } - - private fun determineShadeMode(isShadeLayoutWide: Boolean): ShadeMode { - return when { - DualShade.isEnabled -> ShadeMode.Dual - isShadeLayoutWide -> ShadeMode.Split - else -> ShadeMode.Single - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt new file mode 100644 index 000000000000..77ae679bf018 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.shade.domain.interactor + +import androidx.annotation.FloatRange +import com.android.systemui.dagger.qualifiers.Application +import com.android.systemui.shade.data.repository.ShadeRepository +import com.android.systemui.shade.shared.flag.DualShade +import com.android.systemui.shade.shared.model.ShadeMode +import javax.inject.Inject +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharingStarted +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.stateIn + +/** + * Defines interface for classes that can provide state and business logic related to the mode of + * the shade. + */ +interface ShadeModeInteractor { + + /** + * The version of the shade layout to use. + * + * Note: Most likely, you want to read [isShadeLayoutWide] instead of this. + */ + val shadeMode: StateFlow + + /** + * Whether the shade layout should be wide (true) or narrow (false). + * + * In a wide layout, notifications and quick settings each take up only half the screen width + * (whether they are shown at the same time or not). In a narrow layout, they can each be as + * wide as the entire screen. + */ + val isShadeLayoutWide: StateFlow + + /** + * The fraction between [0..1] (i.e., percentage) of screen width to consider the threshold + * between "top-left" and "top-right" for the purposes of dual-shade invocation. + * + * When the dual-shade is not wide, this always returns 0.5 (the top edge is evenly split). On + * wide layouts however, a larger fraction is returned because only the area of the system + * status icons is considered top-right. + * + * Note that this fraction only determines the split between the absolute left and right + * directions. In RTL layouts, the "top-start" edge will resolve to "top-right", and "top-end" + * will resolve to "top-left". + */ + @FloatRange(from = 0.0, to = 1.0) fun getTopEdgeSplitFraction(): Float +} + +class ShadeModeInteractorImpl +@Inject +constructor( + @Application applicationScope: CoroutineScope, + private val repository: ShadeRepository, +) : ShadeModeInteractor { + + override val isShadeLayoutWide: StateFlow = repository.isShadeLayoutWide + + override val shadeMode: StateFlow = + isShadeLayoutWide + .map(this::determineShadeMode) + .stateIn( + applicationScope, + SharingStarted.Eagerly, + initialValue = determineShadeMode(isShadeLayoutWide.value), + ) + + @FloatRange(from = 0.0, to = 1.0) + override fun getTopEdgeSplitFraction(): Float { + // Note: this implicitly relies on isShadeLayoutWide being hot (i.e. collected). This + // assumption allows us to query its value on demand (during swipe source detection) instead + // of running another infinite coroutine. + // TODO(b/338577208): Instead of being fixed at 0.8f, this should dynamically updated based + // on the position of system-status icons in the status bar. + return if (repository.isShadeLayoutWide.value) 0.8f else 0.5f + } + + private fun determineShadeMode(isShadeLayoutWide: Boolean): ShadeMode { + return when { + DualShade.isEnabled -> ShadeMode.Dual + isShadeLayoutWide -> ShadeMode.Split + else -> ShadeMode.Single + } + } +} + +class ShadeModeInteractorEmptyImpl @Inject constructor() : ShadeModeInteractor { + + override val shadeMode: StateFlow = MutableStateFlow(ShadeMode.Single) + + override val isShadeLayoutWide: StateFlow = MutableStateFlow(false) + + override fun getTopEdgeSplitFraction(): Float = 0.5f +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 9481e5a52098..e0c4ab737511 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -431,7 +431,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mFakeKeyguardRepository, mKeyguardTransitionInteractor, mPowerInteractor, - mShadeRepository, new FakeUserSetupRepository(), mock(UserSwitcherInteractor.class), new ShadeInteractorLegacyImpl( @@ -447,8 +446,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { () -> mLargeScreenHeaderHelper ), mShadeRepository - ) - ); + ), + mKosmos.getShadeModeInteractor()); SystemClock systemClock = new FakeSystemClock(); mStatusBarStateController = new StatusBarStateControllerImpl( mUiEventLogger, diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java index 3f6617b32131..a52f1737117a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java @@ -217,7 +217,6 @@ public class QuickSettingsControllerImplBaseTest extends SysuiTestCase { mKeyguardRepository, keyguardTransitionInteractor, powerInteractor, - mShadeRepository, new FakeUserSetupRepository(), mUserSwitcherInteractor, new ShadeInteractorLegacyImpl( @@ -232,8 +231,8 @@ public class QuickSettingsControllerImplBaseTest extends SysuiTestCase { deviceEntryUdfpsInteractor, () -> mLargeScreenHeaderHelper), mShadeRepository - ) - ); + ), + mKosmos.getShadeModeInteractor()); mActiveNotificationsInteractor = new ActiveNotificationsInteractor( new ActiveNotificationListRepository(), diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt index 457bd284ea8d..c60305e85b22 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt @@ -61,6 +61,7 @@ import com.android.systemui.scene.shared.model.sceneDataSource import com.android.systemui.settings.brightness.domain.interactor.brightnessMirrorShowingInteractor import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.shade.shadeController import com.android.systemui.shade.ui.viewmodel.notificationShadeWindowModel import com.android.systemui.statusbar.chips.ui.viewmodel.ongoingActivityChipsViewModel @@ -156,4 +157,5 @@ class KosmosJavaAdapter() { val scrimStartable by lazy { kosmos.scrimStartable } val sceneContainerOcclusionInteractor by lazy { kosmos.sceneContainerOcclusionInteractor } val msdlPlayer by lazy { kosmos.fakeMSDLPlayer } + val shadeModeInteractor by lazy { kosmos.shadeModeInteractor } } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/resolver/SceneResolverKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/resolver/SceneResolverKosmos.kt index ae33aead67a7..d17b5750b937 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/resolver/SceneResolverKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/resolver/SceneResolverKosmos.kt @@ -24,7 +24,7 @@ import com.android.systemui.keyguard.domain.interactor.keyguardEnabledInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.scene.shared.model.SceneFamilies -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import kotlinx.coroutines.ExperimentalCoroutinesApi val Kosmos.sceneFamilyResolvers: Map @@ -48,7 +48,7 @@ val Kosmos.notifShadeSceneFamilyResolver by Kosmos.Fixture { NotifShadeSceneFamilyResolver( applicationScope = applicationCoroutineScope, - shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, ) } @@ -56,6 +56,6 @@ val Kosmos.quickSettingsSceneFamilyResolver by Kosmos.Fixture { QuickSettingsSceneFamilyResolver( applicationScope = applicationCoroutineScope, - shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeInteractorKosmos.kt index 54208b9cdaef..04d930c72792 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeInteractorKosmos.kt @@ -53,7 +53,7 @@ val Kosmos.shadeInteractorLegacyImpl by scope = applicationCoroutineScope, keyguardRepository = keyguardRepository, sharedNotificationContainerInteractor = sharedNotificationContainerInteractor, - repository = shadeRepository + repository = shadeRepository, ) } var Kosmos.shadeInteractor: ShadeInteractor by Kosmos.Fixture { shadeInteractorImpl } @@ -70,6 +70,6 @@ val Kosmos.shadeInteractorImpl by userSetupRepository = userSetupRepository, userSwitcherInteractor = userSwitcherInteractor, baseShadeInteractor = baseShadeInteractor, - shadeRepository = shadeRepository, + shadeModeInteractor = shadeModeInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorKosmos.kt new file mode 100644 index 000000000000..7892e962d63d --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorKosmos.kt @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.shade.domain.interactor + +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.Kosmos.Fixture +import com.android.systemui.kosmos.applicationCoroutineScope +import com.android.systemui.shade.data.repository.shadeRepository + +val Kosmos.shadeModeInteractor by Fixture { + ShadeModeInteractorImpl( + applicationScope = applicationCoroutineScope, + repository = shadeRepository, + ) +} -- GitLab From 29e397412d87de8ed7ed724a9ed9407f600a58fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Kozynski?= Date: Tue, 3 Sep 2024 14:52:30 -0400 Subject: [PATCH 132/492] Add categories to tiles for edit mode This CL adds categories to the QSTileConfig. These are used for grouping and sorting the tiles that can be added into groups, making them easier to parse. Test: manual Test: atest GroupAndSortCategoryAndNameTest Bug: 364329418 Flag: com.android.systemui.qs_ui_refactor_compose_fragment Change-Id: I2ef086502d68f4d2ea484411e2d1d6101d02075a --- .../systemui/common/ui/compose/TextExt.kt | 7 ++ .../IconAndNameCustomRepositoryTest.kt | 5 +- .../interactor/EditTilesListInteractorTest.kt | 6 +- .../ui/compose/EditTileListStateTest.kt | 6 +- .../ui/viewmodel/EditModeViewModelTest.kt | 20 +++-- .../model/GroupAndSortCategoryAndNameTest.kt | 87 +++++++++++++++++++ .../irecording/IssueRecordingMapperTest.kt | 4 +- packages/SystemUI/res/values/strings.xml | 29 +++++++ .../accessibility/qs/QSAccessibilityModule.kt | 8 ++ .../systemui/battery/BatterySaverModule.kt | 4 +- .../controls/dagger/ControlsModule.kt | 39 ++++----- .../systemui/dreams/dagger/DreamModule.java | 2 + .../dagger/QRCodeScannerModule.kt | 4 +- .../repository/IconAndNameCustomRepository.kt | 3 +- .../interactor/EditTilesListInteractor.kt | 5 +- .../qs/panels/shared/model/EditTileData.kt | 2 + .../systemui/qs/panels/ui/compose/Tile.kt | 50 +++++++---- .../qs/panels/ui/model/TileGridCell.kt | 3 +- .../panels/ui/viewmodel/EditModeViewModel.kt | 72 ++++++++------- .../panels/ui/viewmodel/EditTileViewModel.kt | 37 +++++++- .../systemui/qs/shared/model/TileCategory.kt | 46 ++++++++++ .../qs/tiles/viewmodel/QSTileConfig.kt | 2 + .../tiles/viewmodel/QSTileConfigProvider.kt | 2 + .../systemui/recordissue/RecordIssueModule.kt | 2 + .../rotationlock/RotationLockNewModule.kt | 5 +- .../screenrecord/ScreenRecordModule.kt | 2 + .../connectivity/ConnectivityModule.kt | 13 ++- .../systemui/statusbar/policy/PolicyModule.kt | 12 ++- .../systemui/wallet/dagger/WalletModule.java | 6 +- .../qs/panels/ui/compose/DragAndDropTest.kt | 6 +- .../ui/viewmodel/EditModeViewModelKosmos.kt | 4 + .../qs/tiles/di/NewQSTileFactoryKosmos.kt | 2 + .../viewmodel/QSTileConfigTestBuilder.kt | 3 + 33 files changed, 401 insertions(+), 97 deletions(-) create mode 100644 packages/SystemUI/multivalentTests/src/com/android/systemui/qs/shared/model/GroupAndSortCategoryAndNameTest.kt create mode 100644 packages/SystemUI/src/com/android/systemui/qs/shared/model/TileCategory.kt diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/TextExt.kt b/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/TextExt.kt index e1f73e304b9e..4e8121f14e4b 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/TextExt.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/TextExt.kt @@ -17,9 +17,12 @@ package com.android.systemui.common.ui.compose +import android.content.Context import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.AnnotatedString import com.android.systemui.common.shared.model.Text +import com.android.systemui.common.shared.model.Text.Companion.loadText /** Returns the loaded [String] or `null` if there isn't one. */ @Composable @@ -29,3 +32,7 @@ fun Text.load(): String? { is Text.Resource -> stringResource(res) } } + +fun Text.toAnnotatedString(context: Context): AnnotatedString? { + return loadText(context)?.let { AnnotatedString(it) } +} diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/IconAndNameCustomRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/IconAndNameCustomRepositoryTest.kt index 1e5599bfe1d5..93ba26517e37 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/IconAndNameCustomRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/IconAndNameCustomRepositoryTest.kt @@ -19,7 +19,6 @@ package com.android.systemui.qs.panels.data.repository import android.content.ComponentName import android.content.packageManager import android.content.pm.PackageManager -import android.content.pm.ServiceInfo import android.content.pm.UserInfo import android.graphics.drawable.TestStubDrawable import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -35,6 +34,7 @@ import com.android.systemui.qs.pipeline.data.repository.FakeInstalledTilesCompon import com.android.systemui.qs.pipeline.data.repository.fakeInstalledTilesRepository import com.android.systemui.qs.pipeline.data.repository.installedTilesRepository import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.settings.FakeUserTracker import com.android.systemui.settings.fakeUserTracker import com.android.systemui.testKosmos @@ -100,6 +100,7 @@ class IconAndNameCustomRepositoryTest : SysuiTestCase() { Icon.Loaded(drawable1, ContentDescription.Loaded(tileService1)), Text.Loaded(tileService1), Text.Loaded(appName1), + TileCategory.PROVIDED_BY_APP, ) val expectedData2 = EditTileData( @@ -107,6 +108,7 @@ class IconAndNameCustomRepositoryTest : SysuiTestCase() { Icon.Loaded(drawable2, ContentDescription.Loaded(tileService2)), Text.Loaded(tileService2), Text.Loaded(appName2), + TileCategory.PROVIDED_BY_APP, ) assertThat(editTileDataList).containsExactly(expectedData1, expectedData2) @@ -144,6 +146,7 @@ class IconAndNameCustomRepositoryTest : SysuiTestCase() { Icon.Loaded(drawable1, ContentDescription.Loaded(tileService1)), Text.Loaded(tileService1), Text.Loaded(appName1), + TileCategory.PROVIDED_BY_APP, ) val editTileDataList = underTest.getCustomTileData() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/EditTilesListInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/EditTilesListInteractorTest.kt index deefbf585ba9..053a59aa533a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/EditTilesListInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/EditTilesListInteractorTest.kt @@ -31,6 +31,7 @@ import com.android.systemui.qs.panels.shared.model.EditTileData import com.android.systemui.qs.pipeline.data.repository.FakeInstalledTilesComponentRepository import com.android.systemui.qs.pipeline.data.repository.fakeInstalledTilesRepository import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tiles.impl.battery.qsBatterySaverTileConfig import com.android.systemui.qs.tiles.impl.flashlight.qsFlashlightTileConfig import com.android.systemui.qs.tiles.impl.internet.qsInternetTileConfig @@ -132,6 +133,7 @@ class EditTilesListInteractorTest : SysuiTestCase() { icon = Icon.Loaded(icon, ContentDescription.Loaded(tileName)), label = Text.Loaded(tileName), appName = Text.Loaded(appName), + category = TileCategory.PROVIDED_BY_APP, ) assertThat(editTiles.customTiles).hasSize(1) @@ -181,7 +183,8 @@ class EditTilesListInteractorTest : SysuiTestCase() { tileSpec = this, icon = Icon.Resource(android.R.drawable.star_on, ContentDescription.Loaded(spec)), label = Text.Loaded(spec), - appName = null + appName = null, + category = TileCategory.UNKNOWN, ) } @@ -192,6 +195,7 @@ class EditTilesListInteractorTest : SysuiTestCase() { Icon.Resource(uiConfig.iconRes, ContentDescription.Resource(uiConfig.labelRes)), label = Text.Resource(uiConfig.labelRes), appName = null, + category = category, ) } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/compose/EditTileListStateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/compose/EditTileListStateTest.kt index 7f01fad1ce55..484a8ff973c1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/compose/EditTileListStateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/compose/EditTileListStateTest.kt @@ -16,11 +16,11 @@ package com.android.systemui.qs.panels.ui.compose +import androidx.compose.ui.text.AnnotatedString import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.common.shared.model.Icon -import com.android.systemui.common.shared.model.Text import com.android.systemui.qs.panels.shared.model.SizedTile import com.android.systemui.qs.panels.shared.model.SizedTileImpl import com.android.systemui.qs.panels.ui.model.GridCell @@ -28,6 +28,7 @@ import com.android.systemui.qs.panels.ui.model.SpacerGridCell import com.android.systemui.qs.panels.ui.model.TileGridCell import com.android.systemui.qs.panels.ui.viewmodel.EditTileViewModel import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.google.common.truth.Truth.assertThat import org.junit.Test import org.junit.runner.RunWith @@ -141,10 +142,11 @@ class EditTileListStateTest : SysuiTestCase() { EditTileViewModel( tileSpec = TileSpec.create(tileSpec), icon = Icon.Resource(0, null), - label = Text.Loaded("unused"), + label = AnnotatedString("unused"), appName = null, isCurrent = true, availableEditActions = emptySet(), + category = TileCategory.UNKNOWN, ), width, ) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModelTest.kt index 601779f8fb02..583db722a759 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModelTest.kt @@ -26,6 +26,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Text +import com.android.systemui.common.ui.compose.toAnnotatedString import com.android.systemui.coroutines.collectLastValue import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope @@ -42,6 +43,7 @@ import com.android.systemui.qs.pipeline.data.repository.fakeMinimumTilesReposito import com.android.systemui.qs.pipeline.domain.interactor.currentTilesInteractor import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.qsTileFactory +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tiles.impl.alarm.qsAlarmTileConfig import com.android.systemui.qs.tiles.impl.battery.qsBatterySaverTileConfig import com.android.systemui.qs.tiles.impl.flashlight.qsFlashlightTileConfig @@ -190,7 +192,7 @@ class EditModeViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { .forEach { val data = getEditTileData(it.tileSpec) - assertThat(it.label).isEqualTo(data.label) + assertThat(it.label).isEqualTo(data.label.toAnnotatedString(context)) assertThat(it.icon).isEqualTo(data.icon) assertThat(it.appName).isNull() } @@ -224,15 +226,19 @@ class EditModeViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { // service1 val model1 = tiles!!.first { it.tileSpec == TileSpec.create(component1) } - assertThat(model1.label).isEqualTo(Text.Loaded(tileService1)) - assertThat(model1.appName).isEqualTo(Text.Loaded(appName1)) + assertThat(model1.label) + .isEqualTo(Text.Loaded(tileService1).toAnnotatedString(context)) + assertThat(model1.appName) + .isEqualTo(Text.Loaded(appName1).toAnnotatedString(context)) assertThat(model1.icon) .isEqualTo(Icon.Loaded(drawable1, ContentDescription.Loaded(tileService1))) // service2 val model2 = tiles!!.first { it.tileSpec == TileSpec.create(component2) } - assertThat(model2.label).isEqualTo(Text.Loaded(tileService2)) - assertThat(model2.appName).isEqualTo(Text.Loaded(appName2)) + assertThat(model2.label) + .isEqualTo(Text.Loaded(tileService2).toAnnotatedString(context)) + assertThat(model2.appName) + .isEqualTo(Text.Loaded(appName2).toAnnotatedString(context)) assertThat(model2.icon) .isEqualTo(Icon.Loaded(drawable2, ContentDescription.Loaded(tileService2))) } @@ -559,7 +565,8 @@ class EditModeViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { tileSpec = this, icon = Icon.Resource(R.drawable.star_on, ContentDescription.Loaded(spec)), label = Text.Loaded(spec), - appName = null + appName = null, + category = TileCategory.UNKNOWN, ) } @@ -570,6 +577,7 @@ class EditModeViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { Icon.Resource(uiConfig.iconRes, ContentDescription.Resource(uiConfig.labelRes)), label = Text.Resource(uiConfig.labelRes), appName = null, + category = category, ) } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/shared/model/GroupAndSortCategoryAndNameTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/shared/model/GroupAndSortCategoryAndNameTest.kt new file mode 100644 index 000000000000..7f90e3b6f5e0 --- /dev/null +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/shared/model/GroupAndSortCategoryAndNameTest.kt @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.qs.shared.model + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.systemui.SysuiTestCase +import com.google.common.truth.Truth.assertThat +import org.junit.Test +import org.junit.runner.RunWith + +@SmallTest +@RunWith(AndroidJUnit4::class) +class GroupAndSortCategoryAndNameTest : SysuiTestCase() { + + private val elements = + listOf( + CategoryAndName(TileCategory.DISPLAY, "B"), + CategoryAndName(TileCategory.PRIVACY, "A"), + CategoryAndName(TileCategory.DISPLAY, "C"), + CategoryAndName(TileCategory.UTILITIES, "B"), + CategoryAndName(TileCategory.CONNECTIVITY, "A"), + CategoryAndName(TileCategory.PROVIDED_BY_APP, "B"), + CategoryAndName(TileCategory.CONNECTIVITY, "C"), + CategoryAndName(TileCategory.ACCESSIBILITY, "A") + ) + + @Test + fun allElementsInResult() { + val grouped = groupAndSort(elements) + val allValues = grouped.values.reduce { acc, el -> acc + el } + assertThat(allValues).containsExactlyElementsIn(elements) + } + + @Test + fun groupedByCategory() { + val grouped = groupAndSort(elements) + grouped.forEach { tileCategory, categoryAndNames -> + categoryAndNames.forEach { element -> + assertThat(element.category).isEqualTo(tileCategory) + } + } + } + + @Test + fun sortedAlphabeticallyInEachCategory() { + val grouped = groupAndSort(elements) + grouped.values.forEach { elements -> + assertThat(elements.map(CategoryAndName::name)).isInOrder() + } + } + + @Test + fun categoriesSortedInNaturalOrder() { + val grouped = groupAndSort(elements) + assertThat(grouped.keys).isInOrder() + } + + @Test + fun missingCategoriesAreNotInResult() { + val grouped = groupAndSort(elements.filterNot { it.category == TileCategory.CONNECTIVITY }) + assertThat(grouped.keys).doesNotContain(TileCategory.CONNECTIVITY) + } + + companion object { + private fun CategoryAndName(category: TileCategory, name: String): CategoryAndName { + return object : CategoryAndName { + override val category = category + override val name = name + } + } + } +} diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapperTest.kt index 244422943309..fa6d8bf4a317 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapperTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapperTest.kt @@ -24,6 +24,7 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testCase import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.qsEventLogger +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tiles.viewmodel.QSTileConfig import com.android.systemui.qs.tiles.viewmodel.QSTileState import com.android.systemui.qs.tiles.viewmodel.QSTileUIConfig @@ -43,7 +44,8 @@ class IssueRecordingMapperTest : SysuiTestCase() { QSTileConfig( TileSpec.create(RecordIssueModule.TILE_SPEC), uiConfig, - kosmos.qsEventLogger.getNewInstanceId() + kosmos.qsEventLogger.getNewInstanceId(), + TileCategory.UTILITIES, ) private val resources = kosmos.mainResources private val theme = resources.newTheme() diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index e6cc6cf766c6..5ffa07d48b75 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -3787,4 +3787,33 @@ Action + ESC for this. Extra dim shortcut removed. To lower your brightness, use the regular brightness bar. + + + + Connectivity + + + + Accessibility + + + + Utilities + + + + Privacy + + + + Provided by apps + + + + Display + + + + Unknown + diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/qs/QSAccessibilityModule.kt b/packages/SystemUI/src/com/android/systemui/accessibility/qs/QSAccessibilityModule.kt index bb80396c70fb..cd9efaf6e6bb 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/qs/QSAccessibilityModule.kt +++ b/packages/SystemUI/src/com/android/systemui/accessibility/qs/QSAccessibilityModule.kt @@ -19,6 +19,7 @@ package com.android.systemui.accessibility.qs import com.android.systemui.Flags import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.ColorCorrectionTile import com.android.systemui.qs.tiles.ColorInversionTile @@ -179,6 +180,7 @@ interface QSAccessibilityModule { labelRes = R.string.quick_settings_color_correction_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.ACCESSIBILITY, ) /** Inject ColorCorrectionTile into tileViewModelMap in QSModule */ @@ -210,6 +212,7 @@ interface QSAccessibilityModule { labelRes = R.string.quick_settings_inversion_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.ACCESSIBILITY, ) /** Inject ColorInversionTile into tileViewModelMap in QSModule */ @@ -241,6 +244,7 @@ interface QSAccessibilityModule { labelRes = R.string.quick_settings_font_scaling_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.DISPLAY, ) /** Inject FontScaling Tile into tileViewModelMap in QSModule */ @@ -272,6 +276,7 @@ interface QSAccessibilityModule { labelRes = com.android.internal.R.string.reduce_bright_colors_feature_name, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.DISPLAY, ) @Provides @@ -286,6 +291,7 @@ interface QSAccessibilityModule { labelRes = R.string.quick_settings_hearing_devices_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.ACCESSIBILITY, ) /** @@ -322,6 +328,7 @@ interface QSAccessibilityModule { labelRes = R.string.quick_settings_onehanded_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.ACCESSIBILITY, ) /** Inject One Handed Mode Tile into tileViewModelMap in QSModule. */ @@ -355,6 +362,7 @@ interface QSAccessibilityModule { labelRes = R.string.quick_settings_night_display_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.DISPLAY, ) /** diff --git a/packages/SystemUI/src/com/android/systemui/battery/BatterySaverModule.kt b/packages/SystemUI/src/com/android/systemui/battery/BatterySaverModule.kt index 8a9a322ff100..831bc1da5a79 100644 --- a/packages/SystemUI/src/com/android/systemui/battery/BatterySaverModule.kt +++ b/packages/SystemUI/src/com/android/systemui/battery/BatterySaverModule.kt @@ -2,6 +2,7 @@ package com.android.systemui.battery import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.BatterySaverTile import com.android.systemui.qs.tiles.base.interactor.QSTileAvailabilityInteractor @@ -33,7 +34,7 @@ interface BatterySaverModule { @IntoMap @StringKey(BATTERY_SAVER_TILE_SPEC) fun provideBatterySaverAvailabilityInteractor( - impl: BatterySaverTileDataInteractor + impl: BatterySaverTileDataInteractor ): QSTileAvailabilityInteractor companion object { @@ -51,6 +52,7 @@ interface BatterySaverModule { labelRes = R.string.battery_detail_switch_title, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.UTILITIES, ) /** Inject BatterySaverTile into tileViewModelMap in QSModule */ diff --git a/packages/SystemUI/src/com/android/systemui/controls/dagger/ControlsModule.kt b/packages/SystemUI/src/com/android/systemui/controls/dagger/ControlsModule.kt index db7ffc1bef79..037b6facc50d 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/dagger/ControlsModule.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/dagger/ControlsModule.kt @@ -48,6 +48,7 @@ import com.android.systemui.controls.ui.ControlsUiControllerImpl import com.android.systemui.dagger.SysUISingleton import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.DeviceControlsTile import com.android.systemui.qs.tiles.viewmodel.QSTileConfig @@ -86,15 +87,16 @@ abstract class ControlsModule { @IntoMap @StringKey(DEVICE_CONTROLS_SPEC) fun provideDeviceControlsTileConfig(uiEventLogger: QsEventLogger): QSTileConfig = - QSTileConfig( - tileSpec = TileSpec.create(DEVICE_CONTROLS_SPEC), - uiConfig = - QSTileUIConfig.Resource( - iconRes = com.android.systemui.res.R.drawable.controls_icon, - labelRes = com.android.systemui.res.R.string.quick_controls_title - ), - instanceId = uiEventLogger.getNewInstanceId(), - ) + QSTileConfig( + tileSpec = TileSpec.create(DEVICE_CONTROLS_SPEC), + uiConfig = + QSTileUIConfig.Resource( + iconRes = com.android.systemui.res.R.drawable.controls_icon, + labelRes = com.android.systemui.res.R.string.quick_controls_title + ), + instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.UTILITIES, + ) } @Binds @@ -115,12 +117,12 @@ abstract class ControlsModule { @Binds abstract fun provideSettingsManager( - manager: ControlsSettingsRepositoryImpl + manager: ControlsSettingsRepositoryImpl ): ControlsSettingsRepository @Binds abstract fun provideDialogManager( - manager: ControlsSettingsDialogManagerImpl + manager: ControlsSettingsDialogManagerImpl ): ControlsSettingsDialogManager @Binds @@ -141,8 +143,7 @@ abstract class ControlsModule { repository: SelectedComponentRepositoryImpl ): SelectedComponentRepository - @BindsOptionalOf - abstract fun optionalPersistenceWrapper(): ControlsFavoritePersistenceWrapper + @BindsOptionalOf abstract fun optionalPersistenceWrapper(): ControlsFavoritePersistenceWrapper @BindsOptionalOf abstract fun provideControlsTileResourceConfiguration(): ControlsTileResourceConfiguration @@ -157,23 +158,17 @@ abstract class ControlsModule { @Binds @IntoMap @ClassKey(ControlsFavoritingActivity::class) - abstract fun provideControlsFavoritingActivity( - activity: ControlsFavoritingActivity - ): Activity + abstract fun provideControlsFavoritingActivity(activity: ControlsFavoritingActivity): Activity @Binds @IntoMap @ClassKey(ControlsEditingActivity::class) - abstract fun provideControlsEditingActivity( - activity: ControlsEditingActivity - ): Activity + abstract fun provideControlsEditingActivity(activity: ControlsEditingActivity): Activity @Binds @IntoMap @ClassKey(ControlsRequestDialog::class) - abstract fun provideControlsRequestDialog( - activity: ControlsRequestDialog - ): Activity + abstract fun provideControlsRequestDialog(activity: ControlsRequestDialog): Activity @Binds @IntoMap diff --git a/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamModule.java b/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamModule.java index f6ac7a579140..a45ad157837b 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamModule.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamModule.java @@ -38,6 +38,7 @@ import com.android.systemui.dreams.homecontrols.DreamServiceDelegateImpl; import com.android.systemui.dreams.homecontrols.HomeControlsDreamService; import com.android.systemui.qs.QsEventLogger; import com.android.systemui.qs.pipeline.shared.TileSpec; +import com.android.systemui.qs.shared.model.TileCategory; import com.android.systemui.qs.tiles.viewmodel.QSTileConfig; import com.android.systemui.qs.tiles.viewmodel.QSTilePolicy; import com.android.systemui.qs.tiles.viewmodel.QSTileUIConfig; @@ -196,6 +197,7 @@ public interface DreamModule { R.drawable.ic_qs_screen_saver, R.string.quick_settings_screensaver_label), uiEventLogger.getNewInstanceId(), + TileCategory.UTILITIES, tileSpec.getSpec(), QSTilePolicy.NoRestrictions.INSTANCE ); diff --git a/packages/SystemUI/src/com/android/systemui/qrcodescanner/dagger/QRCodeScannerModule.kt b/packages/SystemUI/src/com/android/systemui/qrcodescanner/dagger/QRCodeScannerModule.kt index 3a8fe7198ebd..ef1f8341cb15 100644 --- a/packages/SystemUI/src/com/android/systemui/qrcodescanner/dagger/QRCodeScannerModule.kt +++ b/packages/SystemUI/src/com/android/systemui/qrcodescanner/dagger/QRCodeScannerModule.kt @@ -19,6 +19,7 @@ package com.android.systemui.qrcodescanner.dagger import com.android.systemui.Flags import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.QRCodeScannerTile import com.android.systemui.qs.tiles.base.interactor.QSTileAvailabilityInteractor @@ -51,7 +52,7 @@ interface QRCodeScannerModule { @IntoMap @StringKey(QR_CODE_SCANNER_TILE_SPEC) fun provideQrCodeScannerAvailabilityInteractor( - impl: QRCodeScannerTileDataInteractor + impl: QRCodeScannerTileDataInteractor ): QSTileAvailabilityInteractor companion object { @@ -69,6 +70,7 @@ interface QRCodeScannerModule { labelRes = R.string.qr_code_scanner_title, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.UTILITIES, ) /** Inject QR Code Scanner Tile into tileViewModelMap in QSModule. */ diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/IconAndNameCustomRepository.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/IconAndNameCustomRepository.kt index 28c1fbf2007d..2f054b0a82c0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/IconAndNameCustomRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/IconAndNameCustomRepository.kt @@ -24,10 +24,10 @@ import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.qs.panels.shared.model.EditTileData import com.android.systemui.qs.pipeline.data.repository.InstalledTilesComponentRepository import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.settings.UserTracker import javax.inject.Inject import kotlin.coroutines.CoroutineContext -import kotlinx.coroutines.flow.map import kotlinx.coroutines.withContext @SysUISingleton @@ -60,6 +60,7 @@ constructor( Icon.Loaded(icon, ContentDescription.Loaded(label.toString())), Text.Loaded(label.toString()), Text.Loaded(appName.toString()), + TileCategory.PROVIDED_BY_APP, ) } else { null diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/EditTilesListInteractor.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/EditTilesListInteractor.kt index 3b29422ccfc3..a2cee3b68d49 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/EditTilesListInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/EditTilesListInteractor.kt @@ -24,6 +24,7 @@ import com.android.systemui.qs.panels.data.repository.IconAndNameCustomRepositor import com.android.systemui.qs.panels.data.repository.StockTilesRepository import com.android.systemui.qs.panels.domain.model.EditTilesModel import com.android.systemui.qs.panels.shared.model.EditTileData +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tiles.viewmodel.QSTileConfigProvider import javax.inject.Inject @@ -53,6 +54,7 @@ constructor( ), Text.Resource(config.uiConfig.labelRes), null, + category = config.category, ) } else { EditTileData( @@ -62,7 +64,8 @@ constructor( ContentDescription.Loaded(it.spec) ), Text.Loaded(it.spec), - null + null, + category = TileCategory.UNKNOWN, ) } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/shared/model/EditTileData.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/shared/model/EditTileData.kt index 8b70bb9f9e23..b153ef7e8a62 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/shared/model/EditTileData.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/shared/model/EditTileData.kt @@ -19,12 +19,14 @@ package com.android.systemui.qs.panels.shared.model import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Text import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory data class EditTileData( val tileSpec: TileSpec, val icon: Icon, val label: Text, val appName: Text?, + val category: TileCategory, ) { init { check( diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/Tile.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/Tile.kt index 79c2eb90af20..6d96f5c13238 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/Tile.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/Tile.kt @@ -34,6 +34,7 @@ import androidx.compose.animation.graphics.vector.AnimatedImageVector import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image import androidx.compose.foundation.LocalOverscrollConfiguration +import androidx.compose.foundation.background import androidx.compose.foundation.basicMarquee import androidx.compose.foundation.border import androidx.compose.foundation.combinedClickable @@ -96,6 +97,8 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.compose.ui.util.fastMap import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.compose.animation.Expandable import com.android.compose.modifiers.background @@ -116,6 +119,7 @@ import com.android.systemui.qs.panels.ui.viewmodel.TileViewModel import com.android.systemui.qs.panels.ui.viewmodel.toUiState import com.android.systemui.qs.pipeline.domain.interactor.CurrentTilesInteractor import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.groupAndSort import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.res.R import java.util.function.Supplier @@ -473,31 +477,39 @@ private fun AvailableTileGrid( onClick: (TileSpec) -> Unit, dragAndDropState: DragAndDropState, ) { - // Available tiles aren't visible during drag and drop, so the row isn't needed - val (otherTilesStock, otherTilesCustom) = - tiles.map { TileGridCell(it, 0) }.partition { it.tile.appName == null } val availableTileHeight = tileHeight(true) val availableGridHeight = gridHeight(tiles.size, availableTileHeight, columns, tilePadding) + // Available tiles aren't visible during drag and drop, so the row isn't needed + val groupedTiles = + remember(tiles.fastMap { it.tile.category }, tiles.fastMap { it.tile.label }) { + groupAndSort(tiles.fastMap { TileGridCell(it, 0) }) + } + val labelColors = TileDefaults.inactiveTileColors() // Available tiles TileLazyGrid( modifier = Modifier.height(availableGridHeight).testTag(AVAILABLE_TILES_GRID_TEST_TAG), columns = GridCells.Fixed(columns) ) { - editTiles( - otherTilesStock, - ClickAction.ADD, - onClick, - dragAndDropState = dragAndDropState, - showLabels = true, - ) - editTiles( - otherTilesCustom, - ClickAction.ADD, - onClick, - dragAndDropState = dragAndDropState, - showLabels = true, - ) + groupedTiles.forEach { category, tiles -> + stickyHeader { + Text( + text = category.label.load() ?: "", + fontSize = 20.sp, + color = labelColors.label, + modifier = + Modifier.background(Color.Black) + .padding(start = 16.dp, bottom = 8.dp, top = 8.dp) + ) + } + editTiles( + tiles, + ClickAction.ADD, + onClick, + dragAndDropState = dragAndDropState, + showLabels = true, + ) + } } } @@ -619,7 +631,7 @@ fun EditTile( showLabels: Boolean, modifier: Modifier = Modifier, ) { - val label = tileViewModel.label.load() ?: tileViewModel.tileSpec.spec + val label = tileViewModel.label.text val colors = TileDefaults.inactiveTileColors() TileContainer( @@ -639,7 +651,7 @@ fun EditTile( } else { LargeTileContent( label = label, - secondaryLabel = tileViewModel.appName?.load(), + secondaryLabel = tileViewModel.appName?.text, icon = tileViewModel.icon, colors = colors, iconShape = RoundedCornerShape(TileDefaults.InactiveCornerRadius), diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/model/TileGridCell.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/model/TileGridCell.kt index 8ca8de762772..08ee856a0ec6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/model/TileGridCell.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/model/TileGridCell.kt @@ -21,6 +21,7 @@ import androidx.compose.runtime.Immutable import com.android.systemui.qs.panels.shared.model.SizedTile import com.android.systemui.qs.panels.shared.model.splitInRowsSequence import com.android.systemui.qs.panels.ui.viewmodel.EditTileViewModel +import com.android.systemui.qs.shared.model.CategoryAndName /** Represents an item from a grid associated with a row and a span */ interface GridCell { @@ -38,7 +39,7 @@ data class TileGridCell( override val row: Int, override val width: Int, override val span: GridItemSpan = GridItemSpan(width) -) : GridCell, SizedTile { +) : GridCell, SizedTile, CategoryAndName by tile { val key: String = "${tile.tileSpec.spec}-$row" constructor( diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModel.kt index 42715be6f6c0..4a8aa83e7d4e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModel.kt @@ -16,6 +16,9 @@ package com.android.systemui.qs.panels.ui.viewmodel +import android.content.Context +import androidx.compose.ui.util.fastMap +import com.android.systemui.common.ui.domain.interactor.ConfigurationInteractor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.qs.panels.domain.interactor.EditTilesListInteractor @@ -27,6 +30,7 @@ import com.android.systemui.qs.pipeline.domain.interactor.CurrentTilesInteractor import com.android.systemui.qs.pipeline.domain.interactor.CurrentTilesInteractor.Companion.POSITION_AT_END import com.android.systemui.qs.pipeline.domain.interactor.MinimumTilesInteractor import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.util.kotlin.emitOnStart import javax.inject.Inject import javax.inject.Named import kotlinx.coroutines.CoroutineScope @@ -35,6 +39,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.map @@ -49,6 +54,8 @@ constructor( private val currentTilesInteractor: CurrentTilesInteractor, private val tilesAvailabilityInteractor: TilesAvailabilityInteractor, private val minTilesInteractor: MinimumTilesInteractor, + private val configurationInteractor: ConfigurationInteractor, + @Application private val applicationContext: Context, @Named("Default") private val defaultGridLayout: GridLayout, @Application private val applicationScope: CoroutineScope, gridLayoutTypeInteractor: GridLayoutTypeInteractor, @@ -99,38 +106,45 @@ constructor( .map { it.tileSpec } .minus(currentTilesInteractor.currentTilesSpecs.toSet()) ) - currentTilesInteractor.currentTiles.map { tiles -> - val currentSpecs = tiles.map { it.spec } - val canRemoveTiles = currentSpecs.size > minimumTiles - val allTiles = editTilesData.stockTiles + editTilesData.customTiles - val allTilesMap = allTiles.associate { it.tileSpec to it } - val currentTiles = currentSpecs.map { allTilesMap.get(it) }.filterNotNull() - val nonCurrentTiles = allTiles.filter { it.tileSpec !in currentSpecs } - - (currentTiles + nonCurrentTiles) - .filterNot { it.tileSpec in unavailable } - .map { - val current = it.tileSpec in currentSpecs - val availableActions = buildSet { - if (current) { - add(AvailableEditActions.MOVE) - if (canRemoveTiles) { - add(AvailableEditActions.REMOVE) + currentTilesInteractor.currentTiles + .map { tiles -> + val currentSpecs = tiles.map { it.spec } + val canRemoveTiles = currentSpecs.size > minimumTiles + val allTiles = editTilesData.stockTiles + editTilesData.customTiles + val allTilesMap = allTiles.associate { it.tileSpec to it } + val currentTiles = currentSpecs.map { allTilesMap.get(it) }.filterNotNull() + val nonCurrentTiles = allTiles.filter { it.tileSpec !in currentSpecs } + + (currentTiles + nonCurrentTiles) + .filterNot { it.tileSpec in unavailable } + .map { + val current = it.tileSpec in currentSpecs + val availableActions = buildSet { + if (current) { + add(AvailableEditActions.MOVE) + if (canRemoveTiles) { + add(AvailableEditActions.REMOVE) + } + } else { + add(AvailableEditActions.ADD) } - } else { - add(AvailableEditActions.ADD) } + UnloadedEditTileViewModel( + it.tileSpec, + it.icon, + it.label, + it.appName, + current, + availableActions, + it.category, + ) } - EditTileViewModel( - it.tileSpec, - it.icon, - it.label, - it.appName, - current, - availableActions - ) - } - } + } + .combine(configurationInteractor.onAnyConfigurationChange.emitOnStart()) { + tiles, + _ -> + tiles.fastMap { it.load(applicationContext) } + } } else { emptyFlow() } diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/EditTileViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/EditTileViewModel.kt index a4c86381b785..ee12736f6db4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/EditTileViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/EditTileViewModel.kt @@ -16,9 +16,15 @@ package com.android.systemui.qs.panels.ui.viewmodel +import android.content.Context +import androidx.compose.runtime.Immutable +import androidx.compose.ui.text.AnnotatedString import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Text +import com.android.systemui.common.ui.compose.toAnnotatedString import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.CategoryAndName +import com.android.systemui.qs.shared.model.TileCategory /** * View model for each tile that is available to be added/removed/moved in Edit mode. @@ -26,14 +32,41 @@ import com.android.systemui.qs.pipeline.shared.TileSpec * [isCurrent] indicates whether this tile is part of the current set of tiles that the user sees in * Quick Settings. */ -data class EditTileViewModel( +data class UnloadedEditTileViewModel( val tileSpec: TileSpec, val icon: Icon, val label: Text, val appName: Text?, val isCurrent: Boolean, val availableEditActions: Set, -) + val category: TileCategory, +) { + fun load(context: Context): EditTileViewModel { + return EditTileViewModel( + tileSpec, + icon, + label.toAnnotatedString(context) ?: AnnotatedString(tileSpec.spec), + appName?.toAnnotatedString(context), + isCurrent, + availableEditActions, + category, + ) + } +} + +@Immutable +data class EditTileViewModel( + val tileSpec: TileSpec, + val icon: Icon, + val label: AnnotatedString, + val appName: AnnotatedString?, + val isCurrent: Boolean, + val availableEditActions: Set, + override val category: TileCategory, +) : CategoryAndName { + override val name + get() = label.text +} enum class AvailableEditActions { ADD, diff --git a/packages/SystemUI/src/com/android/systemui/qs/shared/model/TileCategory.kt b/packages/SystemUI/src/com/android/systemui/qs/shared/model/TileCategory.kt new file mode 100644 index 000000000000..59cb7d3d5345 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/qs/shared/model/TileCategory.kt @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.qs.shared.model + +import com.android.systemui.common.shared.model.Text +import com.android.systemui.res.R + +/** Categories for tiles. This can be used to sort tiles in edit mode. */ +enum class TileCategory(val label: Text) { + CONNECTIVITY(Text.Resource(R.string.qs_edit_mode_category_connectivity)), + UTILITIES(Text.Resource(R.string.qs_edit_mode_category_utilities)), + DISPLAY(Text.Resource(R.string.qs_edit_mode_category_display)), + PRIVACY(Text.Resource(R.string.qs_edit_mode_category_privacy)), + ACCESSIBILITY(Text.Resource(R.string.qs_edit_mode_category_accessibility)), + PROVIDED_BY_APP(Text.Resource(R.string.qs_edit_mode_category_providedByApps)), + UNKNOWN(Text.Resource(R.string.qs_edit_mode_category_unknown)), +} + +interface CategoryAndName { + val category: TileCategory + val name: String +} + +/** + * Groups the elements of the list by [CategoryAndName.category] (with the keys sorted in the + * natural order of [TileCategory]), and sorts the elements of each group based on the + * [CategoryAndName.name]. + */ +fun groupAndSort(list: List): Map> { + val groupedByCategory = list.groupBy { it.category }.toSortedMap() + return groupedByCategory.mapValues { it.value.sortedBy { it.name } } +} diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfig.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfig.kt index cdcefdb50b0f..3a9cb170040c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfig.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfig.kt @@ -21,6 +21,7 @@ import androidx.annotation.DrawableRes import androidx.annotation.StringRes import com.android.internal.logging.InstanceId import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory data class QSTileConfig @JvmOverloads @@ -28,6 +29,7 @@ constructor( val tileSpec: TileSpec, val uiConfig: QSTileUIConfig, val instanceId: InstanceId, + val category: TileCategory, val metricsSpec: String = tileSpec.spec, val policy: QSTilePolicy = QSTilePolicy.NoRestrictions, val autoRemoveOnUnavailable: Boolean = true, diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfigProvider.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfigProvider.kt index 0609e797d53b..4dbddd91092a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfigProvider.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfigProvider.kt @@ -20,6 +20,7 @@ import com.android.internal.util.Preconditions import com.android.systemui.dagger.SysUISingleton import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import javax.inject.Inject interface QSTileConfigProvider { @@ -73,6 +74,7 @@ constructor( spec, QSTileUIConfig.Empty, qsEventLogger.getNewInstanceId(), + category = TileCategory.PROVIDED_BY_APP, ) is TileSpec.Invalid -> throw IllegalArgumentException("TileSpec.Invalid doesn't support configs") diff --git a/packages/SystemUI/src/com/android/systemui/recordissue/RecordIssueModule.kt b/packages/SystemUI/src/com/android/systemui/recordissue/RecordIssueModule.kt index 907b92ce4c9b..c092c2f86799 100644 --- a/packages/SystemUI/src/com/android/systemui/recordissue/RecordIssueModule.kt +++ b/packages/SystemUI/src/com/android/systemui/recordissue/RecordIssueModule.kt @@ -19,6 +19,7 @@ package com.android.systemui.recordissue import com.android.systemui.Flags import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.RecordIssueTile import com.android.systemui.qs.tiles.base.viewmodel.QSTileViewModelFactory @@ -61,6 +62,7 @@ interface RecordIssueModule { labelRes = R.string.qs_record_issue_label ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.UTILITIES, ) /** Inject FlashlightTile into tileViewModelMap in QSModule */ diff --git a/packages/SystemUI/src/com/android/systemui/rotationlock/RotationLockNewModule.kt b/packages/SystemUI/src/com/android/systemui/rotationlock/RotationLockNewModule.kt index 0589e6c63931..c9712fcdaa27 100644 --- a/packages/SystemUI/src/com/android/systemui/rotationlock/RotationLockNewModule.kt +++ b/packages/SystemUI/src/com/android/systemui/rotationlock/RotationLockNewModule.kt @@ -19,6 +19,7 @@ package com.android.systemui.rotationlock import com.android.systemui.camera.CameraRotationModule import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tiles.base.interactor.QSTileAvailabilityInteractor import com.android.systemui.qs.tiles.base.viewmodel.QSTileViewModelFactory import com.android.systemui.qs.tiles.impl.rotation.domain.interactor.RotationLockTileDataInteractor @@ -42,8 +43,9 @@ interface RotationLockNewModule { @IntoMap @StringKey(ROTATION_TILE_SPEC) fun provideRotationAvailabilityInteractor( - impl: RotationLockTileDataInteractor + impl: RotationLockTileDataInteractor ): QSTileAvailabilityInteractor + companion object { private const val ROTATION_TILE_SPEC = "rotation" @@ -60,6 +62,7 @@ interface RotationLockNewModule { labelRes = R.string.quick_settings_rotation_unlocked_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.DISPLAY, ) /** Inject Rotation tile into tileViewModelMap in QSModule */ diff --git a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordModule.kt b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordModule.kt index a830e1bbfe72..9a9c576c5af6 100644 --- a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordModule.kt +++ b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordModule.kt @@ -21,6 +21,7 @@ import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBufferFactory import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.ScreenRecordTile import com.android.systemui.qs.tiles.base.interactor.QSTileAvailabilityInteractor @@ -74,6 +75,7 @@ interface ScreenRecordModule { labelRes = R.string.quick_settings_screen_record_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.DISPLAY, ) /** Inject ScreenRecord Tile into tileViewModelMap in QSModule */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/ConnectivityModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/ConnectivityModule.kt index 400f8af99e07..dac01028ef64 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/ConnectivityModule.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/ConnectivityModule.kt @@ -21,6 +21,7 @@ import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags.SIGNAL_CALLBACK_DEPRECATION import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.AirplaneModeTile import com.android.systemui.qs.tiles.BluetoothTile @@ -95,21 +96,21 @@ interface ConnectivityModule { @IntoMap @StringKey(AIRPLANE_MODE_TILE_SPEC) fun provideAirplaneModeAvailabilityInteractor( - impl: AirplaneModeTileDataInteractor + impl: AirplaneModeTileDataInteractor ): QSTileAvailabilityInteractor @Binds @IntoMap @StringKey(DATA_SAVER_TILE_SPEC) fun provideDataSaverAvailabilityInteractor( - impl: DataSaverTileDataInteractor + impl: DataSaverTileDataInteractor ): QSTileAvailabilityInteractor @Binds @IntoMap @StringKey(INTERNET_TILE_SPEC) fun provideInternetAvailabilityInteractor( - impl: InternetTileDataInteractor + impl: InternetTileDataInteractor ): QSTileAvailabilityInteractor companion object { @@ -149,6 +150,7 @@ interface ConnectivityModule { ), instanceId = uiEventLogger.getNewInstanceId(), policy = QSTilePolicy.Restricted(listOf(UserManager.DISALLOW_AIRPLANE_MODE)), + category = TileCategory.CONNECTIVITY, ) /** Inject AirplaneModeTile into tileViewModelMap in QSModule */ @@ -180,6 +182,7 @@ interface ConnectivityModule { labelRes = R.string.data_saver, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.CONNECTIVITY, ) /** Inject DataSaverTile into tileViewModelMap in QSModule */ @@ -211,6 +214,7 @@ interface ConnectivityModule { labelRes = R.string.quick_settings_internet_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.CONNECTIVITY, ) /** Inject InternetTile into tileViewModelMap in QSModule */ @@ -242,6 +246,7 @@ interface ConnectivityModule { labelRes = R.string.quick_settings_hotspot_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.CONNECTIVITY, ) @Provides @@ -256,6 +261,7 @@ interface ConnectivityModule { labelRes = R.string.quick_settings_cast_title, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.CONNECTIVITY, ) @Provides @@ -270,6 +276,7 @@ interface ConnectivityModule { labelRes = R.string.quick_settings_bluetooth_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.CONNECTIVITY, ) } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt index 21ec14fc7f03..5ff77e7ab24f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt @@ -23,6 +23,7 @@ import android.os.UserManager.DISALLOW_SHARE_LOCATION import com.android.systemui.Flags import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.AlarmTile import com.android.systemui.qs.tiles.CameraToggleTile @@ -157,6 +158,7 @@ interface PolicyModule { labelRes = R.string.quick_settings_flashlight_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.UTILITIES, ) /** Inject FlashlightTile into tileViewModelMap in QSModule */ @@ -192,7 +194,8 @@ interface PolicyModule { policy = QSTilePolicy.Restricted( listOf(DISALLOW_SHARE_LOCATION, DISALLOW_CONFIG_LOCATION) - ) + ), + category = TileCategory.PRIVACY, ) /** Inject LocationTile into tileViewModelMap in QSModule */ @@ -225,6 +228,7 @@ interface PolicyModule { labelRes = R.string.status_bar_alarm, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.UTILITIES, ) /** Inject AlarmTile into tileViewModelMap in QSModule */ @@ -257,6 +261,7 @@ interface PolicyModule { labelRes = R.string.quick_settings_ui_mode_night_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.DISPLAY, ) /** Inject uimodenight into tileViewModelMap in QSModule */ @@ -290,6 +295,7 @@ interface PolicyModule { ), instanceId = uiEventLogger.getNewInstanceId(), autoRemoveOnUnavailable = false, + category = TileCategory.PRIVACY, ) /** Inject work mode into tileViewModelMap in QSModule */ @@ -323,6 +329,7 @@ interface PolicyModule { ), instanceId = uiEventLogger.getNewInstanceId(), policy = QSTilePolicy.Restricted(listOf(DISALLOW_CAMERA_TOGGLE)), + category = TileCategory.PRIVACY, ) /** Inject camera toggle tile into tileViewModelMap in QSModule */ @@ -365,6 +372,7 @@ interface PolicyModule { ), instanceId = uiEventLogger.getNewInstanceId(), policy = QSTilePolicy.Restricted(listOf(DISALLOW_MICROPHONE_TOGGLE)), + category = TileCategory.PRIVACY, ) /** Inject microphone toggle tile into tileViewModelMap in QSModule */ @@ -407,6 +415,7 @@ interface PolicyModule { labelRes = R.string.quick_settings_modes_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.CONNECTIVITY, ) } else { QSTileConfig( @@ -417,6 +426,7 @@ interface PolicyModule { labelRes = R.string.quick_settings_dnd_label, ), instanceId = uiEventLogger.getNewInstanceId(), + category = TileCategory.CONNECTIVITY, ) } diff --git a/packages/SystemUI/src/com/android/systemui/wallet/dagger/WalletModule.java b/packages/SystemUI/src/com/android/systemui/wallet/dagger/WalletModule.java index ea213cba9567..dd1c11d11d1e 100644 --- a/packages/SystemUI/src/com/android/systemui/wallet/dagger/WalletModule.java +++ b/packages/SystemUI/src/com/android/systemui/wallet/dagger/WalletModule.java @@ -25,6 +25,7 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.qs.QsEventLogger; import com.android.systemui.qs.pipeline.shared.TileSpec; +import com.android.systemui.qs.shared.model.TileCategory; import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.qs.tiles.QuickAccessWalletTile; import com.android.systemui.qs.tiles.viewmodel.QSTileConfig; @@ -34,8 +35,6 @@ import com.android.systemui.res.R; import com.android.systemui.wallet.controller.WalletContextualLocationsService; import com.android.systemui.wallet.ui.WalletActivity; -import java.util.concurrent.Executor; - import dagger.Binds; import dagger.Module; import dagger.Provides; @@ -43,6 +42,8 @@ import dagger.multibindings.ClassKey; import dagger.multibindings.IntoMap; import dagger.multibindings.StringKey; +import java.util.concurrent.Executor; + /** * Module for injecting classes in Wallet. */ @@ -90,6 +91,7 @@ public abstract class WalletModule { R.string.wallet_title ), uiEventLogger.getNewInstanceId(), + TileCategory.UTILITIES, tileSpec.getSpec(), QSTilePolicy.NoRestrictions.INSTANCE ); diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/panels/ui/compose/DragAndDropTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/panels/ui/compose/DragAndDropTest.kt index d9faa30cb072..70af5e75105d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/panels/ui/compose/DragAndDropTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/panels/ui/compose/DragAndDropTest.kt @@ -31,17 +31,18 @@ import androidx.compose.ui.test.onChildren import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.onNodeWithText +import androidx.compose.ui.text.AnnotatedString import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.FlakyTest import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.Icon -import com.android.systemui.common.shared.model.Text import com.android.systemui.qs.panels.shared.model.SizedTile import com.android.systemui.qs.panels.shared.model.SizedTileImpl import com.android.systemui.qs.panels.ui.viewmodel.EditTileViewModel import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -199,10 +200,11 @@ class DragAndDropTest : SysuiTestCase() { android.R.drawable.star_on, ContentDescription.Loaded(tileSpec) ), - label = Text.Loaded(tileSpec), + label = AnnotatedString(tileSpec), appName = null, isCurrent = true, availableEditActions = emptySet(), + category = TileCategory.UNKNOWN, ), getWidth(tileSpec), ) diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModelKosmos.kt index b03542cb569e..33227a4fcc62 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/EditModeViewModelKosmos.kt @@ -16,6 +16,8 @@ package com.android.systemui.qs.panels.ui.viewmodel +import android.content.applicationContext +import com.android.systemui.common.ui.domain.interactor.configurationInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.qs.panels.domain.interactor.editTilesListInteractor @@ -33,6 +35,8 @@ val Kosmos.editModeViewModel by currentTilesInteractor, tilesAvailabilityInteractor, minimumTilesInteractor, + configurationInteractor, + applicationContext, infiniteGridLayout, applicationCoroutineScope, gridLayoutTypeInteractor, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt index dceb8bff0ae7..f66125a6087e 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt @@ -20,6 +20,7 @@ import android.os.UserHandle import com.android.systemui.kosmos.Kosmos import com.android.systemui.qs.instanceIdSequenceFake import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory import com.android.systemui.qs.tiles.base.viewmodel.QSTileViewModelFactory import com.android.systemui.qs.tiles.viewmodel.QSTileConfig import com.android.systemui.qs.tiles.viewmodel.QSTileState @@ -47,6 +48,7 @@ val Kosmos.customTileViewModelFactory: QSTileViewModelFactory.Component by tileSpec, QSTileUIConfig.Empty, instanceIdSequenceFake.newInstanceId(), + category = TileCategory.PROVIDED_BY_APP, ) object : QSTileViewModel { override val state: StateFlow = diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfigTestBuilder.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfigTestBuilder.kt index 2a0ee888db35..73d9b3233375 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfigTestBuilder.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/viewmodel/QSTileConfigTestBuilder.kt @@ -18,6 +18,7 @@ package com.android.systemui.qs.tiles.viewmodel import com.android.internal.logging.InstanceId import com.android.systemui.qs.pipeline.shared.TileSpec +import com.android.systemui.qs.shared.model.TileCategory object QSTileConfigTestBuilder { @@ -30,12 +31,14 @@ object QSTileConfigTestBuilder { var instanceId: InstanceId = InstanceId.fakeInstanceId(0) var metricsSpec: String = tileSpec.spec var policy: QSTilePolicy = QSTilePolicy.NoRestrictions + var category: TileCategory = TileCategory.UNKNOWN fun build() = QSTileConfig( tileSpec, uiConfig, instanceId, + category, metricsSpec, policy, ) -- GitLab From ac58356c811f8d40fa348f31e0f614d15bb0c8a0 Mon Sep 17 00:00:00 2001 From: Juan Sebastian Martinez Date: Mon, 9 Sep 2024 10:36:39 -0700 Subject: [PATCH 133/492] Change to MSDLModule to use the new MSDLPlayer creator function. The MSDLPlayer now receives the Vibrator directly. Test: presubmit Flag: NONE usage of this API is flagged elsewhere. Bug: 344654090 Change-Id: Ifccc2ececd9288ba3a7cfc1a75d681f1275d743a --- .../android/systemui/haptics/msdl/dagger/MSDLModule.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/haptics/msdl/dagger/MSDLModule.kt b/packages/SystemUI/src/com/android/systemui/haptics/msdl/dagger/MSDLModule.kt index 5ea96b8388bb..d2dc8c1e8328 100644 --- a/packages/SystemUI/src/com/android/systemui/haptics/msdl/dagger/MSDLModule.kt +++ b/packages/SystemUI/src/com/android/systemui/haptics/msdl/dagger/MSDLModule.kt @@ -16,7 +16,9 @@ package com.android.systemui.haptics.msdl.dagger +import android.annotation.SuppressLint import android.content.Context +import android.os.VibratorManager import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.google.android.msdl.domain.MSDLPlayer @@ -25,8 +27,12 @@ import dagger.Provides @Module object MSDLModule { + @SuppressLint("NonInjectedService") @Provides @SysUISingleton - fun provideMSDLPlayer(@Application context: Context): MSDLPlayer = - MSDLPlayer.createPlayer(context) + fun provideMSDLPlayer(@Application context: Context): MSDLPlayer { + val vibratorManager = + context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager + return MSDLPlayer.createPlayer(vibratorManager.defaultVibrator) + } } -- GitLab From a6d1015bd2a7635271c3a091696364dd8b90bc12 Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Wed, 28 Aug 2024 15:33:55 -0700 Subject: [PATCH 134/492] Inform freezable state observers if freezing is cancelled. Bug: 358267550 Test: manual Flag: EXEMPT bugfix Change-Id: I4bcabf78ab2dc97a94cb5b5b4a96028391eb0a6e --- .../core/java/com/android/server/am/CachedAppOptimizer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/CachedAppOptimizer.java b/services/core/java/com/android/server/am/CachedAppOptimizer.java index 8f52f67ff7e0..416c11090515 100644 --- a/services/core/java/com/android/server/am/CachedAppOptimizer.java +++ b/services/core/java/com/android/server/am/CachedAppOptimizer.java @@ -86,7 +86,6 @@ import com.android.server.ServiceThread; import dalvik.annotation.optimization.NeverCompile; -import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.lang.annotation.Retention; @@ -2318,6 +2317,7 @@ public final class CachedAppOptimizer { Slog.d(TAG_AM, "Skipping freeze because process is marked " + "should not be frozen"); } + reportProcessFreezableChangedLocked(proc); return; } -- GitLab From 6b2f4337738e669837a27213859c71eff2366cc0 Mon Sep 17 00:00:00 2001 From: Alex Stetson Date: Mon, 9 Sep 2024 11:19:21 -0700 Subject: [PATCH 135/492] Ensure DisplayTracker callback is not GC Bug: 362696244 Test: build Flag: NONE bugfix Change-Id: I124563b1a4d8a147d0e4570650e88c5aa2c2c8aa --- .../systemui/statusbar/CommandQueue.java | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index f88fd7d00a2b..862f33bb4ec3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -63,6 +63,7 @@ import android.view.accessibility.Flags; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; +import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.os.SomeArgs; import com.android.internal.statusbar.IAddTileResultCallback; import com.android.internal.statusbar.IStatusBar; @@ -192,10 +193,10 @@ public class CommandQueue extends IStatusBar.Stub implements private static final String SHOW_IME_SWITCHER_KEY = "showImeSwitcherKey"; private final Object mLock = new Object(); - private ArrayList mCallbacks = new ArrayList<>(); - private Handler mHandler = new H(Looper.getMainLooper()); + private final ArrayList mCallbacks = new ArrayList<>(); + private final Handler mHandler = new H(Looper.getMainLooper()); /** A map of display id - disable flag pair */ - private SparseArray> mDisplayDisabled = new SparseArray<>(); + private final SparseArray> mDisplayDisabled = new SparseArray<>(); /** * The last ID of the display where IME window for which we received setImeWindowStatus * event. @@ -207,6 +208,21 @@ public class CommandQueue extends IStatusBar.Stub implements private final @Nullable DumpHandler mDumpHandler; private final @Nullable Lazy mPowerInteractor; + @KeepForWeakReference + private final DisplayTracker.Callback mDisplayTrackerCallback = new DisplayTracker.Callback() { + @Override + public void onDisplayRemoved(int displayId) { + synchronized (mLock) { + mDisplayDisabled.remove(displayId); + } + // This callback is registered with {@link #mHandler} that already posts to run on + // main thread, so it is safe to dispatch directly. + for (int i = mCallbacks.size() - 1; i >= 0; i--) { + mCallbacks.get(i).onDisplayRemoved(displayId); + } + } + }; + /** * These methods are called back on the main thread. */ @@ -576,19 +592,8 @@ public class CommandQueue extends IStatusBar.Stub implements mDisplayTracker = displayTracker; mRegistry = registry; mDumpHandler = dumpHandler; - mDisplayTracker.addDisplayChangeCallback(new DisplayTracker.Callback() { - @Override - public void onDisplayRemoved(int displayId) { - synchronized (mLock) { - mDisplayDisabled.remove(displayId); - } - // This callback is registered with {@link #mHandler} that already posts to run on - // main thread, so it is safe to dispatch directly. - for (int i = mCallbacks.size() - 1; i >= 0; i--) { - mCallbacks.get(i).onDisplayRemoved(displayId); - } - } - }, new HandlerExecutor(mHandler)); + mDisplayTracker.addDisplayChangeCallback(mDisplayTrackerCallback, + new HandlerExecutor(mHandler)); // We always have default display. setDisabled(mDisplayTracker.getDefaultDisplayId(), DISABLE_NONE, DISABLE2_NONE); mPowerInteractor = powerInteractor; -- GitLab From f89021a2428c539b170da76a9f8ccf79309db8e0 Mon Sep 17 00:00:00 2001 From: Eiji Date: Mon, 9 Sep 2024 18:22:09 +0000 Subject: [PATCH 136/492] HDMI: Fix broadcast vendor command handling error HDMI CEC spec allows broadcasted but it is always ignored regardless of listener registration. Fix to allow broadcasted and ignore it only when there is no listener registration. Bug: 364774754 Test: atest com.android.server.hdmi Merged-In: Ica6a40bf99a30179344ab51e1f1db5e2456abc82 Change-Id: Ica6a40bf99a30179344ab51e1f1db5e2456abc82 --- .../server/hdmi/HdmiCecLocalDevice.java | 12 ++++++---- .../server/hdmi/HdmiCecLocalDeviceTest.java | 24 ++++++++++++++----- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java index 81204ef5d7ed..a8d5696e8c77 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java @@ -927,12 +927,14 @@ abstract class HdmiCecLocalDevice extends HdmiLocalDevice { protected int handleVendorCommandWithId(HdmiCecMessage message) { byte[] params = message.getParams(); int vendorId = HdmiUtils.threeBytesToInt(params); - if (message.getDestination() == Constants.ADDR_BROADCAST - || message.getSource() == Constants.ADDR_UNREGISTERED) { - Slog.v(TAG, "Wrong broadcast vendor command. Ignoring"); - } else if (!mService.invokeVendorCommandListenersOnReceived( + if (!mService.invokeVendorCommandListenersOnReceived( mDeviceType, message.getSource(), message.getDestination(), params, true)) { - return Constants.ABORT_REFUSED; + if (message.getDestination() == Constants.ADDR_BROADCAST + || message.getSource() == Constants.ADDR_UNREGISTERED) { + Slog.v(TAG, "Broadcast vendor command with no listeners. Ignoring"); + } else { + return Constants.ABORT_REFUSED; + } } return Constants.HANDLED; } diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTest.java index 3dd83125619a..44fc387db3d6 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTest.java @@ -19,6 +19,7 @@ import static android.hardware.hdmi.HdmiDeviceInfo.DEVICE_TV; import static com.android.server.SystemService.PHASE_SYSTEM_SERVICES_READY; import static com.android.server.hdmi.Constants.ADDR_AUDIO_SYSTEM; +import static com.android.server.hdmi.Constants.ADDR_BROADCAST; import static com.android.server.hdmi.Constants.ADDR_PLAYBACK_1; import static com.android.server.hdmi.Constants.ADDR_TV; import static com.android.server.hdmi.Constants.MESSAGE_DEVICE_VENDOR_ID; @@ -520,21 +521,32 @@ public class HdmiCecLocalDeviceTest { public void handleVendorCommand_notHandled() { HdmiCecMessage vendorCommand = HdmiCecMessageBuilder.buildVendorCommand(ADDR_TV, ADDR_PLAYBACK_1, new byte[]{0}); - mNativeWrapper.onCecMessage(vendorCommand); + @Constants.HandleMessageResult int result = + mHdmiLocalDevice.handleVendorCommand(vendorCommand); mTestLooper.dispatchAll(); - HdmiCecMessageBuilder.buildFeatureAbortCommand(ADDR_PLAYBACK_1, ADDR_TV, - vendorCommand.getOpcode(), Constants.ABORT_REFUSED); + assertEquals(Constants.ABORT_REFUSED, result); } @Test public void handleVendorCommandWithId_notHandled_Cec14() { HdmiCecMessage vendorCommand = HdmiCecMessageBuilder.buildVendorCommandWithId(ADDR_TV, ADDR_PLAYBACK_1, 0x1234, new byte[]{0}); - mNativeWrapper.onCecMessage(vendorCommand); + @Constants.HandleMessageResult int result = + mHdmiLocalDevice.handleVendorCommandWithId(vendorCommand); mTestLooper.dispatchAll(); - HdmiCecMessageBuilder.buildFeatureAbortCommand(ADDR_PLAYBACK_1, ADDR_TV, - vendorCommand.getOpcode(), Constants.ABORT_REFUSED); + assertEquals(Constants.ABORT_REFUSED, result); + } + + @Test + public void handleVendorCommandWithId_broadcasted_handled() { + HdmiCecMessage vendorCommand = HdmiCecMessageBuilder.buildVendorCommandWithId(ADDR_TV, + ADDR_BROADCAST, 0x1234, new byte[]{0}); + @Constants.HandleMessageResult int result = + mHdmiLocalDevice.handleVendorCommandWithId(vendorCommand); + mTestLooper.dispatchAll(); + + assertEquals(Constants.HANDLED, result); } } -- GitLab From d4191de327f729e466b78be80a98b74b7f9401bc Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Mon, 9 Sep 2024 15:10:31 -0400 Subject: [PATCH 137/492] Set screenshot action button tint mode to src_in Bug: 365588264 Fix: 365588264 Flag: EXEMPT trivial change Test: manual (icon colors in light/dark theme) Change-Id: Ica88c3c8e4e51068e1e04461919ebe8a4c0e2240 --- packages/SystemUI/res/layout/shelf_action_chip.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/SystemUI/res/layout/shelf_action_chip.xml b/packages/SystemUI/res/layout/shelf_action_chip.xml index c7606e404215..1c65e366d619 100644 --- a/packages/SystemUI/res/layout/shelf_action_chip.xml +++ b/packages/SystemUI/res/layout/shelf_action_chip.xml @@ -28,6 +28,7 @@ Date: Wed, 4 Sep 2024 14:40:42 -0700 Subject: [PATCH 138/492] [pm/archive] allow preinstalled launcher apps to unarchive even if they are not default BUG: 360170618 Test: manually by b&r with pre-archive with multiple launchers and observe that the apps can be unarchived without the error message. FLAG: EXEMPT bug fix Change-Id: Ib6550603cde07f60e1957860ac6997de966052f3 --- .../android/server/pm/PackageArchiver.java | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageArchiver.java b/services/core/java/com/android/server/pm/PackageArchiver.java index 5e45b4c2d5af..4796b0a09dfe 100644 --- a/services/core/java/com/android/server/pm/PackageArchiver.java +++ b/services/core/java/com/android/server/pm/PackageArchiver.java @@ -283,10 +283,7 @@ public class PackageArchiver { return START_CLASS_NOT_FOUND; } - String currentLauncherPackageName = getCurrentLauncherPackageName(getParentUserId(userId)); - if ((currentLauncherPackageName == null || !TextUtils.equals(callerPackageName, - currentLauncherPackageName)) && callingUid != Process.SHELL_UID) { - // TODO(b/311619990): Remove dependency on SHELL_UID for testing + if (!isCallerQualifiedForUnarchival(callerPackageName, callingUid, userId)) { Slog.e(TAG, TextUtils.formatSimple( "callerPackageName: %s does not qualify for unarchival of package: " + "%s!", callerPackageName, packageName)); @@ -335,6 +332,37 @@ public class PackageArchiver { return START_ABORTED; } + private boolean isCallerQualifiedForUnarchival(String callerPackageName, int callingUid, + int userId) { + // TODO(b/311619990): Remove dependency on SHELL_UID for testing + if (callingUid == Process.SHELL_UID) { + return true; + } + String currentLauncherPackageName = getCurrentLauncherPackageName(getParentUserId(userId)); + if (currentLauncherPackageName != null && TextUtils.equals( + callerPackageName, currentLauncherPackageName)) { + return true; + } + Slog.w(TAG, TextUtils.formatSimple( + "Requester of unarchival: %s is not the default launcher package: %s.", + callerPackageName, currentLauncherPackageName)); + // When the default launcher is not set, or when the current caller is not the default + // launcher, allow the caller to directly request unarchive if it is a launcher app + // that is a pre-installed system app. + final Computer snapshot = mPm.snapshotComputer(); + final PackageStateInternal ps = snapshot.getPackageStateInternal(callerPackageName); + final boolean isSystem = ps != null && ps.isSystem(); + return isSystem && isLauncherApp(snapshot, callerPackageName, userId); + } + + private boolean isLauncherApp(Computer snapshot, String packageName, int userId) { + final Intent intent = snapshot.getHomeIntent(); + intent.setPackage(packageName); + List launcherActivities = snapshot.queryIntentActivitiesInternal( + intent, null /* resolvedType */, 0 /* flags */, userId); + return !launcherActivities.isEmpty(); + } + // Profiles share their UI and default apps, so we have to get the profile parent before // fetching the default launcher. private int getParentUserId(int userId) { -- GitLab From 1a5478a70933cb1fc04fb16dc42b76da6dbf4d38 Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Thu, 5 Sep 2024 16:36:50 +0000 Subject: [PATCH 139/492] [SB][Wifi] More protection against invalid values from WifiTrackerLib. This change creates new factory methods for WifiNetworkModel.Active and WifiNetworkModel.CarrierMerged that will ensure the parameters are valid before creating the object. This means that WifiRepositoryImpl doesn't need to save the level or subscription ID to local variables. Most of the diffs in this change is converting all WifiNetworkModel clients to use the factory method instead of the normal constructor (the normal constructor is now private). Bug: 362384551 Flag: EXEMPT bugfix Test: atest WifiRepositoryImplTest Change-Id: Id295c2ecb15bc7a1931661b887a25ca4dd993927 --- .../InternetTileDataInteractorTest.kt | 10 +- .../interactor/WifiInteractorImplTest.kt | 18 +-- .../wifi/ui/viewmodel/WifiViewModelTest.kt | 10 +- .../wifi/data/repository/WifiRepository.kt | 3 - .../repository/demo/DemoWifiRepository.kt | 8 +- .../repository/prod/WifiRepositoryImpl.kt | 59 +++---- .../wifi/shared/model/WifiNetworkModel.kt | 150 ++++++++++++++---- .../keyguard/CarrierTextManagerTest.java | 2 +- .../qs/tiles/InternetTileNewImplTest.kt | 2 +- .../CarrierMergedConnectionRepositoryTest.kt | 18 +-- .../FullMobileConnectionRepositoryTest.kt | 12 +- .../DeviceBasedSatelliteInteractorTest.kt | 2 +- .../DeviceBasedSatelliteViewModelTest.kt | 4 +- .../ui/viewmodel/InternetTileViewModelTest.kt | 10 +- .../repository/prod/WifiRepositoryImplTest.kt | 38 ++++- .../wifi/shared/model/WifiNetworkModelTest.kt | 116 ++++++++++---- .../ui/view/ModernStatusBarWifiViewTest.kt | 4 +- .../WifiViewModelIconParameterizedTest.kt | 42 ++--- .../data/repository/FakeWifiRepository.kt | 2 +- 19 files changed, 331 insertions(+), 179 deletions(-) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/interactor/InternetTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/interactor/InternetTileDataInteractorTest.kt index 8e61c849179d..82b26db54693 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/interactor/InternetTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/interactor/InternetTileDataInteractorTest.kt @@ -184,7 +184,7 @@ class InternetTileDataInteractorTest : SysuiTestCase() { ) val networkModel = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = 4, ssid = "test ssid", ) @@ -219,7 +219,7 @@ class InternetTileDataInteractorTest : SysuiTestCase() { ) val networkModel = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = 4, ssid = "test ssid", hotspotDeviceType = WifiNetworkModel.HotspotDeviceType.NONE, @@ -398,7 +398,7 @@ class InternetTileDataInteractorTest : SysuiTestCase() { collectLastValue( underTest.tileData(testUser, flowOf(DataUpdateTrigger.InitialRequest)) ) - val networkModel = WifiNetworkModel.Inactive + val networkModel = WifiNetworkModel.Inactive() connectivityRepository.setWifiConnected(validated = false) wifiRepository.setIsWifiDefault(true) @@ -416,7 +416,7 @@ class InternetTileDataInteractorTest : SysuiTestCase() { underTest.tileData(testUser, flowOf(DataUpdateTrigger.InitialRequest)) ) - val networkModel = WifiNetworkModel.Inactive + val networkModel = WifiNetworkModel.Inactive() connectivityRepository.setWifiConnected(validated = false) wifiRepository.setIsWifiDefault(true) @@ -543,7 +543,7 @@ class InternetTileDataInteractorTest : SysuiTestCase() { private fun setWifiNetworkWithHotspot(hotspot: WifiNetworkModel.HotspotDeviceType) { val networkModel = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = 4, ssid = "test ssid", hotspotDeviceType = hotspot, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractorImplTest.kt index b9ca8fc2d181..c0a15922642e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractorImplTest.kt @@ -78,7 +78,7 @@ class WifiInteractorImplTest : SysuiTestCase() { @Test fun ssid_inactiveNetwork_outputsNull() = testScope.runTest { - wifiRepository.setWifiNetwork(WifiNetworkModel.Inactive) + wifiRepository.setWifiNetwork(WifiNetworkModel.Inactive()) var latest: String? = "default" val job = underTest.ssid.onEach { latest = it }.launchIn(this) @@ -93,7 +93,7 @@ class WifiInteractorImplTest : SysuiTestCase() { fun ssid_carrierMergedNetwork_outputsNull() = testScope.runTest { wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged(subscriptionId = 2, level = 1) + WifiNetworkModel.CarrierMerged.of(subscriptionId = 2, level = 1) ) var latest: String? = "default" @@ -109,7 +109,7 @@ class WifiInteractorImplTest : SysuiTestCase() { fun ssid_unknownSsid_outputsNull() = testScope.runTest { wifiRepository.setWifiNetwork( - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = 1, ssid = WifiManager.UNKNOWN_SSID, ) @@ -128,7 +128,7 @@ class WifiInteractorImplTest : SysuiTestCase() { fun ssid_validSsid_outputsSsid() = testScope.runTest { wifiRepository.setWifiNetwork( - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = 1, ssid = "MyAwesomeWifiNetwork", ) @@ -189,7 +189,7 @@ class WifiInteractorImplTest : SysuiTestCase() { fun wifiNetwork_matchesRepoWifiNetwork() = testScope.runTest { val wifiNetwork = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( isValidated = true, level = 3, ssid = "AB", @@ -263,7 +263,7 @@ class WifiInteractorImplTest : SysuiTestCase() { val latest by collectLastValue(underTest.areNetworksAvailable) wifiRepository.wifiScanResults.value = emptyList() - wifiRepository.setWifiNetwork(WifiNetworkModel.Inactive) + wifiRepository.setWifiNetwork(WifiNetworkModel.Inactive()) assertThat(latest).isFalse() } @@ -280,7 +280,7 @@ class WifiInteractorImplTest : SysuiTestCase() { WifiScanEntry(ssid = "ssid 3"), ) - wifiRepository.setWifiNetwork(WifiNetworkModel.Inactive) + wifiRepository.setWifiNetwork(WifiNetworkModel.Inactive()) assertThat(latest).isTrue() } @@ -298,7 +298,7 @@ class WifiInteractorImplTest : SysuiTestCase() { ) wifiRepository.setWifiNetwork( - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( ssid = "ssid 2", level = 2, ) @@ -318,7 +318,7 @@ class WifiInteractorImplTest : SysuiTestCase() { ) wifiRepository.setWifiNetwork( - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( ssid = "ssid 2", level = 2, ) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelTest.kt index 43b9531c6086..6c8d80932638 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelTest.kt @@ -113,7 +113,7 @@ class WifiViewModelTest : SysuiTestCase() { val latestKeyguard by collectLastValue(keyguard.wifiIcon) val latestQs by collectLastValue(qs.wifiIcon) - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(isValidated = true, level = 1)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(isValidated = true, level = 1)) assertThat(latestHome).isInstanceOf(WifiIcon.Visible::class.java) assertThat(latestHome).isEqualTo(latestKeyguard) @@ -127,7 +127,7 @@ class WifiViewModelTest : SysuiTestCase() { // Even WHEN the network has a valid hotspot type wifiRepository.setWifiNetwork( - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( isValidated = true, level = 1, hotspotDeviceType = WifiNetworkModel.HotspotDeviceType.LAPTOP, @@ -189,7 +189,7 @@ class WifiViewModelTest : SysuiTestCase() { whenever(connectivityConstants.shouldShowActivityConfig).thenReturn(true) createAndSetViewModel() - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(ssid = null, level = 1)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(ssid = null, level = 1)) val activityIn by collectLastValue(underTest.isActivityInViewVisible) val activityOut by collectLastValue(underTest.isActivityOutViewVisible) @@ -212,7 +212,7 @@ class WifiViewModelTest : SysuiTestCase() { whenever(connectivityConstants.shouldShowActivityConfig).thenReturn(true) createAndSetViewModel() - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(ssid = null, level = 1)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(ssid = null, level = 1)) val activityIn by collectLastValue(underTest.isActivityInViewVisible) val activityOut by collectLastValue(underTest.isActivityOutViewVisible) @@ -461,6 +461,6 @@ class WifiViewModelTest : SysuiTestCase() { } companion object { - private val ACTIVE_VALID_WIFI_NETWORK = WifiNetworkModel.Active(ssid = "AB", level = 1) + private val ACTIVE_VALID_WIFI_NETWORK = WifiNetworkModel.Active.of(ssid = "AB", level = 1) } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepository.kt index fc7a67233bb6..bc7d376a8740 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepository.kt @@ -64,9 +64,6 @@ interface WifiRepository { const val COL_NAME_IS_ENABLED = "isEnabled" /** Column name to use for [isWifiDefault] for table logging. */ const val COL_NAME_IS_DEFAULT = "isDefault" - - const val CARRIER_MERGED_INVALID_SUB_ID_REASON = - "Wifi network was carrier merged but had invalid sub ID" } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/demo/DemoWifiRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/demo/DemoWifiRepository.kt index 7163e67eaa5d..f4bb1a34b05f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/demo/DemoWifiRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/demo/DemoWifiRepository.kt @@ -46,7 +46,7 @@ constructor( private val _isWifiDefault = MutableStateFlow(false) override val isWifiDefault: StateFlow = _isWifiDefault - private val _wifiNetwork = MutableStateFlow(WifiNetworkModel.Inactive) + private val _wifiNetwork = MutableStateFlow(WifiNetworkModel.Inactive()) override val wifiNetwork: StateFlow = _wifiNetwork private val _secondaryNetworks = MutableStateFlow>(emptyList()) @@ -82,7 +82,7 @@ constructor( _isWifiEnabled.value = false _isWifiDefault.value = false _wifiActivity.value = DataActivityModel(hasActivityIn = false, hasActivityOut = false) - _wifiNetwork.value = WifiNetworkModel.Inactive + _wifiNetwork.value = WifiNetworkModel.Inactive() } private fun processEnabledWifiState(event: FakeWifiEventModel.Wifi) { @@ -100,7 +100,7 @@ constructor( } private fun FakeWifiEventModel.Wifi.toWifiNetworkModel(): WifiNetworkModel = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( isValidated = validated ?: true, level = level ?: 0, ssid = ssid ?: DEMO_NET_SSID, @@ -108,7 +108,7 @@ constructor( ) private fun FakeWifiEventModel.CarrierMerged.toCarrierMergedModel(): WifiNetworkModel = - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = subscriptionId, level = level, numberOfLevels = numberOfLevels, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt index b23ab3a8a897..5889b3e22322 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.pipeline.wifi.data.repository.prod import android.annotation.SuppressLint import android.net.wifi.ScanResult import android.net.wifi.WifiManager -import android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LifecycleRegistry @@ -41,18 +40,14 @@ import com.android.systemui.statusbar.pipeline.dagger.WifiTableLog import com.android.systemui.statusbar.pipeline.shared.data.model.DataActivityModel import com.android.systemui.statusbar.pipeline.shared.data.model.toWifiDataActivityModel import com.android.systemui.statusbar.pipeline.wifi.data.repository.RealWifiRepository -import com.android.systemui.statusbar.pipeline.wifi.data.repository.WifiRepository.Companion.CARRIER_MERGED_INVALID_SUB_ID_REASON import com.android.systemui.statusbar.pipeline.wifi.data.repository.WifiRepository.Companion.COL_NAME_IS_DEFAULT import com.android.systemui.statusbar.pipeline.wifi.data.repository.WifiRepository.Companion.COL_NAME_IS_ENABLED import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel -import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel.Inactive.toHotspotDeviceType +import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel.Unavailable.toHotspotDeviceType import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiScanEntry import com.android.wifitrackerlib.HotspotNetworkEntry import com.android.wifitrackerlib.MergedCarrierEntry import com.android.wifitrackerlib.WifiEntry -import com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_MAX -import com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_MIN -import com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_UNREACHABLE import com.android.wifitrackerlib.WifiPickerTracker import java.util.concurrent.Executor import javax.inject.Inject @@ -256,36 +251,28 @@ constructor( } private fun MergedCarrierEntry.convertCarrierMergedToModel(): WifiNetworkModel { - return if (this.subscriptionId == INVALID_SUBSCRIPTION_ID) { - WifiNetworkModel.Invalid(CARRIER_MERGED_INVALID_SUB_ID_REASON) - } else { - WifiNetworkModel.CarrierMerged( - subscriptionId = this.subscriptionId, - level = this.level, - // WifiManager APIs to calculate the signal level start from 0, so - // maxSignalLevel + 1 represents the total level buckets count. - numberOfLevels = wifiManager.maxSignalLevel + 1, - ) - } + // WifiEntry instance values aren't guaranteed to be stable between method calls + // because + // WifiPickerTracker is continuously updating the same object. Save the level in a + // local + // variable so that checking the level validity here guarantees that the level will + // still be + // valid when we create the `WifiNetworkModel.Active` instance later. Otherwise, the + // level + // could be valid here but become invalid later, and `WifiNetworkModel.Active` will + // throw + // an exception. See b/362384551. + + return WifiNetworkModel.CarrierMerged.of( + subscriptionId = this.subscriptionId, + level = this.level, + // WifiManager APIs to calculate the signal level start from 0, so + // maxSignalLevel + 1 represents the total level buckets count. + numberOfLevels = wifiManager.maxSignalLevel + 1, + ) } private fun WifiEntry.convertNormalToModel(): WifiNetworkModel { - // WifiEntry instance values aren't guaranteed to be stable between method calls because - // WifiPickerTracker is continuously updating the same object. Save the level in a local - // variable so that checking the level validity here guarantees that the level will still be - // valid when we create the `WifiNetworkModel.Active` instance later. Otherwise, the level - // could be valid here but become invalid later, and `WifiNetworkModel.Active` will throw - // an exception. See b/362384551. - val currentLevel = this.level - if ( - currentLevel == WIFI_LEVEL_UNREACHABLE || - currentLevel !in WIFI_LEVEL_MIN..WIFI_LEVEL_MAX - ) { - // If our level means the network is unreachable or the level is otherwise invalid, we - // don't have an active network. - return WifiNetworkModel.Inactive - } - val hotspotDeviceType = if (isInstantTetherEnabled && this is HotspotNetworkEntry) { this.deviceType.toHotspotDeviceType() @@ -293,9 +280,9 @@ constructor( WifiNetworkModel.HotspotDeviceType.NONE } - return WifiNetworkModel.Active( + return WifiNetworkModel.Active.of( isValidated = this.hasInternetAccess(), - level = currentLevel, + level = this.level, ssid = this.title, hotspotDeviceType = hotspotDeviceType, ) @@ -433,7 +420,7 @@ constructor( companion object { // Start out with no known wifi network. - @VisibleForTesting val WIFI_NETWORK_DEFAULT = WifiNetworkModel.Inactive + @VisibleForTesting val WIFI_NETWORK_DEFAULT = WifiNetworkModel.Inactive() private const val WIFI_STATE_DEFAULT = WifiManager.WIFI_STATE_DISABLED diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModel.kt index 39842fb39e24..32203774afd1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModel.kt @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.pipeline.wifi.shared.model +import android.net.wifi.WifiManager import android.net.wifi.WifiManager.UNKNOWN_SSID import android.net.wifi.sharedconnectivity.app.NetworkProviderInfo import android.telephony.SubscriptionManager @@ -23,8 +24,12 @@ import androidx.annotation.VisibleForTesting import com.android.systemui.log.table.Diffable import com.android.systemui.log.table.TableRowLogger import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionRepository +import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel.Active.Companion.MAX_VALID_LEVEL +import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel.Active.Companion.isValid +import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel.Active.Companion.of import com.android.wifitrackerlib.HotspotNetworkEntry.DeviceType import com.android.wifitrackerlib.WifiEntry +import com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_UNREACHABLE /** Provides information about the current wifi network. */ sealed class WifiNetworkModel : Diffable { @@ -64,7 +69,7 @@ sealed class WifiNetworkModel : Diffable { /** A description of why the wifi information was invalid. */ val invalidReason: String, ) : WifiNetworkModel() { - override fun toString() = "WifiNetwork.Invalid[$invalidReason]" + override fun toString() = "WifiNetwork.Invalid[reason=$invalidReason]" override fun logDiffs(prevVal: WifiNetworkModel, row: TableRowLogger) { if (prevVal !is Invalid) { @@ -73,12 +78,12 @@ sealed class WifiNetworkModel : Diffable { } if (invalidReason != prevVal.invalidReason) { - row.logChange(COL_NETWORK_TYPE, "$TYPE_UNAVAILABLE $invalidReason") + row.logChange(COL_NETWORK_TYPE, "$TYPE_UNAVAILABLE[reason=$invalidReason]") } } override fun logFull(row: TableRowLogger) { - row.logChange(COL_NETWORK_TYPE, "$TYPE_UNAVAILABLE $invalidReason") + row.logChange(COL_NETWORK_TYPE, "$TYPE_UNAVAILABLE[reason=$invalidReason]") row.logChange(COL_SUB_ID, SUB_ID_DEFAULT) row.logChange(COL_VALIDATED, false) row.logChange(COL_LEVEL, LEVEL_DEFAULT) @@ -89,20 +94,25 @@ sealed class WifiNetworkModel : Diffable { } /** A model representing that we have no active wifi network. */ - object Inactive : WifiNetworkModel() { - override fun toString() = "WifiNetwork.Inactive" + data class Inactive( + /** An optional description of why the wifi information was inactive. */ + val inactiveReason: String? = null, + ) : WifiNetworkModel() { + override fun toString() = "WifiNetwork.Inactive[reason=$inactiveReason]" override fun logDiffs(prevVal: WifiNetworkModel, row: TableRowLogger) { - if (prevVal is Inactive) { + if (prevVal !is Inactive) { + logFull(row) return } - // When changing to Inactive, we need to log diffs to all the fields. - logFull(row) + if (inactiveReason != prevVal.inactiveReason) { + row.logChange(COL_NETWORK_TYPE, "$TYPE_INACTIVE[reason=$inactiveReason]") + } } override fun logFull(row: TableRowLogger) { - row.logChange(COL_NETWORK_TYPE, TYPE_INACTIVE) + row.logChange(COL_NETWORK_TYPE, "$TYPE_INACTIVE[reason=$inactiveReason]") row.logChange(COL_SUB_ID, SUB_ID_DEFAULT) row.logChange(COL_VALIDATED, false) row.logChange(COL_LEVEL, LEVEL_DEFAULT) @@ -117,31 +127,71 @@ sealed class WifiNetworkModel : Diffable { * treated as more of a mobile network. * * See [android.net.wifi.WifiInfo.isCarrierMerged] for more information. + * + * IMPORTANT: Do *not* call [copy] on this class. Instead, use the factory [of] methods. [of] + * will verify preconditions correctly. */ - data class CarrierMerged( + data class CarrierMerged + private constructor( /** * The subscription ID that this connection represents. * * Comes from [android.net.wifi.WifiInfo.getSubscriptionId]. * - * Per that method, this value must not be [INVALID_SUBSCRIPTION_ID] (if it was invalid, - * then this is *not* a carrier merged network). + * Per that method, this value must not be [SubscriptionManager.INVALID_SUBSCRIPTION_ID] (if + * it was invalid, then this is *not* a carrier merged network). */ val subscriptionId: Int, - /** The signal level, guaranteed to be 0 <= level <= numberOfLevels. */ + /** The signal level, required to be 0 <= level <= numberOfLevels. */ val level: Int, /** The maximum possible level. */ - val numberOfLevels: Int = MobileConnectionRepository.DEFAULT_NUM_LEVELS, + val numberOfLevels: Int, ) : WifiNetworkModel() { - init { - require(level in MIN_VALID_LEVEL..numberOfLevels) { - "CarrierMerged: $MIN_VALID_LEVEL <= wifi level <= $numberOfLevels required; " + + companion object { + /** + * Creates a [CarrierMerged] instance, or an [Invalid] instance if any of the arguments + * are invalid. + */ + fun of( + subscriptionId: Int, + level: Int, + numberOfLevels: Int = MobileConnectionRepository.DEFAULT_NUM_LEVELS + ): WifiNetworkModel { + if (!subscriptionId.isSubscriptionIdValid()) { + return Invalid(INVALID_SUB_ID_ERROR_STRING) + } + if (!level.isLevelValid(numberOfLevels)) { + return Invalid(getInvalidLevelErrorString(level, numberOfLevels)) + } + return CarrierMerged(subscriptionId, level, numberOfLevels) + } + + private fun Int.isLevelValid(maxLevel: Int): Boolean { + return this != WIFI_LEVEL_UNREACHABLE && this in MIN_VALID_LEVEL..maxLevel + } + + private fun getInvalidLevelErrorString(level: Int, maxLevel: Int): String { + return "Wifi network was carrier merged but had invalid level. " + + "$MIN_VALID_LEVEL <= wifi level <= $maxLevel required; " + "level was $level" } - require(subscriptionId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { - "subscription ID cannot be invalid" + + private fun Int.isSubscriptionIdValid(): Boolean { + return this != SubscriptionManager.INVALID_SUBSCRIPTION_ID + } + + private const val INVALID_SUB_ID_ERROR_STRING = + "Wifi network was carrier merged but had invalid sub ID" + } + + init { + require(level.isLevelValid(numberOfLevels)) { + "${getInvalidLevelErrorString(level, numberOfLevels)}. $DO_NOT_USE_COPY_ERROR" + } + require(subscriptionId.isSubscriptionIdValid()) { + "$INVALID_SUB_ID_ERROR_STRING. $DO_NOT_USE_COPY_ERROR" } } @@ -173,28 +223,64 @@ sealed class WifiNetworkModel : Diffable { } } - /** Provides information about an active wifi network. */ - data class Active( + /** + * Provides information about an active wifi network. + * + * IMPORTANT: Do *not* call [copy] on this class. Instead, use the factory [of] method. [of] + * will verify preconditions correctly. + */ + data class Active + private constructor( /** See [android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED]. */ - val isValidated: Boolean = false, + val isValidated: Boolean, - /** The wifi signal level, guaranteed to be 0 <= level <= 4. */ + /** The wifi signal level, required to be 0 <= level <= 4. */ val level: Int, /** See [android.net.wifi.WifiInfo.ssid]. */ - val ssid: String? = null, + val ssid: String?, /** * The type of device providing a hotspot connection, or [HotspotDeviceType.NONE] if this * isn't a hotspot connection. */ - val hotspotDeviceType: HotspotDeviceType = WifiNetworkModel.HotspotDeviceType.NONE, + val hotspotDeviceType: HotspotDeviceType, ) : WifiNetworkModel() { - init { - require(level in MIN_VALID_LEVEL..MAX_VALID_LEVEL) { - "Active: $MIN_VALID_LEVEL <= wifi level <= $MAX_VALID_LEVEL required; " + + companion object { + /** + * Creates an [Active] instance, or an [Inactive] instance if any of the arguments are + * invalid. + */ + @JvmStatic + fun of( + isValidated: Boolean = false, + level: Int, + ssid: String? = null, + hotspotDeviceType: HotspotDeviceType = HotspotDeviceType.NONE, + ): WifiNetworkModel { + if (!level.isValid()) { + return Inactive(getInvalidLevelErrorString(level)) + } + return Active(isValidated, level, ssid, hotspotDeviceType) + } + + private fun Int.isValid(): Boolean { + return this != WIFI_LEVEL_UNREACHABLE && this in MIN_VALID_LEVEL..MAX_VALID_LEVEL + } + + private fun getInvalidLevelErrorString(level: Int): String { + return "Wifi network was active but had invalid level. " + + "$MIN_VALID_LEVEL <= wifi level <= $MAX_VALID_LEVEL required; " + "level was $level" } + + @VisibleForTesting internal const val MAX_VALID_LEVEL = WifiEntry.WIFI_LEVEL_MAX + } + + init { + require(level.isValid()) { + "${getInvalidLevelErrorString(level)}. $DO_NOT_USE_COPY_ERROR" + } } /** Returns true if this network has a valid SSID and false otherwise. */ @@ -231,10 +317,6 @@ sealed class WifiNetworkModel : Diffable { row.logChange(COL_SSID, ssid) row.logChange(COL_HOTSPOT, hotspotDeviceType.name) } - - companion object { - @VisibleForTesting internal const val MAX_VALID_LEVEL = WifiEntry.WIFI_LEVEL_MAX - } } companion object { @@ -292,3 +374,7 @@ const val COL_HOTSPOT = "hotspot" val LEVEL_DEFAULT: String? = null val NUM_LEVELS_DEFAULT: String? = null val SUB_ID_DEFAULT: String? = null + +private const val DO_NOT_USE_COPY_ERROR = + "This should only be an issue if the caller incorrectly used `copy` to get a new instance. " + + "Please use the `of` method instead." diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java index d85b77413338..bf13ceb5666a 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java @@ -445,7 +445,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { assertFalse(mWifiRepository.isWifiConnectedWithValidSsid()); mWifiRepository.setWifiNetwork( - new WifiNetworkModel.Active( + WifiNetworkModel.Active.Companion.of( /* isValidated= */ false, /* level= */ 0, /* ssid= */ "", diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt index e6ec07e97d17..9f84e346d54a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt @@ -258,7 +258,7 @@ class InternetTileNewImplTest : SysuiTestCase() { companion object { const val WIFI_SSID = "test ssid" val ACTIVE_WIFI = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( isValidated = true, level = 4, ssid = WIFI_SSID, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt index b6e23c1f42ee..715e3b472373 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt @@ -85,7 +85,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { underTest.dataConnectionState.onEach { latestConnState = it }.launchIn(this) val netJob = underTest.resolvedNetworkType.onEach { latestNetType = it }.launchIn(this) - wifiRepository.setWifiNetwork(WifiNetworkModel.Inactive) + wifiRepository.setWifiNetwork(WifiNetworkModel.Inactive()) assertThat(latestConnState).isEqualTo(DataConnectionState.Disconnected) assertThat(latestNetType).isNotEqualTo(ResolvedNetworkType.CarrierMergedNetworkType) @@ -104,7 +104,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { underTest.dataConnectionState.onEach { latestConnState = it }.launchIn(this) val netJob = underTest.resolvedNetworkType.onEach { latestNetType = it }.launchIn(this) - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(level = 1)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(level = 1)) assertThat(latestConnState).isEqualTo(DataConnectionState.Disconnected) assertThat(latestNetType).isNotEqualTo(ResolvedNetworkType.CarrierMergedNetworkType) @@ -123,7 +123,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { wifiRepository.setIsWifiDefault(true) wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = SUB_ID, level = 3, ) @@ -143,7 +143,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { wifiRepository.setIsWifiEnabled(true) wifiRepository.setIsWifiDefault(true) wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = SUB_ID, level = 3, ) @@ -180,7 +180,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { val typeJob = underTest.resolvedNetworkType.onEach { latestType = it }.launchIn(this) wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = SUB_ID + 10, level = 3, ) @@ -201,7 +201,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { val job = underTest.primaryLevel.onEach { latest = it }.launchIn(this) wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = SUB_ID, level = 3, ) @@ -221,7 +221,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { val job = underTest.primaryLevel.onEach { latest = it }.launchIn(this) wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = SUB_ID, level = 3, ) @@ -240,7 +240,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { val job = underTest.numberOfLevels.onEach { latest = it }.launchIn(this) wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = SUB_ID, level = 1, numberOfLevels = 6, @@ -303,7 +303,7 @@ class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { whenever(telephonyManager.simOperatorName).thenReturn("New SIM name") wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = SUB_ID, level = 3, ) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt index 035a05ff3db9..8aa0c759517d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt @@ -513,7 +513,7 @@ class FullMobileConnectionRepositoryTest : SysuiTestCase() { // WHEN we set up carrier merged info wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( SUB_ID, level = 3, ) @@ -524,7 +524,7 @@ class FullMobileConnectionRepositoryTest : SysuiTestCase() { // WHEN we update the info wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( SUB_ID, level = 1, ) @@ -563,7 +563,7 @@ class FullMobileConnectionRepositoryTest : SysuiTestCase() { // WHEN isCarrierMerged is set to true wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( SUB_ID, level = 3, ) @@ -575,7 +575,7 @@ class FullMobileConnectionRepositoryTest : SysuiTestCase() { // WHEN the carrier merge network is updated wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( SUB_ID, level = 4, ) @@ -627,7 +627,7 @@ class FullMobileConnectionRepositoryTest : SysuiTestCase() { // THEN updates to the carrier merged level aren't logged wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( SUB_ID, level = 4, ) @@ -635,7 +635,7 @@ class FullMobileConnectionRepositoryTest : SysuiTestCase() { assertThat(dumpBuffer()).doesNotContain("$COL_PRIMARY_LEVEL${BUFFER_SEPARATOR}4") wifiRepository.setWifiNetwork( - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( SUB_ID, level = 3, ) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt index a1cb29b8e95c..c0a206afe64b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt @@ -574,7 +574,7 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() { val latest by collectLastValue(underTest.isWifiActive) // WHEN wifi is active - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(level = 1)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(level = 1)) // THEN the interactor returns true due to the wifi network being active assertThat(latest).isTrue() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt index c1abf9826ea3..e7e496938033 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt @@ -375,7 +375,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { repo.isSatelliteProvisioned.value = true // GIVEN wifi network is active - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(level = 1)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(level = 1)) // THEN icon is null because the device is connected to wifi assertThat(latest).isNull() @@ -573,7 +573,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { repo.isSatelliteProvisioned.value = true // GIVEN wifi network is active - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(level = 1)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(level = 1)) // THEN carrier text is null because the device is connected to wifi assertThat(latest).isNull() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModelTest.kt index ccbed7cd66ec..fc28c1e7b71d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModelTest.kt @@ -151,7 +151,7 @@ class InternetTileViewModelTest : SysuiTestCase() { val latest by collectLastValue(underTest.tileModel) val networkModel = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = 4, ssid = "test ssid", ) @@ -180,7 +180,7 @@ class InternetTileViewModelTest : SysuiTestCase() { val latest by collectLastValue(underTest.tileModel) val networkModel = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = 4, ssid = "test ssid", hotspotDeviceType = WifiNetworkModel.HotspotDeviceType.NONE, @@ -292,7 +292,7 @@ class InternetTileViewModelTest : SysuiTestCase() { testScope.runTest { val latest by collectLastValue(underTest.tileModel) - val networkModel = WifiNetworkModel.Inactive + val networkModel = WifiNetworkModel.Inactive() connectivityRepository.setWifiConnected(validated = false) wifiRepository.setIsWifiDefault(true) @@ -307,7 +307,7 @@ class InternetTileViewModelTest : SysuiTestCase() { testScope.runTest { val latest by collectLastValue(underTest.tileModel) - val networkModel = WifiNetworkModel.Inactive + val networkModel = WifiNetworkModel.Inactive() connectivityRepository.setWifiConnected(validated = false) wifiRepository.setIsWifiDefault(true) @@ -387,7 +387,7 @@ class InternetTileViewModelTest : SysuiTestCase() { private fun setWifiNetworkWithHotspot(hotspot: WifiNetworkModel.HotspotDeviceType) { val networkModel = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = 4, ssid = "test ssid", hotspotDeviceType = hotspot, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImplTest.kt index 9d73ad21485e..cf0801542d82 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImplTest.kt @@ -301,7 +301,10 @@ class WifiRepositoryImplTest : SysuiTestCase() { whenever(wifiPickerTracker.connectedWifiEntry).thenReturn(wifiEntry) getCallback().onWifiEntriesChanged() - assertThat(latest).isEqualTo(WifiNetworkModel.Inactive) + assertThat(latest).isInstanceOf(WifiNetworkModel.Inactive::class.java) + val inactiveReason = (latest as WifiNetworkModel.Inactive).inactiveReason + assertThat(inactiveReason).contains("level") + assertThat(inactiveReason).contains("$WIFI_LEVEL_UNREACHABLE") } @Test @@ -317,7 +320,10 @@ class WifiRepositoryImplTest : SysuiTestCase() { whenever(wifiPickerTracker.connectedWifiEntry).thenReturn(wifiEntry) getCallback().onWifiEntriesChanged() - assertThat(latest).isEqualTo(WifiNetworkModel.Inactive) + assertThat(latest).isInstanceOf(WifiNetworkModel.Inactive::class.java) + val inactiveReason = (latest as WifiNetworkModel.Inactive).inactiveReason + assertThat(inactiveReason).contains("level") + assertThat(inactiveReason).contains("${WIFI_LEVEL_MAX + 1}") } @Test @@ -333,7 +339,10 @@ class WifiRepositoryImplTest : SysuiTestCase() { whenever(wifiPickerTracker.connectedWifiEntry).thenReturn(wifiEntry) getCallback().onWifiEntriesChanged() - assertThat(latest).isEqualTo(WifiNetworkModel.Inactive) + assertThat(latest).isInstanceOf(WifiNetworkModel.Inactive::class.java) + val inactiveReason = (latest as WifiNetworkModel.Inactive).inactiveReason + assertThat(inactiveReason).contains("level") + assertThat(inactiveReason).contains("${WIFI_LEVEL_MIN - 1}") } @Test @@ -560,6 +569,25 @@ class WifiRepositoryImplTest : SysuiTestCase() { assertThat(latest).isInstanceOf(WifiNetworkModel.Invalid::class.java) } + @Test + fun wifiNetwork_carrierMergedButInvalidLevel_flowHasInvalid() = + testScope.runTest { + val latest by collectLastValue(underTest.wifiNetwork) + + val mergedEntry = + mock().apply { + whenever(this.isPrimaryNetwork).thenReturn(true) + whenever(this.subscriptionId).thenReturn(3) + whenever(this.isDefaultNetwork).thenReturn(true) + whenever(this.level).thenReturn(WIFI_LEVEL_UNREACHABLE) + } + whenever(wifiPickerTracker.mergedCarrierEntry).thenReturn(mergedEntry) + + getCallback().onWifiEntriesChanged() + + assertThat(latest).isInstanceOf(WifiNetworkModel.Invalid::class.java) + } + @Test fun wifiNetwork_notValidated_networkNotValidated() = testScope.runTest { @@ -602,7 +630,7 @@ class WifiRepositoryImplTest : SysuiTestCase() { whenever(wifiPickerTracker.connectedWifiEntry).thenReturn(wifiEntry) getCallback().onWifiEntriesChanged() - assertThat(latest).isEqualTo(WifiNetworkModel.Inactive) + assertThat(latest).isEqualTo(WifiNetworkModel.Inactive()) } @Test @@ -618,7 +646,7 @@ class WifiRepositoryImplTest : SysuiTestCase() { whenever(wifiPickerTracker.connectedWifiEntry).thenReturn(null) getCallback().onWifiEntriesChanged() - assertThat(latest).isEqualTo(WifiNetworkModel.Inactive) + assertThat(latest).isEqualTo(WifiNetworkModel.Inactive()) } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModelTest.kt index 92860efc0c35..1495519cc1a1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModelTest.kt @@ -24,6 +24,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.log.table.TableRowLogger import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel.Active.Companion.MAX_VALID_LEVEL import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel.Companion.MIN_VALID_LEVEL +import com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_UNREACHABLE import com.google.common.truth.Truth.assertThat import org.junit.Test import org.junit.runner.RunWith @@ -32,59 +33,109 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class WifiNetworkModelTest : SysuiTestCase() { @Test - fun active_levelsInValidRange_noException() { + fun active_levelsInValidRange_createsActive() { (MIN_VALID_LEVEL..MAX_VALID_LEVEL).forEach { level -> - WifiNetworkModel.Active(level = level) - // No assert, just need no crash + val result = WifiNetworkModel.Active.of(level = level) + assertThat(result).isInstanceOf(WifiNetworkModel.Active::class.java) } } + fun active_levelTooLow_returnsInactive() { + val result = WifiNetworkModel.Active.of(level = MIN_VALID_LEVEL - 1) + assertThat(result).isInstanceOf(WifiNetworkModel.Inactive::class.java) + } + @Test(expected = IllegalArgumentException::class) - fun active_levelNegative_exceptionThrown() { - WifiNetworkModel.Active(level = MIN_VALID_LEVEL - 1) + fun active_levelTooLow_createdByCopy_exceptionThrown() { + val starting = WifiNetworkModel.Active.of(level = MIN_VALID_LEVEL) + + (starting as WifiNetworkModel.Active).copy(level = MIN_VALID_LEVEL - 1) + } + + fun active_levelTooHigh_returnsInactive() { + val result = WifiNetworkModel.Active.of(level = MAX_VALID_LEVEL + 1) + + assertThat(result).isInstanceOf(WifiNetworkModel.Inactive::class.java) } @Test(expected = IllegalArgumentException::class) - fun active_levelTooHigh_exceptionThrown() { - WifiNetworkModel.Active(level = MAX_VALID_LEVEL + 1) + fun active_levelTooHigh_createdByCopy_exceptionThrown() { + val starting = WifiNetworkModel.Active.of(level = MAX_VALID_LEVEL) + + (starting as WifiNetworkModel.Active).copy(level = MAX_VALID_LEVEL + 1) + } + + fun active_levelUnreachable_returnsInactive() { + val result = WifiNetworkModel.Active.of(level = WIFI_LEVEL_UNREACHABLE) + + assertThat(result).isInstanceOf(WifiNetworkModel.Inactive::class.java) } @Test(expected = IllegalArgumentException::class) - fun carrierMerged_invalidSubId_exceptionThrown() { - WifiNetworkModel.CarrierMerged(INVALID_SUBSCRIPTION_ID, 1) + fun active_levelUnreachable_createdByCopy_exceptionThrown() { + val starting = WifiNetworkModel.Active.of(level = MAX_VALID_LEVEL) + + (starting as WifiNetworkModel.Active).copy(level = WIFI_LEVEL_UNREACHABLE) + } + + fun carrierMerged_invalidSubId_returnsInvalid() { + val result = WifiNetworkModel.CarrierMerged.of(INVALID_SUBSCRIPTION_ID, level = 1) + + assertThat(result).isInstanceOf(WifiNetworkModel.Invalid::class.java) + } + + @Test(expected = IllegalArgumentException::class) + fun carrierMerged_invalidSubId_createdByCopy_exceptionThrown() { + val starting = WifiNetworkModel.CarrierMerged.of(subscriptionId = 1, level = 1) + + (starting as WifiNetworkModel.CarrierMerged).copy(subscriptionId = INVALID_SUBSCRIPTION_ID) + } + + fun carrierMerged_levelUnreachable_returnsInvalid() { + val result = + WifiNetworkModel.CarrierMerged.of(subscriptionId = 1, level = WIFI_LEVEL_UNREACHABLE) + + assertThat(result).isInstanceOf(WifiNetworkModel.Invalid::class.java) + } + + @Test(expected = IllegalArgumentException::class) + fun carrierMerged_levelUnreachable_createdByCopy_exceptionThrown() { + val starting = WifiNetworkModel.CarrierMerged.of(subscriptionId = 1, level = 1) + + (starting as WifiNetworkModel.CarrierMerged).copy(level = WIFI_LEVEL_UNREACHABLE) } @Test fun active_hasValidSsid_nullSsid_false() { val network = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = MAX_VALID_LEVEL, ssid = null, ) - assertThat(network.hasValidSsid()).isFalse() + assertThat((network as WifiNetworkModel.Active).hasValidSsid()).isFalse() } @Test fun active_hasValidSsid_unknownSsid_false() { val network = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = MAX_VALID_LEVEL, ssid = UNKNOWN_SSID, ) - assertThat(network.hasValidSsid()).isFalse() + assertThat((network as WifiNetworkModel.Active).hasValidSsid()).isFalse() } @Test fun active_hasValidSsid_validSsid_true() { val network = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( level = MAX_VALID_LEVEL, ssid = "FakeSsid", ) - assertThat(network.hasValidSsid()).isTrue() + assertThat((network as WifiNetworkModel.Active).hasValidSsid()).isTrue() } // Non-exhaustive logDiffs test -- just want to make sure the logging logic isn't totally broken @@ -93,14 +144,15 @@ class WifiNetworkModelTest : SysuiTestCase() { fun logDiffs_carrierMergedToInactive_resetsAllFields() { val logger = TestLogger() val prevVal = - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = 3, level = 1, ) - WifiNetworkModel.Inactive.logDiffs(prevVal, logger) + WifiNetworkModel.Inactive(inactiveReason = "TestReason").logDiffs(prevVal, logger) - assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_INACTIVE)) + assertThat(logger.changes) + .contains(Pair(COL_NETWORK_TYPE, "$TYPE_INACTIVE[reason=TestReason]")) assertThat(logger.changes).contains(Pair(COL_VALIDATED, "false")) assertThat(logger.changes).contains(Pair(COL_LEVEL, LEVEL_DEFAULT.toString())) assertThat(logger.changes).contains(Pair(COL_SSID, "null")) @@ -110,12 +162,12 @@ class WifiNetworkModelTest : SysuiTestCase() { fun logDiffs_inactiveToCarrierMerged_logsAllFields() { val logger = TestLogger() val carrierMerged = - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = 3, level = 2, ) - carrierMerged.logDiffs(prevVal = WifiNetworkModel.Inactive, logger) + carrierMerged.logDiffs(prevVal = WifiNetworkModel.Inactive(), logger) assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_CARRIER_MERGED)) assertThat(logger.changes).contains(Pair(COL_SUB_ID, "3")) @@ -128,14 +180,14 @@ class WifiNetworkModelTest : SysuiTestCase() { fun logDiffs_inactiveToActive_logsAllActiveFields() { val logger = TestLogger() val activeNetwork = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( isValidated = true, level = 3, ssid = "Test SSID", hotspotDeviceType = WifiNetworkModel.HotspotDeviceType.LAPTOP, ) - activeNetwork.logDiffs(prevVal = WifiNetworkModel.Inactive, logger) + activeNetwork.logDiffs(prevVal = WifiNetworkModel.Inactive(), logger) assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_ACTIVE)) assertThat(logger.changes).contains(Pair(COL_VALIDATED, "true")) @@ -148,11 +200,13 @@ class WifiNetworkModelTest : SysuiTestCase() { fun logDiffs_activeToInactive_resetsAllActiveFields() { val logger = TestLogger() val activeNetwork = - WifiNetworkModel.Active(isValidated = true, level = 3, ssid = "Test SSID") + WifiNetworkModel.Active.of(isValidated = true, level = 3, ssid = "Test SSID") - WifiNetworkModel.Inactive.logDiffs(prevVal = activeNetwork, logger) + WifiNetworkModel.Inactive(inactiveReason = "TestReason") + .logDiffs(prevVal = activeNetwork, logger) - assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_INACTIVE)) + assertThat(logger.changes) + .contains(Pair(COL_NETWORK_TYPE, "$TYPE_INACTIVE[reason=TestReason]")) assertThat(logger.changes).contains(Pair(COL_VALIDATED, "false")) assertThat(logger.changes).contains(Pair(COL_LEVEL, LEVEL_DEFAULT.toString())) assertThat(logger.changes).contains(Pair(COL_SSID, "null")) @@ -163,14 +217,14 @@ class WifiNetworkModelTest : SysuiTestCase() { fun logDiffs_carrierMergedToActive_logsAllActiveFields() { val logger = TestLogger() val activeNetwork = - WifiNetworkModel.Active( + WifiNetworkModel.Active.of( isValidated = true, level = 3, ssid = "Test SSID", hotspotDeviceType = WifiNetworkModel.HotspotDeviceType.AUTO, ) val prevVal = - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = 3, level = 1, ) @@ -188,9 +242,9 @@ class WifiNetworkModelTest : SysuiTestCase() { fun logDiffs_activeToCarrierMerged_logsAllFields() { val logger = TestLogger() val activeNetwork = - WifiNetworkModel.Active(isValidated = true, level = 3, ssid = "Test SSID") + WifiNetworkModel.Active.of(isValidated = true, level = 3, ssid = "Test SSID") val carrierMerged = - WifiNetworkModel.CarrierMerged( + WifiNetworkModel.CarrierMerged.of( subscriptionId = 3, level = 2, ) @@ -208,9 +262,9 @@ class WifiNetworkModelTest : SysuiTestCase() { fun logDiffs_activeChangesLevel_onlyLevelLogged() { val logger = TestLogger() val prevActiveNetwork = - WifiNetworkModel.Active(isValidated = true, level = 3, ssid = "Test SSID") + WifiNetworkModel.Active.of(isValidated = true, level = 3, ssid = "Test SSID") val newActiveNetwork = - WifiNetworkModel.Active(isValidated = true, level = 2, ssid = "Test SSID") + WifiNetworkModel.Active.of(isValidated = true, level = 2, ssid = "Test SSID") newActiveNetwork.logDiffs(prevActiveNetwork, logger) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/view/ModernStatusBarWifiViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/view/ModernStatusBarWifiViewTest.kt index 31ffa5df4dba..bbf5bb2bc011 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/view/ModernStatusBarWifiViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/view/ModernStatusBarWifiViewTest.kt @@ -193,7 +193,7 @@ class ModernStatusBarWifiViewTest : SysuiTestCase() { @Test fun isIconVisible_notEnabled_outputsFalse() { wifiRepository.setIsWifiEnabled(false) - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(isValidated = true, level = 2)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(isValidated = true, level = 2)) val view = ModernStatusBarWifiView.constructAndBind(context, SLOT_NAME, viewModel) @@ -208,7 +208,7 @@ class ModernStatusBarWifiViewTest : SysuiTestCase() { @Test fun isIconVisible_enabled_outputsTrue() { wifiRepository.setIsWifiEnabled(true) - wifiRepository.setWifiNetwork(WifiNetworkModel.Active(isValidated = true, level = 2)) + wifiRepository.setWifiNetwork(WifiNetworkModel.Active.of(isValidated = true, level = 2)) val view = ModernStatusBarWifiView.constructAndBind(context, SLOT_NAME, viewModel) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelIconParameterizedTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelIconParameterizedTest.kt index 43fee78ce220..a867847bc731 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelIconParameterizedTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelIconParameterizedTest.kt @@ -204,51 +204,51 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase // Enabled = false => no networks shown TestCase( enabled = false, - network = WifiNetworkModel.CarrierMerged(subscriptionId = 1, level = 1), + network = WifiNetworkModel.CarrierMerged.of(subscriptionId = 1, level = 1), expected = null, ), TestCase( enabled = false, - network = WifiNetworkModel.Inactive, + network = WifiNetworkModel.Inactive(), expected = null, ), TestCase( enabled = false, - network = WifiNetworkModel.Active(isValidated = false, level = 1), + network = WifiNetworkModel.Active.of(isValidated = false, level = 1), expected = null, ), TestCase( enabled = false, - network = WifiNetworkModel.Active(isValidated = true, level = 3), + network = WifiNetworkModel.Active.of(isValidated = true, level = 3), expected = null, ), // forceHidden = true => no networks shown TestCase( forceHidden = true, - network = WifiNetworkModel.CarrierMerged(subscriptionId = 1, level = 1), + network = WifiNetworkModel.CarrierMerged.of(subscriptionId = 1, level = 1), expected = null, ), TestCase( forceHidden = true, - network = WifiNetworkModel.Inactive, + network = WifiNetworkModel.Inactive(), expected = null, ), TestCase( enabled = false, - network = WifiNetworkModel.Active(isValidated = false, level = 2), + network = WifiNetworkModel.Active.of(isValidated = false, level = 2), expected = null, ), TestCase( forceHidden = true, - network = WifiNetworkModel.Active(isValidated = true, level = 1), + network = WifiNetworkModel.Active.of(isValidated = true, level = 1), expected = null, ), // alwaysShowIconWhenEnabled = true => all Inactive and Active networks shown TestCase( alwaysShowIconWhenEnabled = true, - network = WifiNetworkModel.Inactive, + network = WifiNetworkModel.Inactive(), expected = Expected( iconResource = WIFI_NO_NETWORK, @@ -261,7 +261,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase ), TestCase( alwaysShowIconWhenEnabled = true, - network = WifiNetworkModel.Active(isValidated = false, level = 4), + network = WifiNetworkModel.Active.of(isValidated = false, level = 4), expected = Expected( iconResource = WIFI_NO_INTERNET_ICONS[4], @@ -274,7 +274,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase ), TestCase( alwaysShowIconWhenEnabled = true, - network = WifiNetworkModel.Active(isValidated = true, level = 2), + network = WifiNetworkModel.Active.of(isValidated = true, level = 2), expected = Expected( iconResource = WIFI_FULL_ICONS[2], @@ -288,7 +288,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase // hasDataCapabilities = false => all Inactive and Active networks shown TestCase( hasDataCapabilities = false, - network = WifiNetworkModel.Inactive, + network = WifiNetworkModel.Inactive(), expected = Expected( iconResource = WIFI_NO_NETWORK, @@ -301,7 +301,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase ), TestCase( hasDataCapabilities = false, - network = WifiNetworkModel.Active(isValidated = false, level = 2), + network = WifiNetworkModel.Active.of(isValidated = false, level = 2), expected = Expected( iconResource = WIFI_NO_INTERNET_ICONS[2], @@ -314,7 +314,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase ), TestCase( hasDataCapabilities = false, - network = WifiNetworkModel.Active(isValidated = true, level = 0), + network = WifiNetworkModel.Active.of(isValidated = true, level = 0), expected = Expected( iconResource = WIFI_FULL_ICONS[0], @@ -328,7 +328,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase // isDefault = true => all Inactive and Active networks shown TestCase( isDefault = true, - network = WifiNetworkModel.Inactive, + network = WifiNetworkModel.Inactive(), expected = Expected( iconResource = WIFI_NO_NETWORK, @@ -341,7 +341,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase ), TestCase( isDefault = true, - network = WifiNetworkModel.Active(isValidated = false, level = 3), + network = WifiNetworkModel.Active.of(isValidated = false, level = 3), expected = Expected( iconResource = WIFI_NO_INTERNET_ICONS[3], @@ -354,7 +354,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase ), TestCase( isDefault = true, - network = WifiNetworkModel.Active(isValidated = true, level = 1), + network = WifiNetworkModel.Active.of(isValidated = true, level = 1), expected = Expected( iconResource = WIFI_FULL_ICONS[1], @@ -370,14 +370,14 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase enabled = true, isDefault = true, forceHidden = false, - network = WifiNetworkModel.CarrierMerged(subscriptionId = 1, level = 1), + network = WifiNetworkModel.CarrierMerged.of(subscriptionId = 1, level = 1), expected = null, ), // isDefault = false => no networks shown TestCase( isDefault = false, - network = WifiNetworkModel.Inactive, + network = WifiNetworkModel.Inactive(), expected = null, ), TestCase( @@ -387,7 +387,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase ), TestCase( isDefault = false, - network = WifiNetworkModel.Active(isValidated = false, level = 3), + network = WifiNetworkModel.Active.of(isValidated = false, level = 3), expected = null, ), @@ -395,7 +395,7 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase // because wifi isn't the default connection (b/272509965). TestCase( isDefault = false, - network = WifiNetworkModel.Active(isValidated = true, level = 4), + network = WifiNetworkModel.Active.of(isValidated = true, level = 4), expected = null, ), ) diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/FakeWifiRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/FakeWifiRepository.kt index 709be5edf4c0..7ca90ea4bd7d 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/FakeWifiRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/FakeWifiRepository.kt @@ -32,7 +32,7 @@ class FakeWifiRepository : WifiRepository { override val isWifiDefault: StateFlow = _isWifiDefault private val _wifiNetwork: MutableStateFlow = - MutableStateFlow(WifiNetworkModel.Inactive) + MutableStateFlow(WifiNetworkModel.Inactive()) override val wifiNetwork: StateFlow = _wifiNetwork override val secondaryNetworks = MutableStateFlow>(emptyList()) -- GitLab From d0e7192ee5cd0bac49dde0c30eddb4f38e3d2056 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Mon, 9 Sep 2024 11:41:58 -0700 Subject: [PATCH 140/492] Add safeguard for package not having state When calling wasPackageEverLaunched(), there's always a chance that it can throw IllegalArgumentException. Catch it and assume false. Fixes: 365098435 Bug: 362198191 Bug: 353651949 Test: flash and reboot Flag: EXEMPT bugfix Change-Id: I31f8a4341df9f9d480dd24d0cbaed04e48b8efd2 --- .../core/java/com/android/server/am/ProcessList.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index 5b4e57350c40..29a17f51b0af 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -3397,12 +3397,16 @@ public final class ProcessList { final boolean wasStopped = info.isStopped(); // Check if we should mark the processrecord for first launch after force-stopping if (wasStopped) { - boolean wasEverLaunched; + boolean wasEverLaunched = false; if (android.app.Flags.useAppInfoNotLaunched()) { wasEverLaunched = !info.isNotLaunched(); } else { - wasEverLaunched = mService.getPackageManagerInternal() - .wasPackageEverLaunched(r.getApplicationInfo().packageName, r.userId); + try { + wasEverLaunched = mService.getPackageManagerInternal() + .wasPackageEverLaunched(r.getApplicationInfo().packageName, r.userId); + } catch (IllegalArgumentException e) { + // Package doesn't have state yet, assume not launched + } } // Check if the hosting record is for an activity or not. Since the stopped // state tracking is handled differently to avoid WM calling back into AM, -- GitLab From c244eb6595d080a755a947a049f4a28e3dc47382 Mon Sep 17 00:00:00 2001 From: Grace Cheng Date: Wed, 28 Aug 2024 17:33:48 +0000 Subject: [PATCH 141/492] SFPS indicator and BiometricPrompt MVVM cleanup Removing stale iconOverlayView references (layout files, BiometricViewSizeBinder). Also cleans up MVVM structure by moving dependencies to SideFpsOverlayViewModel and new interactor rather than SideFpsOverlayViewBinder and updates PromptIconViewModel to access dependencies directly from parent PromptViewModel instead of passing them in directly. Moves shared test setup functions to BiometricTestExtensions. Flag: EXEMPT cleanup Fixes: 364937003 Bug: 288173662 Test: atest SideFpsOverlayViewModelTest Test: atest SideFpsOverlayInteractorTest Test: atest SideFpsOverlayViewBinderTest Test: atest PromptViewModelTest Change-Id: I2bde7a83bc2c5eb626d2a7dfa2f4fb85dede68f9 --- .../biometrics/BiometricTestExtensions.kt | 75 ++++++ .../SideFpsOverlayInteractorTest.kt | 174 ++++++++++++ .../ui/binder/SideFpsOverlayViewBinderTest.kt | 255 +++--------------- .../viewmodel/SideFpsOverlayViewModelTest.kt | 65 +---- .../biometric_prompt_one_pane_layout.xml | 13 - .../biometric_prompt_two_pane_layout.xml | 13 - .../domain/BiometricsDomainLayerModule.kt | 8 + .../interactor/SideFpsOverlayInteractor.kt | 82 ++++++ .../ui/binder/BiometricViewSizeBinder.kt | 5 - .../ui/binder/SideFpsOverlayViewBinder.kt | 111 ++------ .../ui/viewmodel/PromptViewModel.kt | 14 +- .../ui/viewmodel/SideFpsOverlayViewModel.kt | 3 +- .../viewmodel/SideFpsProgressBarViewModel.kt | 2 + .../ui/viewmodel/PromptViewModelTest.kt | 5 + .../SideFpsOverlayInteractorKosmos.kt | 32 +++ .../binder/SideFpsOverlayViewBinderKosmos.kt | 20 +- .../SideFpsOverlayViewModelKosmos.kt | 8 +- 17 files changed, 461 insertions(+), 424 deletions(-) create mode 100644 packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractorTest.kt create mode 100644 packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractor.kt create mode 100644 packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractorKosmos.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/BiometricTestExtensions.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/BiometricTestExtensions.kt index 75a77cf781d2..4bc71fd6d363 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/BiometricTestExtensions.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/BiometricTestExtensions.kt @@ -27,6 +27,17 @@ import android.hardware.face.FaceSensorProperties import android.hardware.face.FaceSensorPropertiesInternal import android.hardware.fingerprint.FingerprintSensorProperties import android.hardware.fingerprint.FingerprintSensorPropertiesInternal +import com.android.keyguard.keyguardUpdateMonitor +import com.android.systemui.SysuiTestableContext +import com.android.systemui.biometrics.data.repository.biometricStatusRepository +import com.android.systemui.biometrics.shared.model.AuthenticationReason +import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.res.R +import com.android.systemui.util.mockito.whenever +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.runCurrent /** Create [FingerprintSensorPropertiesInternal] for a test. */ internal fun fingerprintSensorPropertiesInternal( @@ -145,3 +156,67 @@ internal fun promptInfo( info.negativeButtonText = negativeButton return info } + +@OptIn(ExperimentalCoroutinesApi::class) +internal fun TestScope.updateSfpsIndicatorRequests( + kosmos: Kosmos, + mContext: SysuiTestableContext, + primaryBouncerRequest: Boolean? = null, + alternateBouncerRequest: Boolean? = null, + biometricPromptRequest: Boolean? = null, + // TODO(b/365182034): update when rest to unlock feature is implemented + // progressBarShowing: Boolean? = null +) { + biometricPromptRequest?.let { hasBiometricPromptRequest -> + if (hasBiometricPromptRequest) { + kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( + AuthenticationReason.BiometricPromptAuthentication + ) + } else { + kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( + AuthenticationReason.NotRunning + ) + } + } + + primaryBouncerRequest?.let { hasPrimaryBouncerRequest -> + updatePrimaryBouncer( + kosmos, + mContext, + isShowing = hasPrimaryBouncerRequest, + isAnimatingAway = false, + fpsDetectionRunning = true, + isUnlockingWithFpAllowed = true + ) + } + + alternateBouncerRequest?.let { hasAlternateBouncerRequest -> + kosmos.keyguardBouncerRepository.setAlternateVisible(hasAlternateBouncerRequest) + } + + // TODO(b/365182034): set progress bar visibility when rest to unlock feature is implemented + + runCurrent() +} + +internal fun updatePrimaryBouncer( + kosmos: Kosmos, + mContext: SysuiTestableContext, + isShowing: Boolean, + isAnimatingAway: Boolean, + fpsDetectionRunning: Boolean, + isUnlockingWithFpAllowed: Boolean, +) { + kosmos.keyguardBouncerRepository.setPrimaryShow(isShowing) + kosmos.keyguardBouncerRepository.setPrimaryStartingToHide(false) + val primaryStartDisappearAnimation = if (isAnimatingAway) Runnable {} else null + kosmos.keyguardBouncerRepository.setPrimaryStartDisappearAnimation( + primaryStartDisappearAnimation + ) + + whenever(kosmos.keyguardUpdateMonitor.isFingerprintDetectionRunning) + .thenReturn(fpsDetectionRunning) + whenever(kosmos.keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed) + .thenReturn(isUnlockingWithFpAllowed) + mContext.orCreateTestableResources.addOverride(R.bool.config_show_sidefps_hint_on_bouncer, true) +} diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractorTest.kt new file mode 100644 index 000000000000..298b54a5be5a --- /dev/null +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractorTest.kt @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.biometrics.domain.interactor + +import android.testing.TestableLooper +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.systemui.SysuiTestCase +import com.android.systemui.biometrics.data.repository.biometricStatusRepository +import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository +import com.android.systemui.biometrics.shared.model.AuthenticationReason +import com.android.systemui.biometrics.shared.model.FingerprintSensorType +import com.android.systemui.biometrics.shared.model.SensorStrength +import com.android.systemui.biometrics.updateSfpsIndicatorRequests +import com.android.systemui.coroutines.collectLastValue +import com.android.systemui.display.data.repository.displayRepository +import com.android.systemui.display.data.repository.displayStateRepository +import com.android.systemui.kosmos.testScope +import com.android.systemui.testKosmos +import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.runCurrent +import kotlinx.coroutines.test.runTest +import org.junit.Ignore +import org.junit.Test +import org.junit.runner.RunWith + +@OptIn(ExperimentalCoroutinesApi::class) +@SmallTest +@RunWith(AndroidJUnit4::class) +@TestableLooper.RunWithLooper(setAsMainLooper = true) +class SideFpsOverlayInteractorTest : SysuiTestCase() { + private val kosmos = testKosmos() + private val underTest = kosmos.sideFpsOverlayInteractor + + @Test + fun verifyIsShowingFalse_whenInRearDisplayMode() { + kosmos.testScope.runTest { + val isShowing by collectLastValue(underTest.isShowing) + setupTestConfiguration(isInRearDisplayMode = true) + + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = true) + runCurrent() + + assertThat(isShowing).isFalse() + } + } + + @Test + fun verifyIsShowingUpdates_onPrimaryBouncerShowAndHide() { + kosmos.testScope.runTest { + val isShowing by collectLastValue(underTest.isShowing) + setupTestConfiguration(isInRearDisplayMode = false) + + // Show primary bouncer + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = true) + runCurrent() + + assertThat(isShowing).isTrue() + + // Hide primary bouncer + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = false) + runCurrent() + + assertThat(isShowing).isFalse() + } + } + + @Test + fun verifyIsShowingUpdates_onAlternateBouncerShowAndHide() { + kosmos.testScope.runTest { + val isShowing by collectLastValue(underTest.isShowing) + setupTestConfiguration(isInRearDisplayMode = false) + + updateSfpsIndicatorRequests(kosmos, mContext, alternateBouncerRequest = true) + runCurrent() + + assertThat(isShowing).isTrue() + + // Hide alternate bouncer + updateSfpsIndicatorRequests(kosmos, mContext, alternateBouncerRequest = false) + runCurrent() + + assertThat(isShowing).isFalse() + } + } + + @Test + fun verifyIsShowingUpdates_onSystemServerAuthenticationStartedAndStopped() { + kosmos.testScope.runTest { + val isShowing by collectLastValue(underTest.isShowing) + setupTestConfiguration(isInRearDisplayMode = false) + + updateSfpsIndicatorRequests(kosmos, mContext, biometricPromptRequest = true) + runCurrent() + + assertThat(isShowing).isTrue() + + // System server authentication stopped + updateSfpsIndicatorRequests(kosmos, mContext, biometricPromptRequest = false) + runCurrent() + + assertThat(isShowing).isFalse() + } + } + + // On progress bar shown - hide indicator + // On progress bar hidden - show indicator + // TODO(b/365182034): update + enable when rest to unlock feature is implemented + @Ignore("b/365182034") + @Test + fun verifyIsShowingUpdates_onProgressBarInteraction() { + kosmos.testScope.runTest { + val isShowing by collectLastValue(underTest.isShowing) + setupTestConfiguration(isInRearDisplayMode = false) + + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = true) + runCurrent() + + assertThat(isShowing).isTrue() + + // updateSfpsIndicatorRequests( + // kosmos, mContext, primaryBouncerRequest = true, progressBarShowing = + // true + // ) + runCurrent() + + assertThat(isShowing).isFalse() + + // Set progress bar invisible + // updateSfpsIndicatorRequests( + // kosmos, mContext, primaryBouncerRequest = true, progressBarShowing = + // false + // ) + runCurrent() + + // Verify indicator shown + assertThat(isShowing).isTrue() + } + } + + private suspend fun TestScope.setupTestConfiguration(isInRearDisplayMode: Boolean) { + kosmos.fingerprintPropertyRepository.setProperties( + sensorId = 1, + strength = SensorStrength.STRONG, + sensorType = FingerprintSensorType.POWER_BUTTON, + sensorLocations = emptyMap() + ) + + kosmos.displayStateRepository.setIsInRearDisplayMode(isInRearDisplayMode) + kosmos.displayRepository.emitDisplayChangeEvent(0) + runCurrent() + + kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( + AuthenticationReason.NotRunning + ) + // TODO(b/365182034): set progress bar visibility once rest to unlock feature is implemented + } +} diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderTest.kt index 7fa165c19f60..2eea6681ecca 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderTest.kt @@ -16,64 +16,48 @@ package com.android.systemui.biometrics.ui.binder -import android.animation.Animator -import android.graphics.Rect -import android.hardware.biometrics.SensorLocationInternal -import android.hardware.display.DisplayManager -import android.hardware.display.DisplayManagerGlobal import android.testing.TestableLooper -import android.view.Display -import android.view.DisplayInfo import android.view.LayoutInflater import android.view.View -import android.view.ViewPropertyAnimator -import android.view.WindowInsets import android.view.WindowManager -import android.view.WindowMetrics import android.view.layoutInflater import android.view.windowManager import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.airbnb.lottie.LottieAnimationView -import com.android.keyguard.keyguardUpdateMonitor import com.android.systemui.SysuiTestCase -import com.android.systemui.biometrics.FingerprintInteractiveToAuthProvider -import com.android.systemui.biometrics.data.repository.biometricStatusRepository import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository -import com.android.systemui.biometrics.shared.model.AuthenticationReason import com.android.systemui.biometrics.shared.model.DisplayRotation import com.android.systemui.biometrics.shared.model.FingerprintSensorType import com.android.systemui.biometrics.shared.model.SensorStrength -import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository +import com.android.systemui.biometrics.updateSfpsIndicatorRequests import com.android.systemui.display.data.repository.displayRepository import com.android.systemui.display.data.repository.displayStateRepository -import com.android.systemui.keyguard.ui.viewmodel.sideFpsProgressBarViewModel import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.testKosmos import com.android.systemui.util.mockito.eq -import com.android.systemui.util.mockito.whenever import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before +import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor import org.mockito.Mock -import org.mockito.Mockito import org.mockito.Mockito.any import org.mockito.Mockito.inOrder import org.mockito.Mockito.mock import org.mockito.Mockito.never -import org.mockito.Mockito.spy import org.mockito.Mockito.verify import org.mockito.Mockito.`when` import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule -import org.mockito.kotlin.argumentCaptor +import org.mockito.kotlin.firstValue @OptIn(ExperimentalCoroutinesApi::class) @SmallTest @@ -83,84 +67,25 @@ class SideFpsOverlayViewBinderTest : SysuiTestCase() { private val kosmos = testKosmos() @JvmField @Rule var mockitoRule: MockitoRule = MockitoJUnit.rule() - @Mock private lateinit var displayManager: DisplayManager - @Mock - private lateinit var fingerprintInteractiveToAuthProvider: FingerprintInteractiveToAuthProvider @Mock private lateinit var layoutInflater: LayoutInflater @Mock private lateinit var sideFpsView: View - - private val contextDisplayInfo = DisplayInfo() - - private var displayWidth: Int = 0 - private var displayHeight: Int = 0 - private var boundsWidth: Int = 0 - private var boundsHeight: Int = 0 - - private lateinit var deviceConfig: DeviceConfig - private lateinit var sensorLocation: SensorLocationInternal - - enum class DeviceConfig { - X_ALIGNED, - Y_ALIGNED, - } + @Captor private lateinit var viewCaptor: ArgumentCaptor @Before fun setup() { allowTestableLooperAsMainThread() // repeatWhenAttached requires the main thread - - mContext = spy(mContext) - - val resources = mContext.resources - whenever(mContext.display) - .thenReturn( - Display(mock(DisplayManagerGlobal::class.java), 1, contextDisplayInfo, resources) - ) - kosmos.layoutInflater = layoutInflater - - whenever(fingerprintInteractiveToAuthProvider.enabledForCurrentUser) - .thenReturn(MutableStateFlow(false)) - - context.addMockSystemService(DisplayManager::class.java, displayManager) context.addMockSystemService(WindowManager::class.java, kosmos.windowManager) - `when`(layoutInflater.inflate(R.layout.sidefps_view, null, false)).thenReturn(sideFpsView) `when`(sideFpsView.requireViewById(eq(R.id.sidefps_animation))) .thenReturn(mock(LottieAnimationView::class.java)) - with(mock(ViewPropertyAnimator::class.java)) { - `when`(sideFpsView.animate()).thenReturn(this) - `when`(alpha(Mockito.anyFloat())).thenReturn(this) - `when`(setStartDelay(Mockito.anyLong())).thenReturn(this) - `when`(setDuration(Mockito.anyLong())).thenReturn(this) - `when`(setListener(any())).thenAnswer { - (it.arguments[0] as Animator.AnimatorListener).onAnimationEnd( - mock(Animator::class.java) - ) - this - } - } } @Test fun verifyIndicatorNotAdded_whenInRearDisplayMode() { kosmos.testScope.runTest { - setupTestConfiguration( - DeviceConfig.X_ALIGNED, - rotation = DisplayRotation.ROTATION_0, - isInRearDisplayMode = true - ) - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.NotRunning - ) - kosmos.sideFpsProgressBarViewModel.setVisible(false) - updatePrimaryBouncer( - isShowing = true, - isAnimatingAway = false, - fpsDetectionRunning = true, - isUnlockingWithFpAllowed = true - ) - runCurrent() - + setupTestConfiguration(isInRearDisplayMode = true) + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = true) verify(kosmos.windowManager, never()).addView(any(), any()) } } @@ -168,33 +93,14 @@ class SideFpsOverlayViewBinderTest : SysuiTestCase() { @Test fun verifyIndicatorShowAndHide_onPrimaryBouncerShowAndHide() { kosmos.testScope.runTest { - setupTestConfiguration( - DeviceConfig.X_ALIGNED, - rotation = DisplayRotation.ROTATION_0, - isInRearDisplayMode = false - ) - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.NotRunning - ) - kosmos.sideFpsProgressBarViewModel.setVisible(false) - // Show primary bouncer - updatePrimaryBouncer( - isShowing = true, - isAnimatingAway = false, - fpsDetectionRunning = true, - isUnlockingWithFpAllowed = true - ) + setupTestConfiguration(isInRearDisplayMode = false) + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = true) runCurrent() verify(kosmos.windowManager).addView(any(), any()) // Hide primary bouncer - updatePrimaryBouncer( - isShowing = false, - isAnimatingAway = false, - fpsDetectionRunning = true, - isUnlockingWithFpAllowed = true - ) + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = false) runCurrent() verify(kosmos.windowManager).removeView(any()) @@ -204,30 +110,19 @@ class SideFpsOverlayViewBinderTest : SysuiTestCase() { @Test fun verifyIndicatorShowAndHide_onAlternateBouncerShowAndHide() { kosmos.testScope.runTest { - setupTestConfiguration( - DeviceConfig.X_ALIGNED, - rotation = DisplayRotation.ROTATION_0, - isInRearDisplayMode = false - ) - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.NotRunning - ) - kosmos.sideFpsProgressBarViewModel.setVisible(false) - // Show alternate bouncer - kosmos.keyguardBouncerRepository.setAlternateVisible(true) + setupTestConfiguration(isInRearDisplayMode = false) + updateSfpsIndicatorRequests(kosmos, mContext, alternateBouncerRequest = true) runCurrent() verify(kosmos.windowManager).addView(any(), any()) - var viewCaptor = argumentCaptor() verify(kosmos.windowManager).addView(viewCaptor.capture(), any()) verify(viewCaptor.firstValue) .announceForAccessibility( mContext.getText(R.string.accessibility_side_fingerprint_indicator_label) ) - // Hide alternate bouncer - kosmos.keyguardBouncerRepository.setAlternateVisible(false) + updateSfpsIndicatorRequests(kosmos, mContext, alternateBouncerRequest = false) runCurrent() verify(kosmos.windowManager).removeView(any()) @@ -237,30 +132,14 @@ class SideFpsOverlayViewBinderTest : SysuiTestCase() { @Test fun verifyIndicatorShownAndHidden_onSystemServerAuthenticationStartedAndStopped() { kosmos.testScope.runTest { - setupTestConfiguration( - DeviceConfig.X_ALIGNED, - rotation = DisplayRotation.ROTATION_0, - isInRearDisplayMode = false - ) - kosmos.sideFpsProgressBarViewModel.setVisible(false) - updatePrimaryBouncer( - isShowing = false, - isAnimatingAway = false, - fpsDetectionRunning = true, - isUnlockingWithFpAllowed = true - ) - // System server authentication started - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.BiometricPromptAuthentication - ) + setupTestConfiguration(isInRearDisplayMode = false) + updateSfpsIndicatorRequests(kosmos, mContext, biometricPromptRequest = true) runCurrent() verify(kosmos.windowManager).addView(any(), any()) // System server authentication stopped - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.NotRunning - ) + updateSfpsIndicatorRequests(kosmos, mContext, biometricPromptRequest = false) runCurrent() verify(kosmos.windowManager).removeView(any()) @@ -269,45 +148,35 @@ class SideFpsOverlayViewBinderTest : SysuiTestCase() { // On progress bar shown - hide indicator // On progress bar hidden - show indicator + // TODO(b/365182034): update + enable when rest to unlock feature is implemented + @Ignore("b/365182034") @Test fun verifyIndicatorProgressBarInteraction() { kosmos.testScope.runTest { // Pre-auth conditions - setupTestConfiguration( - DeviceConfig.X_ALIGNED, - rotation = DisplayRotation.ROTATION_0, - isInRearDisplayMode = false - ) - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.NotRunning - ) - kosmos.sideFpsProgressBarViewModel.setVisible(false) - - // Show primary bouncer - updatePrimaryBouncer( - isShowing = true, - isAnimatingAway = false, - fpsDetectionRunning = true, - isUnlockingWithFpAllowed = true - ) + setupTestConfiguration(isInRearDisplayMode = false) + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = true) runCurrent() val inOrder = inOrder(kosmos.windowManager) - // Verify indicator shown inOrder.verify(kosmos.windowManager).addView(any(), any()) // Set progress bar visible - kosmos.sideFpsProgressBarViewModel.setVisible(true) - + // updateSfpsIndicatorRequests( + // kosmos, mContext, primaryBouncerRequest = true, progressBarShowing = + // true + // ) runCurrent() // Verify indicator hidden inOrder.verify(kosmos.windowManager).removeView(any()) // Set progress bar invisible - kosmos.sideFpsProgressBarViewModel.setVisible(false) - + // updateSfpsIndicatorRequests( + // kosmos, mContext, primaryBouncerRequest = true, progressBarShowing = + // false + // ) runCurrent() // Verify indicator shown @@ -315,78 +184,18 @@ class SideFpsOverlayViewBinderTest : SysuiTestCase() { } } - private fun updatePrimaryBouncer( - isShowing: Boolean, - isAnimatingAway: Boolean, - fpsDetectionRunning: Boolean, - isUnlockingWithFpAllowed: Boolean, - ) { - kosmos.keyguardBouncerRepository.setPrimaryShow(isShowing) - kosmos.keyguardBouncerRepository.setPrimaryStartingToHide(false) - val primaryStartDisappearAnimation = if (isAnimatingAway) Runnable {} else null - kosmos.keyguardBouncerRepository.setPrimaryStartDisappearAnimation( - primaryStartDisappearAnimation - ) - - whenever(kosmos.keyguardUpdateMonitor.isFingerprintDetectionRunning) - .thenReturn(fpsDetectionRunning) - whenever(kosmos.keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed) - .thenReturn(isUnlockingWithFpAllowed) - mContext.orCreateTestableResources.addOverride( - R.bool.config_show_sidefps_hint_on_bouncer, - true - ) - } - - private suspend fun TestScope.setupTestConfiguration( - deviceConfig: DeviceConfig, - rotation: DisplayRotation = DisplayRotation.ROTATION_0, - isInRearDisplayMode: Boolean, - ) { - this@SideFpsOverlayViewBinderTest.deviceConfig = deviceConfig - - when (deviceConfig) { - DeviceConfig.X_ALIGNED -> { - displayWidth = 3000 - displayHeight = 1500 - boundsWidth = 200 - boundsHeight = 100 - sensorLocation = SensorLocationInternal("", 2500, 0, boundsWidth / 2) - } - DeviceConfig.Y_ALIGNED -> { - displayWidth = 2500 - displayHeight = 2000 - boundsWidth = 100 - boundsHeight = 200 - sensorLocation = SensorLocationInternal("", displayWidth, 300, boundsHeight / 2) - } - } - - whenever(kosmos.windowManager.maximumWindowMetrics) - .thenReturn( - WindowMetrics( - Rect(0, 0, displayWidth, displayHeight), - mock(WindowInsets::class.java), - ) - ) - - contextDisplayInfo.uniqueId = DISPLAY_ID - + private suspend fun TestScope.setupTestConfiguration(isInRearDisplayMode: Boolean) { kosmos.fingerprintPropertyRepository.setProperties( sensorId = 1, strength = SensorStrength.STRONG, sensorType = FingerprintSensorType.POWER_BUTTON, - sensorLocations = mapOf(DISPLAY_ID to sensorLocation) + sensorLocations = emptyMap() ) kosmos.displayStateRepository.setIsInRearDisplayMode(isInRearDisplayMode) - kosmos.displayStateRepository.setCurrentRotation(rotation) + kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_0) kosmos.displayRepository.emitDisplayChangeEvent(0) kosmos.sideFpsOverlayViewBinder.start() runCurrent() } - - companion object { - private const val DISPLAY_ID = "displayId" - } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelTest.kt index 0db7b62b8ef1..27b1371deb12 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelTest.kt @@ -30,23 +30,19 @@ import android.view.windowManager import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.airbnb.lottie.model.KeyPath -import com.android.keyguard.keyguardUpdateMonitor import com.android.settingslib.Utils import com.android.systemui.SysuiTestCase import com.android.systemui.biometrics.FingerprintInteractiveToAuthProvider -import com.android.systemui.biometrics.data.repository.biometricStatusRepository import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository import com.android.systemui.biometrics.domain.interactor.displayStateInteractor -import com.android.systemui.biometrics.shared.model.AuthenticationReason import com.android.systemui.biometrics.shared.model.DisplayRotation import com.android.systemui.biometrics.shared.model.FingerprintSensorType import com.android.systemui.biometrics.shared.model.LottieCallback import com.android.systemui.biometrics.shared.model.SensorStrength -import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository +import com.android.systemui.biometrics.updateSfpsIndicatorRequests import com.android.systemui.coroutines.collectLastValue import com.android.systemui.display.data.repository.displayRepository import com.android.systemui.display.data.repository.displayStateRepository -import com.android.systemui.keyguard.ui.viewmodel.sideFpsProgressBarViewModel import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.testKosmos @@ -284,17 +280,7 @@ class SideFpsOverlayViewModelTest : SysuiTestCase() { kosmos.testScope.runTest { val lottieCallbacks by collectLastValue(kosmos.sideFpsOverlayViewModel.lottieCallbacks) - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.NotRunning - ) - kosmos.sideFpsProgressBarViewModel.setVisible(false) - - updatePrimaryBouncer( - isShowing = true, - isAnimatingAway = false, - fpsDetectionRunning = true, - isUnlockingWithFpAllowed = true - ) + updateSfpsIndicatorRequests(kosmos, mContext, primaryBouncerRequest = true) runCurrent() assertThat(lottieCallbacks) @@ -312,17 +298,7 @@ class SideFpsOverlayViewModelTest : SysuiTestCase() { val lottieCallbacks by collectLastValue(kosmos.sideFpsOverlayViewModel.lottieCallbacks) setDarkMode(true) - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.BiometricPromptAuthentication - ) - kosmos.sideFpsProgressBarViewModel.setVisible(false) - - updatePrimaryBouncer( - isShowing = false, - isAnimatingAway = false, - fpsDetectionRunning = true, - isUnlockingWithFpAllowed = true - ) + updateSfpsIndicatorRequests(kosmos, mContext, biometricPromptRequest = true) runCurrent() assertThat(lottieCallbacks) @@ -338,17 +314,7 @@ class SideFpsOverlayViewModelTest : SysuiTestCase() { val lottieCallbacks by collectLastValue(kosmos.sideFpsOverlayViewModel.lottieCallbacks) setDarkMode(false) - kosmos.biometricStatusRepository.setFingerprintAuthenticationReason( - AuthenticationReason.BiometricPromptAuthentication - ) - kosmos.sideFpsProgressBarViewModel.setVisible(false) - - updatePrimaryBouncer( - isShowing = false, - isAnimatingAway = false, - fpsDetectionRunning = true, - isUnlockingWithFpAllowed = true - ) + updateSfpsIndicatorRequests(kosmos, mContext, biometricPromptRequest = true) runCurrent() assertThat(lottieCallbacks) @@ -371,29 +337,6 @@ class SideFpsOverlayViewModelTest : SysuiTestCase() { mContext.resources.configuration.uiMode = uiMode } - private fun updatePrimaryBouncer( - isShowing: Boolean, - isAnimatingAway: Boolean, - fpsDetectionRunning: Boolean, - isUnlockingWithFpAllowed: Boolean, - ) { - kosmos.keyguardBouncerRepository.setPrimaryShow(isShowing) - kosmos.keyguardBouncerRepository.setPrimaryStartingToHide(false) - val primaryStartDisappearAnimation = if (isAnimatingAway) Runnable {} else null - kosmos.keyguardBouncerRepository.setPrimaryStartDisappearAnimation( - primaryStartDisappearAnimation - ) - - whenever(kosmos.keyguardUpdateMonitor.isFingerprintDetectionRunning) - .thenReturn(fpsDetectionRunning) - whenever(kosmos.keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed) - .thenReturn(isUnlockingWithFpAllowed) - mContext.orCreateTestableResources.addOverride( - R.bool.config_show_sidefps_hint_on_bouncer, - true - ) - } - private suspend fun TestScope.setupTestConfiguration( deviceConfig: DeviceConfig, rotation: DisplayRotation = DisplayRotation.ROTATION_0, diff --git a/packages/SystemUI/res/layout/biometric_prompt_one_pane_layout.xml b/packages/SystemUI/res/layout/biometric_prompt_one_pane_layout.xml index 3b3ed39c8993..91cd019c85d1 100644 --- a/packages/SystemUI/res/layout/biometric_prompt_one_pane_layout.xml +++ b/packages/SystemUI/res/layout/biometric_prompt_one_pane_layout.xml @@ -215,17 +215,4 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="1.0" tools:srcCompat="@tools:sample/avatars" /> - - diff --git a/packages/SystemUI/res/layout/biometric_prompt_two_pane_layout.xml b/packages/SystemUI/res/layout/biometric_prompt_two_pane_layout.xml index 2a00495e9d01..51117a7845df 100644 --- a/packages/SystemUI/res/layout/biometric_prompt_two_pane_layout.xml +++ b/packages/SystemUI/res/layout/biometric_prompt_two_pane_layout.xml @@ -40,19 +40,6 @@ android:layout_height="match_parent"> app:layout_constraintTop_toTopOf="parent" tools:srcCompat="@tools:sample/avatars" /> - - +} + +@OptIn(ExperimentalCoroutinesApi::class) +class SideFpsOverlayInteractorImpl +@Inject +constructor( + biometricStatusInteractor: BiometricStatusInteractor, + displayStateInteractor: DisplayStateInteractor, + deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInteractor, + sfpsSensorInteractor: SideFpsSensorInteractor, + // TODO(b/365182034): add progress bar input when rest to unlock feature is implemented +) : SideFpsOverlayInteractor { + private val sfpsOverlayEnabled: Flow = + sfpsSensorInteractor.isAvailable.sample(displayStateInteractor.isInRearDisplayMode) { + isAvailable: Boolean, + isInRearDisplayMode: Boolean -> + isAvailable && !isInRearDisplayMode + } + + private val showSideFpsOverlay: Flow = + combine( + biometricStatusInteractor.sfpsAuthenticationReason, + deviceEntrySideFpsOverlayInteractor.showIndicatorForDeviceEntry, + // TODO(b/365182034): add progress bar input when rest to unlock feature is implemented + ) { systemServerAuthReason, showIndicatorForDeviceEntry -> + Log.d( + TAG, + "systemServerAuthReason = $systemServerAuthReason, " + + "showIndicatorForDeviceEntry = $showIndicatorForDeviceEntry, " + ) + systemServerAuthReason != NotRunning || showIndicatorForDeviceEntry + } + + override val isShowing: Flow = + sfpsOverlayEnabled + .flatMapLatest { sfpsOverlayEnabled -> + if (!sfpsOverlayEnabled) { + flowOf(false) + } else { + showSideFpsOverlay + } + } + .onEach { Log.d(TAG, "isShowing: $it") } + + companion object { + private const val TAG = "SideFpsOverlayInteractor" + } +} diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewSizeBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewSizeBinder.kt index 85c3ae3f214e..a15765e5641f 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewSizeBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewSizeBinder.kt @@ -18,13 +18,11 @@ package com.android.systemui.biometrics.ui.binder import android.animation.Animator import android.animation.AnimatorSet -import android.animation.ValueAnimator import android.graphics.Outline import android.graphics.Rect import android.transition.AutoTransition import android.transition.TransitionManager import android.util.TypedValue -import android.view.Surface import android.view.View import android.view.ViewGroup import android.view.ViewOutlineProvider @@ -160,16 +158,13 @@ object BiometricViewSizeBinder { fun setVisibilities(hideSensorIcon: Boolean, size: PromptSize) { viewsToHideWhenSmall.forEach { it.showContentOrHide(forceHide = size.isSmall) } largeConstraintSet.setVisibility(iconHolderView.id, View.GONE) - largeConstraintSet.setVisibility(R.id.biometric_icon_overlay, View.GONE) largeConstraintSet.setVisibility(R.id.indicator, View.GONE) largeConstraintSet.setVisibility(R.id.scrollView, View.GONE) if (hideSensorIcon) { smallConstraintSet.setVisibility(iconHolderView.id, View.GONE) - smallConstraintSet.setVisibility(R.id.biometric_icon_overlay, View.GONE) smallConstraintSet.setVisibility(R.id.indicator, View.GONE) mediumConstraintSet.setVisibility(iconHolderView.id, View.GONE) - mediumConstraintSet.setVisibility(R.id.biometric_icon_overlay, View.GONE) mediumConstraintSet.setVisibility(R.id.indicator, View.GONE) } } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt index 9578da4238ee..9fe1dc51f4c2 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt @@ -33,89 +33,44 @@ import com.airbnb.lottie.LottieProperty import com.android.app.animation.Interpolators import com.android.keyguard.KeyguardPINView import com.android.systemui.CoreStartable -import com.android.systemui.biometrics.domain.interactor.BiometricStatusInteractor -import com.android.systemui.biometrics.domain.interactor.DisplayStateInteractor -import com.android.systemui.biometrics.domain.interactor.SideFpsSensorInteractor -import com.android.systemui.biometrics.shared.model.AuthenticationReason.NotRunning +import com.android.systemui.biometrics.domain.interactor.SideFpsOverlayInteractor import com.android.systemui.biometrics.shared.model.LottieCallback import com.android.systemui.biometrics.ui.viewmodel.SideFpsOverlayViewModel import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application -import com.android.systemui.keyguard.domain.interactor.DeviceEntrySideFpsOverlayInteractor -import com.android.systemui.keyguard.ui.viewmodel.SideFpsProgressBarViewModel import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.res.R -import com.android.systemui.util.kotlin.sample import dagger.Lazy import javax.inject.Inject import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.flow.combine import kotlinx.coroutines.launch /** Binds the side fingerprint sensor indicator view to [SideFpsOverlayViewModel]. */ -@OptIn(ExperimentalCoroutinesApi::class) @SysUISingleton class SideFpsOverlayViewBinder @Inject constructor( @Application private val applicationScope: CoroutineScope, @Application private val applicationContext: Context, - private val biometricStatusInteractor: Lazy, - private val displayStateInteractor: Lazy, - private val deviceEntrySideFpsOverlayInteractor: Lazy, private val layoutInflater: Lazy, - private val sideFpsProgressBarViewModel: Lazy, - private val sfpsSensorInteractor: Lazy, + private val sideFpsOverlayInteractor: Lazy, + private val sideFpsOverlayViewModel: Lazy, private val windowManager: Lazy ) : CoreStartable { + private var overlayView: View? = null override fun start() { - applicationScope - .launch { - sfpsSensorInteractor.get().isAvailable.collect { isSfpsAvailable -> - if (isSfpsAvailable) { - combine( - biometricStatusInteractor.get().sfpsAuthenticationReason, - deviceEntrySideFpsOverlayInteractor - .get() - .showIndicatorForDeviceEntry, - sideFpsProgressBarViewModel.get().isVisible, - ::Triple - ) - .sample(displayStateInteractor.get().isInRearDisplayMode, ::Pair) - .collect { (combinedFlows, isInRearDisplayMode: Boolean) -> - val ( - systemServerAuthReason, - showIndicatorForDeviceEntry, - progressBarIsVisible) = - combinedFlows - Log.d( - TAG, - "systemServerAuthReason = $systemServerAuthReason, " + - "showIndicatorForDeviceEntry = " + - "$showIndicatorForDeviceEntry, " + - "progressBarIsVisible = $progressBarIsVisible" - ) - if (!isInRearDisplayMode) { - if (progressBarIsVisible) { - hide() - } else if (systemServerAuthReason != NotRunning) { - show() - } else if (showIndicatorForDeviceEntry) { - show() - } else { - hide() - } - } - } - } + applicationScope.launch { + sideFpsOverlayInteractor.get().isShowing.collect { isShowing: Boolean -> + if (isShowing) { + show() + } else { + hide() } } + } } - private var overlayView: View? = null - /** Show the side fingerprint sensor indicator */ private fun show() { if (overlayView?.isAttachedToWindow == true) { @@ -125,17 +80,10 @@ constructor( ) return } - overlayView = layoutInflater.get().inflate(R.layout.sidefps_view, null, false) - - val overlayViewModel = - SideFpsOverlayViewModel( - applicationContext, - deviceEntrySideFpsOverlayInteractor.get(), - displayStateInteractor.get(), - sfpsSensorInteractor.get(), - ) + val overlayViewModel = sideFpsOverlayViewModel.get() bind(overlayView!!, overlayViewModel, windowManager.get()) + overlayView!!.visibility = View.INVISIBLE Log.d(TAG, "show(): adding overlayView $overlayView") windowManager.get().addView(overlayView, overlayViewModel.defaultOverlayViewParams) @@ -161,6 +109,20 @@ constructor( companion object { private const val TAG = "SideFpsOverlayViewBinder" + private val accessibilityDelegate = + object : View.AccessibilityDelegate() { + override fun dispatchPopulateAccessibilityEvent( + host: View, + event: AccessibilityEvent + ): Boolean { + return if (event.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) { + true + } else { + super.dispatchPopulateAccessibilityEvent(host, event) + } + } + } + /** Binds overlayView (side fingerprint sensor indicator view) to SideFpsOverlayViewModel */ fun bind( overlayView: View, @@ -184,24 +146,7 @@ constructor( overlayShowAnimator.start() - it.setAccessibilityDelegate( - object : View.AccessibilityDelegate() { - override fun dispatchPopulateAccessibilityEvent( - host: View, - event: AccessibilityEvent - ): Boolean { - return if ( - event.getEventType() === - android.view.accessibility.AccessibilityEvent - .TYPE_WINDOW_STATE_CHANGED - ) { - true - } else { - super.dispatchPopulateAccessibilityEvent(host, event) - } - } - } - ) + it.accessibilityDelegate = accessibilityDelegate repeatOnLifecycle(Lifecycle.State.STARTED) { launch { diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt index 4c2fe07f92bb..90cd86f72140 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt @@ -74,11 +74,11 @@ import kotlinx.coroutines.launch class PromptViewModel @Inject constructor( - displayStateInteractor: DisplayStateInteractor, + private val displayStateInteractor: DisplayStateInteractor, private val promptSelectorInteractor: PromptSelectorInteractor, @Application private val context: Context, - private val udfpsOverlayInteractor: UdfpsOverlayInteractor, - private val biometricStatusInteractor: BiometricStatusInteractor, + udfpsOverlayInteractor: UdfpsOverlayInteractor, + biometricStatusInteractor: BiometricStatusInteractor, private val udfpsUtils: UdfpsUtils, private val iconProvider: IconProvider, private val activityTaskManager: ActivityTaskManager, @@ -131,11 +131,13 @@ constructor( R.dimen.biometric_prompt_landscape_medium_horizontal_padding ) + val currentRotation: StateFlow = displayStateInteractor.currentRotation + val udfpsOverlayParams: StateFlow = udfpsOverlayInteractor.udfpsOverlayParams private val udfpsSensorBounds: Flow = - combine(udfpsOverlayParams, displayStateInteractor.currentRotation) { params, rotation -> + combine(udfpsOverlayParams, currentRotation) { params, rotation -> val rotatedBounds = Rect(params.sensorBounds) RotationUtils.rotateBounds( rotatedBounds, @@ -257,7 +259,7 @@ constructor( _forceLargeSize, promptKind, displayStateInteractor.isLargeScreen, - displayStateInteractor.currentRotation, + currentRotation, modalities ) { forceLarge, promptKind, isLargeScreen, rotation, modalities -> when { @@ -449,7 +451,7 @@ constructor( /** Padding for prompt UI elements */ val promptPadding: Flow = - combine(size, displayStateInteractor.currentRotation) { size, rotation -> + combine(size, currentRotation) { size, rotation -> if (size != PromptSize.LARGE) { val navBarInsets = Utils.getNavbarInsets(context) if (rotation == DisplayRotation.ROTATION_90) { diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModel.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModel.kt index c2a4ee36dec6..7c1984e506c9 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModel.kt @@ -147,8 +147,7 @@ constructor( _lottieBounds, sensorLocation, displayRotation, - ) { bounds: Rect?, sensorLocation: SideFpsSensorLocation, displayRotation: DisplayRotation - -> + ) { _: Rect?, sensorLocation: SideFpsSensorLocation, _: DisplayRotation -> val topLeft = Point(sensorLocation.left, sensorLocation.top) defaultOverlayViewParams.apply { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModel.kt index c5909ed24c50..75e38714f1fa 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModel.kt @@ -107,6 +107,8 @@ constructor( } } + // TODO(b/365182034): move to interactor, add as dependency of SideFpsOverlayInteractor when + // rest to unlock feature is implemented val isVisible: Flow = _visible.asStateFlow() val progress: Flow = _progress.asStateFlow() diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt index 4fc41669b2c9..95d964cdcba8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt @@ -51,6 +51,7 @@ import com.android.systemui.biometrics.data.repository.biometricStatusRepository import com.android.systemui.biometrics.data.repository.fakeFingerprintPropertyRepository import com.android.systemui.biometrics.domain.interactor.PromptSelectorInteractor import com.android.systemui.biometrics.domain.interactor.promptSelectorInteractor +import com.android.systemui.biometrics.domain.interactor.sideFpsOverlayInteractor import com.android.systemui.biometrics.domain.interactor.udfpsOverlayInteractor import com.android.systemui.biometrics.extractAuthenticatorTypes import com.android.systemui.biometrics.faceSensorPropertiesInternal @@ -1330,11 +1331,15 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa @Test fun switch_to_credential_fallback() = runGenericTest { val size by collectLastValue(kosmos.promptViewModel.size) + val isShowingSfpsIndicator by collectLastValue(kosmos.sideFpsOverlayInteractor.isShowing) // TODO(b/251476085): remove Spaghetti, migrate logic, and update this test kosmos.promptViewModel.onSwitchToCredential() assertThat(size).isEqualTo(PromptSize.LARGE) + if (testCase.modalities.hasSfps) { + assertThat(isShowingSfpsIndicator).isFalse() + } } @Test diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractorKosmos.kt new file mode 100644 index 000000000000..15c7e25f8a5c --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/domain/interactor/SideFpsOverlayInteractorKosmos.kt @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.biometrics.domain.interactor + +import com.android.systemui.keyguard.domain.interactor.deviceEntrySideFpsOverlayInteractor +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.Kosmos.Fixture +import kotlinx.coroutines.ExperimentalCoroutinesApi + +@OptIn(ExperimentalCoroutinesApi::class) +val Kosmos.sideFpsOverlayInteractor by Fixture { + SideFpsOverlayInteractorImpl( + biometricStatusInteractor, + displayStateInteractor, + deviceEntrySideFpsOverlayInteractor, + sideFpsSensorInteractor, + ) +} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderKosmos.kt index 79d58a1d4e40..59809e3d253f 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderKosmos.kt @@ -19,27 +19,19 @@ package com.android.systemui.biometrics.ui.binder import android.content.applicationContext import android.view.layoutInflater import android.view.windowManager -import com.android.systemui.biometrics.domain.interactor.biometricStatusInteractor -import com.android.systemui.biometrics.domain.interactor.displayStateInteractor -import com.android.systemui.biometrics.domain.interactor.sideFpsSensorInteractor -import com.android.systemui.keyguard.domain.interactor.deviceEntrySideFpsOverlayInteractor -import com.android.systemui.keyguard.ui.viewmodel.sideFpsProgressBarViewModel +import com.android.systemui.biometrics.domain.interactor.sideFpsOverlayInteractor +import com.android.systemui.biometrics.ui.viewmodel.sideFpsOverlayViewModel import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.applicationCoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi -@OptIn(ExperimentalCoroutinesApi::class) val Kosmos.sideFpsOverlayViewBinder by Fixture { SideFpsOverlayViewBinder( - applicationScope = applicationCoroutineScope, - applicationContext = applicationContext, - { biometricStatusInteractor }, - { displayStateInteractor }, - { deviceEntrySideFpsOverlayInteractor }, + applicationCoroutineScope, + applicationContext, { layoutInflater }, - { sideFpsProgressBarViewModel }, - { sideFpsSensorInteractor }, + { sideFpsOverlayInteractor }, + { sideFpsOverlayViewModel }, { windowManager } ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelKosmos.kt index de038559fc38..e10b2dd6497d 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelKosmos.kt @@ -27,9 +27,9 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi @OptIn(ExperimentalCoroutinesApi::class) val Kosmos.sideFpsOverlayViewModel by Fixture { SideFpsOverlayViewModel( - applicationContext = applicationContext, - deviceEntrySideFpsOverlayInteractor = deviceEntrySideFpsOverlayInteractor, - displayStateInteractor = displayStateInteractor, - sfpsSensorInteractor = sideFpsSensorInteractor, + applicationContext, + deviceEntrySideFpsOverlayInteractor, + displayStateInteractor, + sideFpsSensorInteractor, ) } -- GitLab From 58afb907c0e3d62441725f036371c00b0cd52f1a Mon Sep 17 00:00:00 2001 From: Brad Hinegardner Date: Thu, 5 Sep 2024 09:59:12 -0400 Subject: [PATCH 142/492] Allow non-interactive click on lockscreen to show bouncer Clicking anywhere non-interactive on lockscreen will now show the bouncer. This works with trackpad, mouse, or any pointing device that can perform a PRIMARY_BUTTON action, that is not a SOURCE_TOUCHSCREEN. This may include gamepads, trackballs, and many other devices besides just mice and trackpads. This retains the existing functionality of finger-tapping a non-interactive location not pulling up the bouncer. Fixes: 319809270 Test: manual - tested on tablet with trackpad attached Test: manual - tested on tablet with mouse attached Flag: com.android.systemui.non_touchscreen_devices_bypass_falsing Change-Id: I1f9ad3217a40077a95f0a1fb5e474dce137ac35c --- .../keyguard/KeyguardViewConfigurator.kt | 3 ++ .../ui/binder/KeyguardRootViewBinder.kt | 29 ++++++++++++++++++- .../ui/preview/KeyguardPreviewRenderer.kt | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt index 362e016cc97c..df0f10acac1f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt @@ -71,6 +71,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.KeyguardIndicationController import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.statusbar.phone.ScreenOffAnimationController +import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.google.android.msdl.domain.MSDLPlayer import dagger.Lazy @@ -112,6 +113,7 @@ constructor( private val clockInteractor: KeyguardClockInteractor, private val keyguardViewMediator: KeyguardViewMediator, private val deviceEntryUnlockTrackerViewBinder: Optional, + private val statusBarKeyguardViewManager: StatusBarKeyguardViewManager, @Main private val mainDispatcher: CoroutineDispatcher, private val msdlPlayer: MSDLPlayer, ) : CoreStartable { @@ -220,6 +222,7 @@ constructor( vibratorHelper, falsingManager, keyguardViewMediator, + statusBarKeyguardViewManager, mainDispatcher, msdlPlayer, ) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt index 5bb7b6425729..ed82159e6160 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt @@ -24,6 +24,8 @@ import android.graphics.Point import android.graphics.Rect import android.util.Log import android.view.HapticFeedbackConstants +import android.view.InputDevice +import android.view.MotionEvent import android.view.View import android.view.View.OnLayoutChangeListener import android.view.View.VISIBLE @@ -41,6 +43,7 @@ import com.android.app.tracing.coroutines.launch import com.android.internal.jank.InteractionJankMonitor import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD import com.android.keyguard.AuthInteractionProperties +import com.android.systemui.Flags import com.android.systemui.Flags.msdlFeedback import com.android.systemui.Flags.newAodTransition import com.android.systemui.common.shared.model.Icon @@ -73,6 +76,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.CrossFadeHelper import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.statusbar.phone.ScreenOffAnimationController +import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager import com.android.systemui.temporarydisplay.ViewPriority import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.temporarydisplay.chipbar.ChipbarInfo @@ -115,6 +119,7 @@ object KeyguardRootViewBinder { vibratorHelper: VibratorHelper?, falsingManager: FalsingManager?, keyguardViewMediator: KeyguardViewMediator?, + statusBarKeyguardViewManager: StatusBarKeyguardViewManager?, mainImmediateDispatcher: CoroutineDispatcher, msdlPlayer: MSDLPlayer?, ): DisposableHandle { @@ -124,12 +129,30 @@ object KeyguardRootViewBinder { if (KeyguardBottomAreaRefactor.isEnabled) { disposables += view.onTouchListener { _, event -> + var consumed = false if (falsingManager?.isFalseTap(FalsingManager.LOW_PENALTY) == false) { + // signifies a primary button click down has reached keyguardrootview + // we need to return true here otherwise an ACTION_UP will never arrive + if (Flags.nonTouchscreenDevicesBypassFalsing()) { + if ( + event.action == MotionEvent.ACTION_DOWN && + event.buttonState == MotionEvent.BUTTON_PRIMARY && + !event.isTouchscreenSource() + ) { + consumed = true + } else if ( + event.action == MotionEvent.ACTION_UP && + !event.isTouchscreenSource() + ) { + statusBarKeyguardViewManager?.showBouncer(true) + consumed = true + } + } viewModel.setRootViewLastTapPosition( Point(event.x.toInt(), event.y.toInt()) ) } - false + consumed } } @@ -637,6 +660,10 @@ object KeyguardRootViewBinder { } } + private fun MotionEvent.isTouchscreenSource(): Boolean { + return device?.supportsSource(InputDevice.SOURCE_TOUCHSCREEN) == true + } + private fun ViewPropertyAnimator.animateInIconTranslation(): ViewPropertyAnimator = setInterpolator(Interpolators.DECELERATE_QUINT).translationY(0f) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt index f581a2e24546..0b8f7417a49d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt @@ -417,6 +417,7 @@ constructor( null, // device entry haptics not required for preview mode null, // falsing manager not required for preview mode null, // keyguard view mediator is not required for preview mode + null, // primary bouncer interactor is not required for preview mode mainDispatcher, null, ) -- GitLab From 61564444db47d9ebd80484d2baaf2f646a269db3 Mon Sep 17 00:00:00 2001 From: Brad Hinegardner Date: Fri, 26 Jul 2024 15:20:19 -0400 Subject: [PATCH 143/492] Allow any non-touchscreen device click to bypass long-press need for shortcuts Previously only mouse and stylus were able to avoid having to long-press to activate a shortcut. Inversely, we only want the touchscreen to require a long-press, which this adjusts to. This allows for trackpads, game pads, trackballs, and many other accurate devices to activate the shortcuts without having to long-press. Fixes: 355692248 Test: manual - tested on tablet with trackpad attached Test: manual - tested on tablet with mouse attached Flag: com.android.systemui.non_touchscreen_devices_bypass_falsing Change-Id: I175cbf79834b48d21b20ff42320d8889bd9e26a4 --- .../KeyguardQuickAffordanceOnTouchListener.kt | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt index f2d39dabb1b5..ecfabc3e18ce 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt @@ -18,13 +18,12 @@ package com.android.systemui.keyguard.ui.binder import android.annotation.SuppressLint import android.graphics.PointF +import android.view.InputDevice import android.view.MotionEvent import android.view.View import android.view.ViewConfiguration import android.view.ViewPropertyAnimator -import androidx.core.animation.CycleInterpolator -import androidx.core.animation.ObjectAnimator -import com.android.systemui.res.R +import com.android.systemui.Flags import com.android.systemui.animation.Expandable import com.android.systemui.common.ui.view.rawDistanceFrom import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewModel @@ -71,11 +70,10 @@ class KeyguardQuickAffordanceOnTouchListener( // Moving too far while performing a long-press gesture cancels that // gesture. if ( - event - .rawDistanceFrom( - downDisplayCoords.x, - downDisplayCoords.y, - ) > ViewConfiguration.getTouchSlop() + event.rawDistanceFrom( + downDisplayCoords.x, + downDisplayCoords.y, + ) > ViewConfiguration.getTouchSlop() ) { cancel() } @@ -151,10 +149,14 @@ class KeyguardQuickAffordanceOnTouchListener( event: MotionEvent, pointerIndex: Int = 0, ): Boolean { - return when (event.getToolType(pointerIndex)) { - MotionEvent.TOOL_TYPE_STYLUS -> true - MotionEvent.TOOL_TYPE_MOUSE -> true - else -> false + return if (Flags.nonTouchscreenDevicesBypassFalsing()) { + event.device?.supportsSource(InputDevice.SOURCE_TOUCHSCREEN) == false + } else { + when (event.getToolType(pointerIndex)) { + MotionEvent.TOOL_TYPE_STYLUS -> true + MotionEvent.TOOL_TYPE_MOUSE -> true + else -> false + } } } } -- GitLab From 973ae236140156753de4c6b51d575918fcf51c70 Mon Sep 17 00:00:00 2001 From: Jyotiraditya Panda Date: Thu, 1 Aug 2024 19:29:04 +0530 Subject: [PATCH 144/492] SystemUI: Switch to Kotlin alternatives for java.lang annotations Test: build and check for warnings/errors Change-Id: I3f4d3a7c9d6de7a76c381ebaa6828fa576abad80 Signed-off-by: Jyotiraditya Panda --- .../android/systemui/dagger/qualifiers/DisplaySpecific.kt | 5 +---- .../src/com/android/systemui/log/dagger/BouncerTableLog.kt | 5 +---- .../com/android/systemui/qs/pipeline/dagger/QSTileListLog.kt | 4 +--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/dagger/qualifiers/DisplaySpecific.kt b/packages/SystemUI/shared/src/com/android/systemui/dagger/qualifiers/DisplaySpecific.kt index 57a49c83ae17..3e39ae9a3fe5 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/dagger/qualifiers/DisplaySpecific.kt +++ b/packages/SystemUI/shared/src/com/android/systemui/dagger/qualifiers/DisplaySpecific.kt @@ -15,10 +15,7 @@ */ package com.android.systemui.dagger.qualifiers -import java.lang.annotation.Documented -import java.lang.annotation.Retention -import java.lang.annotation.RetentionPolicy.RUNTIME import javax.inject.Qualifier /** Annotates a class that is display specific. */ -@Qualifier @Documented @Retention(RUNTIME) annotation class DisplaySpecific +@Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class DisplaySpecific diff --git a/packages/SystemUI/src/com/android/systemui/log/dagger/BouncerTableLog.kt b/packages/SystemUI/src/com/android/systemui/log/dagger/BouncerTableLog.kt index 08df7db65af1..9f893e073cb1 100644 --- a/packages/SystemUI/src/com/android/systemui/log/dagger/BouncerTableLog.kt +++ b/packages/SystemUI/src/com/android/systemui/log/dagger/BouncerTableLog.kt @@ -16,10 +16,7 @@ package com.android.systemui.log.dagger -import java.lang.annotation.Documented -import java.lang.annotation.Retention -import java.lang.annotation.RetentionPolicy import javax.inject.Qualifier /** Logger for the primary and alternative bouncers. */ -@Qualifier @Documented @Retention(RetentionPolicy.RUNTIME) annotation class BouncerTableLog +@Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class BouncerTableLog diff --git a/packages/SystemUI/src/com/android/systemui/qs/pipeline/dagger/QSTileListLog.kt b/packages/SystemUI/src/com/android/systemui/qs/pipeline/dagger/QSTileListLog.kt index c56ca8c27a1f..d50374b3c24c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/pipeline/dagger/QSTileListLog.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/pipeline/dagger/QSTileListLog.kt @@ -15,9 +15,7 @@ */ package com.android.systemui.qs.pipeline.dagger -import java.lang.annotation.Retention -import java.lang.annotation.RetentionPolicy import javax.inject.Qualifier /** A [LogBuffer] for the new QS Pipeline for logging changes to the set of current tiles. */ -@Qualifier @MustBeDocumented @Retention(RetentionPolicy.RUNTIME) annotation class QSTileListLog +@Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class QSTileListLog -- GitLab From 9bfeab04216c760003acc0ed745be27896e532b1 Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Mon, 9 Sep 2024 20:30:58 +0000 Subject: [PATCH 145/492] Add test mapping for running CTS in postsubmit for system-server changes. Change-Id: Id4740e58743aed23e57e3926e73efda3ecd481dc Flag: EXEMPT adding a postsubmit Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 --- services/appfunctions/TEST_MAPPING | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/appfunctions/TEST_MAPPING b/services/appfunctions/TEST_MAPPING index c7f5eeef8fa0..91e82ec0e95b 100644 --- a/services/appfunctions/TEST_MAPPING +++ b/services/appfunctions/TEST_MAPPING @@ -2,6 +2,9 @@ "postsubmit": [ { "name": "FrameworksAppFunctionsTests" + }, + { + "name": "CtsAppFunctionTestCases" } ] } \ No newline at end of file -- GitLab From bc966a7c52ff8c0fc9d86e8b27e76d5ed615f5ed Mon Sep 17 00:00:00 2001 From: Eghosa Ewansiha-Vlachavas Date: Mon, 9 Sep 2024 16:32:31 +0000 Subject: [PATCH 146/492] Add scaled resizing flag to desktop mode flags Flag: NONE(not applicable) Fix: 365589432 Test: atest WMShellUnitTests:DesktopModeFlagsTest Change-Id: I12dde213f2647b154d1b53a8acd0296e11b2a6c5 --- .../com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt index 424d4bf5c6e8..b5d63bd6addc 100644 --- a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt @@ -49,6 +49,7 @@ enum class DesktopModeFlags( SIZE_CONSTRAINTS(Flags::enableDesktopWindowingSizeConstraints, true), DISABLE_SNAP_RESIZE(Flags::disableNonResizableAppSnapResizing, true), DYNAMIC_INITIAL_BOUNDS(Flags::enableWindowingDynamicInitialBounds, false), + SCALED_RESIZING(Flags::enableWindowingScaledResizing, false), ENABLE_DESKTOP_WINDOWING_TASK_LIMIT(Flags::enableDesktopWindowingTaskLimit, true), BACK_NAVIGATION(Flags::enableDesktopWindowingBackNavigation, true), EDGE_DRAG_RESIZE(Flags::enableWindowingEdgeDragResize, true), -- GitLab From e40dcd9ec3527ef1e5c329a6aa5f63798a6e2971 Mon Sep 17 00:00:00 2001 From: "Liana Kazanova (xWF)" Date: Mon, 9 Sep 2024 21:18:28 +0000 Subject: [PATCH 147/492] Revert "Code refactoring: Move doRename out of preparePackageLI" This reverts commit 0d206610fa394037a958be5052d372a035d5c840. Reason for revert: Droidmonitor: Potential culprit for http://b/365577530 - verifying through ABTD before submission. Change-Id: I106b8d69cd85a444ae2073ce6b7d71e00968263e --- .../internal/pm/parsing/pkg/PackageImpl.java | 1 - .../server/pm/InstallPackageHelper.java | 87 +++++++------------ 2 files changed, 29 insertions(+), 59 deletions(-) diff --git a/core/java/com/android/internal/pm/parsing/pkg/PackageImpl.java b/core/java/com/android/internal/pm/parsing/pkg/PackageImpl.java index 032ac4283712..12d326486e77 100644 --- a/core/java/com/android/internal/pm/parsing/pkg/PackageImpl.java +++ b/core/java/com/android/internal/pm/parsing/pkg/PackageImpl.java @@ -3025,7 +3025,6 @@ public class PackageImpl implements ParsedPackage, AndroidPackageInternal, @Override public PackageImpl setSplitCodePaths(@Nullable String[] splitCodePaths) { this.splitCodePaths = splitCodePaths; - this.mSplits = null; // reset for paths changed if (splitCodePaths != null) { int size = splitCodePaths.length; for (int index = 0; index < size; index++) { diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java index 2c3f6ea3d9f7..43a285cba4b9 100644 --- a/services/core/java/com/android/server/pm/InstallPackageHelper.java +++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java @@ -1019,9 +1019,7 @@ final class InstallPackageHelper { && scanInstallPackages(requests, createdAppId, versionInfos)) { List reconciledPackages = reconcileInstallPackages(requests, versionInfos); - if (reconciledPackages != null - && renameAndUpdatePaths(requests) - && commitInstallPackages(reconciledPackages)) { + if (reconciledPackages != null && commitInstallPackages(reconciledPackages)) { success = true; } } @@ -1031,49 +1029,24 @@ final class InstallPackageHelper { } } - private boolean renameAndUpdatePaths(List requests) { + private boolean prepareInstallPackages(List requests) { + // TODO: will remove the locking after doRename is moved out of prepare try (PackageManagerTracedLock installLock = mPm.mInstallLock.acquireLock()) { for (InstallRequest request : requests) { - ParsedPackage parsedPackage = request.getParsedPackage(); - final boolean isApex = (request.getScanFlags() & SCAN_AS_APEX) != 0; - if (isApex) { - continue; - } try { - doRenameLI(request, parsedPackage); - setUpFsVerity(parsedPackage); - } catch (Installer.InstallerException | IOException | DigestException - | NoSuchAlgorithmException | PrepareFailure e) { - request.setError(PackageManagerException.INTERNAL_ERROR_VERITY_SETUP, - "Failed to set up verity: " + e); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "preparePackage"); + request.onPrepareStarted(); + preparePackageLI(request); + } catch (PrepareFailure prepareFailure) { + request.setError(prepareFailure.error, + prepareFailure.getMessage()); + request.setOriginPackage(prepareFailure.mConflictingPackage); + request.setOriginPermission(prepareFailure.mConflictingPermission); return false; + } finally { + request.onPrepareFinished(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } - - // update paths that are set before renaming - PackageSetting scannedPackageSetting = request.getScannedPackageSetting(); - scannedPackageSetting.setPath(new File(parsedPackage.getPath())); - scannedPackageSetting.setLegacyNativeLibraryPath( - parsedPackage.getNativeLibraryRootDir()); - } - return true; - } - } - - private boolean prepareInstallPackages(List requests) { - for (InstallRequest request : requests) { - try { - Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "preparePackage"); - request.onPrepareStarted(); - preparePackage(request); - } catch (PrepareFailure prepareFailure) { - request.setError(prepareFailure.error, - prepareFailure.getMessage()); - request.setOriginPackage(prepareFailure.mConflictingPackage); - request.setOriginPermission(prepareFailure.mConflictingPermission); - return false; - } finally { - request.onPrepareFinished(); - Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } } return true; @@ -1258,7 +1231,8 @@ final class InstallPackageHelper { return newProp != null && newProp.getBoolean(); } - private void preparePackage(InstallRequest request) throws PrepareFailure { + @GuardedBy("mPm.mInstallLock") + private void preparePackageLI(InstallRequest request) throws PrepareFailure { final int[] allUsers = mPm.mUserManager.getUserIds(); final int installFlags = request.getInstallFlags(); final boolean onExternal = request.getVolumeUuid() != null; @@ -1765,7 +1739,18 @@ final class InstallPackageHelper { } } - if (isApex) { + if (!isApex) { + doRenameLI(request, parsedPackage); + + try { + setUpFsVerity(parsedPackage); + } catch (Installer.InstallerException | IOException | DigestException + | NoSuchAlgorithmException e) { + throw PrepareFailure.ofInternalError( + "Failed to set up verity: " + e, + PackageManagerException.INTERNAL_ERROR_VERITY_SETUP); + } + } else { // Use the path returned by apexd parsedPackage.setPath(request.getApexInfo().modulePath); parsedPackage.setBaseApkPath(request.getApexInfo().modulePath); @@ -2101,21 +2086,7 @@ final class InstallPackageHelper { // Reflect the rename in scanned details try { - String afterCanonicalPath = afterCodeFile.getCanonicalPath(); - String beforeCanonicalPath = beforeCodeFile.getCanonicalPath(); - parsedPackage.setPath(afterCanonicalPath); - - parsedPackage.setNativeLibraryDir( - parsedPackage.getNativeLibraryDir() - .replace(beforeCanonicalPath, afterCanonicalPath)); - parsedPackage.setNativeLibraryRootDir( - parsedPackage.getNativeLibraryRootDir() - .replace(beforeCanonicalPath, afterCanonicalPath)); - String secondaryNativeLibraryDir = parsedPackage.getSecondaryNativeLibraryDir(); - if (secondaryNativeLibraryDir != null) { - parsedPackage.setSecondaryNativeLibraryDir( - secondaryNativeLibraryDir.replace(beforeCanonicalPath, afterCanonicalPath)); - } + parsedPackage.setPath(afterCodeFile.getCanonicalPath()); } catch (IOException e) { Slog.e(TAG, "Failed to get path: " + afterCodeFile, e); throw new PrepareFailure(PackageManager.INSTALL_FAILED_MEDIA_UNAVAILABLE, -- GitLab From 89fac7941d08f98df38a908c5f0a1a714519f3e0 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Thu, 5 Sep 2024 17:04:24 -0700 Subject: [PATCH 148/492] Introduce RavenwoodConfig - Now RavenwoodRule is deprecated, and we use RavenwoodConfig instead. - If a test has a @RavenwoodConfig.Config field, we automatically extract the configuration from it. ``` @RavenwoodConfig.Config public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder() .build(); ``` - RC doesn't provide getContext() / getInstrumentation(). Tests will now use InstrumentationRegistry. - Previously, with RavenwoodRule, the environment was initialized and reset for each test method, but now we do so at the class level, before the inner runner starts. This makes each test less hermetic, but it's closer to how the real test works. - We can introduce a hermetic mode later, if needed, which would be a RavenwoodConfig parameter. - So far, "bad config tests" can't be done automatically. I'll work on the tests as a follow-up. Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh Flag: EXEMPT host test change only Bug: 356918135 Change-Id: I6727ef814e8b8c643e6c79f6d9fc8c7f749e6fea --- ravenwood/TEST_MAPPING | 4 + .../bivalenttest/RavenwoodConfigTest.java | 50 ++ .../RavenwoodMultipleRuleTest.java | 57 +++ .../RavenwoodAfterClassFailureTest.java | 70 --- ...nwoodBeforeClassAssumptionFailureTest.java | 66 --- .../RavenwoodBeforeClassFailureTest.java | 71 --- ...venwoodClassRuleAssumptionFailureTest.java | 78 --- .../RavenwoodClassRuleFailureTest.java | 79 --- .../RavenwoodAwareTestRunnerHook.java | 101 ++-- .../test/ravenwood/RavenwoodRunnerState.java | 252 ++++++++++ ...avenwoodRuntimeEnvironmentController.java} | 96 +++- .../test/ravenwood/RavenwoodSystemServer.java | 10 +- .../test/ravenwood/RavenwoodTestStats.java | 26 +- .../ravenwood/RavenwoodAwareTestRunner.java | 101 +++- .../test/ravenwood/RavenwoodConfig.java | 184 +++++++ .../test/ravenwood/RavenwoodRule.java | 129 ++--- .../RavenwoodAwareTestRunnerHook.java | 28 +- .../test/ravenwood/RavenwoodRuleImpl.java | 37 -- .../common/RavenwoodCommonUtils.java | 13 + ravenwood/tests/coretest/Android.bp | 25 + .../RavenwoodRunnerCallbackTest.java | 356 ++++++++++++++ .../RavenwoodRunnerConfigValidationTest.java | 452 ++++++++++++++++++ .../RavenwoodRunnerTestBase.java | 220 +++++++++ 23 files changed, 1933 insertions(+), 572 deletions(-) create mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodConfigTest.java create mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodMultipleRuleTest.java delete mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodAfterClassFailureTest.java delete mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassAssumptionFailureTest.java delete mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassFailureTest.java delete mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleAssumptionFailureTest.java delete mode 100644 ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleFailureTest.java create mode 100644 ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java rename ravenwood/junit-impl-src/android/platform/test/ravenwood/{RavenwoodRuleImpl.java => RavenwoodRuntimeEnvironmentController.java} (73%) create mode 100644 ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java delete mode 100644 ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java create mode 100644 ravenwood/tests/coretest/Android.bp create mode 100644 ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerCallbackTest.java create mode 100644 ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerConfigValidationTest.java create mode 100644 ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerTestBase.java diff --git a/ravenwood/TEST_MAPPING b/ravenwood/TEST_MAPPING index 469759bc4b40..7f9d9c29484c 100644 --- a/ravenwood/TEST_MAPPING +++ b/ravenwood/TEST_MAPPING @@ -141,6 +141,10 @@ "name": "RavenwoodBivalentTest", "host": true }, + { + "name": "RavenwoodCoreTest", + "host": true + }, { "name": "RavenwoodMinimumTest", "host": true diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodConfigTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodConfigTest.java new file mode 100644 index 000000000000..a5a16c14600b --- /dev/null +++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodConfigTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.bivalenttest; + +import static android.platform.test.ravenwood.RavenwoodConfig.isOnRavenwood; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assume.assumeTrue; + +import android.platform.test.ravenwood.RavenwoodConfig; + +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; + +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Test to make sure the config field is used. + */ +@RunWith(AndroidJUnit4.class) +public class RavenwoodConfigTest { + private static final String PACKAGE_NAME = "com.test"; + + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig = + new RavenwoodConfig.Builder() + .setPackageName(PACKAGE_NAME) + .build(); + + @Test + public void testConfig() { + assumeTrue(isOnRavenwood()); + assertEquals(PACKAGE_NAME, + InstrumentationRegistry.getInstrumentation().getContext().getPackageName()); + } +} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodMultipleRuleTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodMultipleRuleTest.java new file mode 100644 index 000000000000..c25d2b4cbc4d --- /dev/null +++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodMultipleRuleTest.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.bivalenttest; + +import android.platform.test.ravenwood.RavenwoodConfig; +import android.platform.test.ravenwood.RavenwoodRule; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Assume; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; + +/** + * Make sure having multiple RavenwoodRule's is detected. + * (But only when running on ravenwod. Otherwise it'll be ignored.) + */ +@RunWith(AndroidJUnit4.class) +public class RavenwoodMultipleRuleTest { + + @Rule(order = Integer.MIN_VALUE) + public final ExpectedException mExpectedException = ExpectedException.none(); + + @Rule + public final RavenwoodRule mRavenwood1 = new RavenwoodRule(); + + @Rule + public final RavenwoodRule mRavenwood2 = new RavenwoodRule(); + + public RavenwoodMultipleRuleTest() { + // We can't call it within the test method because the exception happens before + // calling the method, so set it up here. + if (RavenwoodConfig.isOnRavenwood()) { + mExpectedException.expectMessage("Multiple nesting RavenwoodRule"); + } + } + + @Test + public void testMultipleRulesNotAllowed() { + Assume.assumeTrue(RavenwoodConfig.isOnRavenwood()); + } +} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodAfterClassFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodAfterClassFailureTest.java deleted file mode 100644 index f9794ad5941e..000000000000 --- a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodAfterClassFailureTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.ravenwoodtest.bivalenttest.listenertests; - -import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; - -import org.junit.AfterClass; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.ArrayList; -import java.util.List; - -import platform.test.runner.parameterized.ParameterizedAndroidJunit4; -import platform.test.runner.parameterized.Parameters; - -/** - * Test that throws from @AfterClass. - * - * Tradefed would ignore it, so instead RavenwoodAwareTestRunner would detect it and kill - * the self (test) process. - * - * Unfortunately, this behavior can't easily be tested from within this class, so for now - * it's only used for a manual test, which you can run by removing the @Ignore. - * - * TODO(b/364948126) Improve the tests and automate it. - */ -@Ignore -@RunWith(ParameterizedAndroidJunit4.class) -public class RavenwoodAfterClassFailureTest { - public RavenwoodAfterClassFailureTest(String param) { - } - - @AfterClass - public static void afterClass() { - if (!isOnRavenwood()) return; // Don't do anything on real device. - - throw new RuntimeException("FAILURE"); - } - - @Parameters - public static List getParams() { - var params = new ArrayList(); - params.add("foo"); - params.add("bar"); - return params; - } - - @Test - public void test1() { - } - - @Test - public void test2() { - } -} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassAssumptionFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassAssumptionFailureTest.java deleted file mode 100644 index 61fb06865545..000000000000 --- a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassAssumptionFailureTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.ravenwoodtest.bivalenttest.listenertests; - -import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; - -import org.junit.Assume; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.ArrayList; -import java.util.List; - -import platform.test.runner.parameterized.ParameterizedAndroidJunit4; -import platform.test.runner.parameterized.Parameters; - -/** - * Test that fails in assumption in @BeforeClass. - * - * This is only used for manual tests. Make sure `atest` shows 4 test results with - * "ASSUMPTION_FAILED". - * - * TODO(b/364948126) Improve the tests and automate it. - */ -@RunWith(ParameterizedAndroidJunit4.class) -public class RavenwoodBeforeClassAssumptionFailureTest { - public RavenwoodBeforeClassAssumptionFailureTest(String param) { - } - - @BeforeClass - public static void beforeClass() { - if (!isOnRavenwood()) return; // Don't do anything on real device. - - Assume.assumeTrue(false); - } - - @Parameters - public static List getParams() { - var params = new ArrayList(); - params.add("foo"); - params.add("bar"); - return params; - } - - @Test - public void test1() { - } - - @Test - public void test2() { - } -} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassFailureTest.java deleted file mode 100644 index 626ce8198eeb..000000000000 --- a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodBeforeClassFailureTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.ravenwoodtest.bivalenttest.listenertests; - -import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; - -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.ArrayList; -import java.util.List; - -import platform.test.runner.parameterized.ParameterizedAndroidJunit4; -import platform.test.runner.parameterized.Parameters; - -/** - * Test that fails throws from @BeforeClass. - * - * This is only used for manual tests. Make sure `atest` shows 4 test results with - * a "FAILURE" runtime exception. - * - * In order to run the test, you'll need to remove the @Ignore. - * - * TODO(b/364948126) Improve the tests and automate it. - */ -@Ignore -@RunWith(ParameterizedAndroidJunit4.class) -public class RavenwoodBeforeClassFailureTest { - public static final String TAG = "RavenwoodBeforeClassFailureTest"; - - public RavenwoodBeforeClassFailureTest(String param) { - } - - @BeforeClass - public static void beforeClass() { - if (!isOnRavenwood()) return; // Don't do anything on real device. - - throw new RuntimeException("FAILURE"); - } - - @Parameters - public static List getParams() { - var params = new ArrayList(); - params.add("foo"); - params.add("bar"); - return params; - } - - @Test - public void test1() { - } - - @Test - public void test2() { - } -} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleAssumptionFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleAssumptionFailureTest.java deleted file mode 100644 index dc949c466110..000000000000 --- a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleAssumptionFailureTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.ravenwoodtest.bivalenttest.listenertests; - -import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; - -import static org.junit.Assume.assumeTrue; - -import org.junit.ClassRule; -import org.junit.Test; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runner.RunWith; -import org.junit.runners.model.Statement; - -import java.util.ArrayList; -import java.util.List; - -import platform.test.runner.parameterized.ParameterizedAndroidJunit4; -import platform.test.runner.parameterized.Parameters; - -/** - * Test that fails in assumption from a class rule. - * - * This is only used for manual tests. Make sure `atest` shows 4 test results with - * "ASSUMPTION_FAILED". - * - * TODO(b/364948126) Improve the tests and automate it. - */ -@RunWith(ParameterizedAndroidJunit4.class) -public class RavenwoodClassRuleAssumptionFailureTest { - public static final String TAG = "RavenwoodClassRuleFailureTest"; - - @ClassRule - public static final TestRule sClassRule = new TestRule() { - @Override - public Statement apply(Statement base, Description description) { - if (!isOnRavenwood()) { - return base; // Just run the test as-is on a real device. - } - - assumeTrue(false); - return null; // unreachable - } - }; - - public RavenwoodClassRuleAssumptionFailureTest(String param) { - } - - @Parameters - public static List getParams() { - var params = new ArrayList(); - params.add("foo"); - params.add("bar"); - return params; - } - - @Test - public void test1() { - } - - @Test - public void test2() { - } -} diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleFailureTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleFailureTest.java deleted file mode 100644 index 9996bec41525..000000000000 --- a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/listenertests/RavenwoodClassRuleFailureTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.ravenwoodtest.bivalenttest.listenertests; - -import static android.platform.test.ravenwood.RavenwoodRule.isOnRavenwood; - -import org.junit.ClassRule; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runner.RunWith; -import org.junit.runners.model.Statement; - -import java.util.ArrayList; -import java.util.List; - -import platform.test.runner.parameterized.ParameterizedAndroidJunit4; -import platform.test.runner.parameterized.Parameters; - -/** - * Test that fails throws from a class rule. - * - * This is only used for manual tests. Make sure `atest` shows 4 test results with - * a "FAILURE" runtime exception. - * - * In order to run the test, you'll need to remove the @Ignore. - * - * TODO(b/364948126) Improve the tests and automate it. - */ -@Ignore -@RunWith(ParameterizedAndroidJunit4.class) -public class RavenwoodClassRuleFailureTest { - public static final String TAG = "RavenwoodClassRuleFailureTest"; - - @ClassRule - public static final TestRule sClassRule = new TestRule() { - @Override - public Statement apply(Statement base, Description description) { - if (!isOnRavenwood()) { - return base; // Just run the test as-is on a real device. - } - - throw new RuntimeException("FAILURE"); - } - }; - - public RavenwoodClassRuleFailureTest(String param) { - } - - @Parameters - public static List getParams() { - var params = new ArrayList(); - params.add("foo"); - params.add("bar"); - return params; - } - - @Test - public void test1() { - } - - @Test - public void test2() { - } -} diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java index 6d21e440e911..92a1cb7fc3bf 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java @@ -31,13 +31,16 @@ import com.android.internal.os.RuntimeInit; import com.android.ravenwood.common.RavenwoodCommonUtils; import org.junit.runner.Description; -import org.junit.runner.Runner; import org.junit.runners.model.TestClass; -import java.util.Stack; - /** * Provide hook points created by {@link RavenwoodAwareTestRunner}. + * + * States are associated with each {@link RavenwoodAwareTestRunner} are stored in + * {@link RavenwoodRunnerState}, rather than as members of {@link RavenwoodAwareTestRunner}. + * See its javadoc for the reasons. + * + * All methods in this class must be called from the test main thread. */ public class RavenwoodAwareTestRunnerHook { private static final String TAG = RavenwoodAwareTestRunner.TAG; @@ -45,27 +48,10 @@ public class RavenwoodAwareTestRunnerHook { private RavenwoodAwareTestRunnerHook() { } - private static RavenwoodTestStats sStats; // lazy initialization. - - // Keep track of the current class description. - - // Test classes can be nested because of "Suite", so we need a stack to keep track. - private static final Stack sClassDescriptions = new Stack<>(); - private static Description sCurrentClassDescription; - - private static RavenwoodTestStats getStats() { - if (sStats == null) { - // We don't want to throw in the static initializer, because tradefed may not report - // it properly, so we initialize it here. - sStats = new RavenwoodTestStats(); - } - return sStats; - } - /** * Called when a runner starts, before the inner runner gets a chance to run. */ - public static void onRunnerInitializing(Runner runner, TestClass testClass) { + public static void onRunnerInitializing(RavenwoodAwareTestRunner runner, TestClass testClass) { // TODO: Move the initialization code to a better place. initOnce(); @@ -103,7 +89,29 @@ public class RavenwoodAwareTestRunnerHook { */ public static void onClassSkipped(Description description) { Log.i(TAG, "onClassSkipped: description=" + description); - getStats().onClassSkipped(description); + RavenwoodTestStats.getInstance().onClassSkipped(description); + } + + /** + * Called before the inner runner starts. + */ + public static void onBeforeInnerRunnerStart( + RavenwoodAwareTestRunner runner, Description description) throws Throwable { + Log.v(TAG, "onBeforeInnerRunnerStart: description=" + description); + + // Prepare the environment before the inner runner starts. + RavenwoodRunnerState.forRunner(runner).enterTestClass(description); + } + + /** + * Called after the inner runner finished. + */ + public static void onAfterInnerRunnerFinished( + RavenwoodAwareTestRunner runner, Description description) throws Throwable { + Log.v(TAG, "onAfterInnerRunnerFinished: description=" + description); + + RavenwoodTestStats.getInstance().onClassFinished(description); + RavenwoodRunnerState.forRunner(runner).exitTestClass(); } /** @@ -112,21 +120,23 @@ public class RavenwoodAwareTestRunnerHook { * Return false if it should be skipped. */ public static boolean onBefore(RavenwoodAwareTestRunner runner, Description description, - Scope scope, Order order) { + Scope scope, Order order) throws Throwable { Log.v(TAG, "onBefore: description=" + description + ", " + scope + ", " + order); - if (scope == Scope.Class && order == Order.Outer) { - // Keep track of the current class. - sCurrentClassDescription = description; - sClassDescriptions.push(description); + if (scope == Scope.Instance && order == Order.Outer) { + // Start of a test method. + RavenwoodRunnerState.forRunner(runner).enterTestMethod(description); } + final var classDescription = RavenwoodRunnerState.forRunner(runner).getClassDescription(); + // Class-level annotations are checked by the runner already, so we only check // method-level annotations here. if (scope == Scope.Instance && order == Order.Outer) { if (!RavenwoodEnablementChecker.shouldEnableOnRavenwood( description, true)) { - getStats().onTestFinished(sCurrentClassDescription, description, Result.Skipped); + RavenwoodTestStats.getInstance().onTestFinished( + classDescription, description, Result.Skipped); return false; } } @@ -142,15 +152,13 @@ public class RavenwoodAwareTestRunnerHook { Scope scope, Order order, Throwable th) { Log.v(TAG, "onAfter: description=" + description + ", " + scope + ", " + order + ", " + th); + final var classDescription = RavenwoodRunnerState.forRunner(runner).getClassDescription(); + if (scope == Scope.Instance && order == Order.Outer) { - getStats().onTestFinished(sCurrentClassDescription, description, + // End of a test method. + RavenwoodRunnerState.forRunner(runner).exitTestMethod(); + RavenwoodTestStats.getInstance().onTestFinished(classDescription, description, th == null ? Result.Passed : Result.Failed); - - } else if (scope == Scope.Class && order == Order.Outer) { - getStats().onClassFinished(sCurrentClassDescription); - sClassDescriptions.pop(); - sCurrentClassDescription = - sClassDescriptions.size() == 0 ? null : sClassDescriptions.peek(); } // If RUN_DISABLED_TESTS is set, and the method did _not_ throw, make it an error. @@ -190,4 +198,25 @@ public class RavenwoodAwareTestRunnerHook { public static boolean shouldRunClassOnRavenwood(Class clazz) { return RavenwoodEnablementChecker.shouldRunClassOnRavenwood(clazz, true); } -} + + /** + * Called by RavenwoodRule. + */ + public static void onRavenwoodRuleEnter(RavenwoodAwareTestRunner runner, + Description description, RavenwoodRule rule) throws Throwable { + Log.v(TAG, "onRavenwoodRuleEnter: description=" + description); + + RavenwoodRunnerState.forRunner(runner).enterRavenwoodRule(rule); + } + + + /** + * Called by RavenwoodRule. + */ + public static void onRavenwoodRuleExit(RavenwoodAwareTestRunner runner, + Description description, RavenwoodRule rule) throws Throwable { + Log.v(TAG, "onRavenwoodRuleExit: description=" + description); + + RavenwoodRunnerState.forRunner(runner).exitRavenwoodRule(rule); + } +} \ No newline at end of file diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java new file mode 100644 index 000000000000..d73afd4c391b --- /dev/null +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java @@ -0,0 +1,252 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.platform.test.ravenwood; + +import static com.android.ravenwood.common.RavenwoodCommonUtils.ensureIsPublicMember; + +import static org.junit.Assert.fail; + +import android.annotation.NonNull; +import android.annotation.Nullable; + +import com.android.internal.annotations.GuardedBy; +import com.android.ravenwood.common.RavenwoodRuntimeException; + +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.rules.TestRule; +import org.junit.runner.Description; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.WeakHashMap; + +/** + * Used to store various states associated with the current test runner. + * + * This class could be added to {@link RavenwoodAwareTestRunner} as a field, but we don't + * want to put it in junit-src/ (for one, that'll cause all the downstream dependencies to be + * rebuilt when this file is updated), so we manage it separately using a Map from each + * {@link RavenwoodAwareTestRunner} instance to a {@link RavenwoodRunnerState}. + * + * All members must be called from the runner's main thread. + */ +public final class RavenwoodRunnerState { + private static final String TAG = "RavenwoodRunnerState"; + + @GuardedBy("sStates") + private static final WeakHashMap sStates = + new WeakHashMap<>(); + + /** + * Get the instance for a given runner. + */ + public static RavenwoodRunnerState forRunner(@NonNull RavenwoodAwareTestRunner runner) { + synchronized (sStates) { + var ret = sStates.get(runner); + if (ret == null) { + ret = new RavenwoodRunnerState(runner); + sStates.put(runner, ret); + } + return ret; + } + } + + private final RavenwoodAwareTestRunner mRunner; + + private RavenwoodRunnerState(RavenwoodAwareTestRunner runner) { + mRunner = runner; + } + + private Description mClassDescription; + private Description mMethodDescription; + + private RavenwoodConfig mCurrentConfig; + private RavenwoodRule mCurrentRule; + + public Description getClassDescription() { + return mClassDescription; + } + + public void enterTestClass(Description classDescription) throws IOException { + mClassDescription = classDescription; + + mCurrentConfig = extractConfiguration(mRunner.getTestClass().getJavaClass()); + + if (mCurrentConfig != null) { + RavenwoodRuntimeEnvironmentController.init(mCurrentConfig); + } + } + + public void exitTestClass() { + if (mCurrentConfig != null) { + try { + RavenwoodRuntimeEnvironmentController.reset(); + } finally { + mClassDescription = null; + } + } + } + + public void enterTestMethod(Description description) { + mMethodDescription = description; + } + + public void exitTestMethod() { + mMethodDescription = null; + } + + public void enterRavenwoodRule(RavenwoodRule rule) throws IOException { + if (mCurrentConfig != null) { + fail("RavenwoodConfiguration and RavenwoodRule cannot be used in the same class." + + " Suggest migrating to RavenwoodConfiguration."); + } + if (mCurrentRule != null) { + fail("Multiple nesting RavenwoodRule's are detected in the same class," + + " which is not supported."); + } + mCurrentRule = rule; + RavenwoodRuntimeEnvironmentController.init(rule.getConfiguration()); + } + + public void exitRavenwoodRule(RavenwoodRule rule) { + if (mCurrentRule != rule) { + return; // This happens if the rule did _not_ take effect somehow. + } + + try { + RavenwoodRuntimeEnvironmentController.reset(); + } finally { + mCurrentRule = null; + } + } + + /** + * @return a configuration from a test class, if any. + */ + @Nullable + private static RavenwoodConfig extractConfiguration(Class testClass) { + final boolean hasRavenwoodRule = hasRavenwoodRule(testClass); + + var field = findConfigurationField(testClass); + if (field == null) { + return null; + } + if (hasRavenwoodRule) { + fail("RavenwoodConfiguration and RavenwoodRule cannot be used in the same class." + + " Suggest migrating to RavenwoodConfiguration."); + } + + try { + return (RavenwoodConfig) field.get(null); + } catch (IllegalAccessException e) { + throw new RavenwoodRuntimeException("Failed to fetch from the configuration field", e); + } + } + + /** + * @return true if the current target class (or its super classes) has any @Rule / @ClassRule + * fields of type RavenwoodRule. + * + * Note, this check won't detect cases where a Rule is of type + * {@link TestRule} and still be a {@link RavenwoodRule}. But that'll be detected at runtime + * as a failure, in {@link #enterRavenwoodRule}. + */ + private static boolean hasRavenwoodRule(Class testClass) { + for (var field : testClass.getDeclaredFields()) { + if (!field.isAnnotationPresent(Rule.class) + && field.isAnnotationPresent(ClassRule.class)) { + continue; + } + if (field.getType().equals(RavenwoodRule.class)) { + return true; + } + } + // JUnit supports rules as methods, so we need to check them too. + for (var method : testClass.getDeclaredMethods()) { + if (!method.isAnnotationPresent(Rule.class) + && method.isAnnotationPresent(ClassRule.class)) { + continue; + } + if (method.getReturnType().equals(RavenwoodRule.class)) { + return true; + } + } + // Look into the super class. + if (!testClass.getSuperclass().equals(Object.class)) { + return hasRavenwoodRule(testClass.getSuperclass()); + } + return false; + } + + /** + * Find and return a field with @RavenwoodConfiguration.Config, which must be of type + * RavenwoodConfiguration. + */ + @Nullable + private static Field findConfigurationField(Class testClass) { + Field foundField = null; + + for (var field : testClass.getDeclaredFields()) { + final var hasAnot = field.isAnnotationPresent(RavenwoodConfig.Config.class); + final var isType = field.getType().equals(RavenwoodConfig.class); + + if (hasAnot) { + if (isType) { + // Good, use this field. + if (foundField != null) { + fail(String.format( + "Class %s has multiple fields with %s", + testClass.getCanonicalName(), + "@RavenwoodConfiguration.Config")); + } + // Make sure it's static public + ensureIsPublicMember(field, true); + + foundField = field; + } else { + fail(String.format( + "Field %s.%s has %s but type is not %s", + testClass.getCanonicalName(), + field.getName(), + "@RavenwoodConfiguration.Config", + "RavenwoodConfiguration")); + return null; // unreachable + } + } else { + if (isType) { + fail(String.format( + "Field %s.%s does not have %s but type is %s", + testClass.getCanonicalName(), + field.getName(), + "@RavenwoodConfiguration.Config", + "RavenwoodConfiguration")); + return null; // unreachable + } else { + // Unrelated field, ignore. + continue; + } + } + } + if (foundField != null) { + return foundField; + } + if (!testClass.getSuperclass().equals(Object.class)) { + return findConfigurationField(testClass.getSuperclass()); + } + return null; + } +} diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java similarity index 73% rename from ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java rename to ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java index c4336762c0b8..03c9001366e9 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java @@ -18,6 +18,7 @@ package android.platform.test.ravenwood; import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_EMPTY_RESOURCES_APK; import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_RESOURCE_APK; +import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -37,6 +38,8 @@ import android.view.DisplayAdjustments; import androidx.test.platform.app.InstrumentationRegistry; +import com.android.ravenwood.common.RavenwoodRuntimeException; +import com.android.ravenwood.common.SneakyThrow; import com.android.server.LocalServices; import org.junit.runner.Description; @@ -53,14 +56,25 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -public class RavenwoodRuleImpl { +/** + * Responsible for initializing and de-initializing the environment, according to a + * {@link RavenwoodConfig}. + */ +public class RavenwoodRuntimeEnvironmentController { + private static final String TAG = "RavenwoodRuntimeEnvironmentController"; + + private RavenwoodRuntimeEnvironmentController() { + } + private static final String MAIN_THREAD_NAME = "RavenwoodMain"; /** * When enabled, attempt to dump all thread stacks just before we hit the * overall Tradefed timeout, to aid in debugging deadlocks. */ - private static final boolean ENABLE_TIMEOUT_STACKS = false; + private static final boolean ENABLE_TIMEOUT_STACKS = + "1".equals(System.getenv("RAVENWOOD_ENABLE_TIMEOUT_STACKS")); + private static final int TIMEOUT_MILLIS = 9_000; private static final ScheduledExecutorService sTimeoutExecutor = @@ -73,7 +87,8 @@ public class RavenwoodRuleImpl { /** * When enabled, attempt to detect uncaught exceptions from background threads. */ - private static final boolean ENABLE_UNCAUGHT_EXCEPTION_DETECTION = false; + private static final boolean ENABLE_UNCAUGHT_EXCEPTION_DETECTION = + "1".equals(System.getenv("RAVENWOOD_ENABLE_UNCAUGHT_EXCEPTION_DETECTION")); /** * When set, an unhandled exception was discovered (typically on a background thread), and we @@ -101,24 +116,46 @@ public class RavenwoodRuleImpl { return res; } - public static void init(RavenwoodRule rule) throws IOException { + private static RavenwoodConfig sConfig; + + /** + * Initialize the environment. + */ + public static void init(RavenwoodConfig config) throws IOException { + if (RAVENWOOD_VERBOSE_LOGGING) { + Log.i(TAG, "init() called here", new RuntimeException("STACKTRACE")); + } + try { + initInner(config); + } catch (Exception th) { + Log.e(TAG, "init() failed", th); + reset(); + SneakyThrow.sneakyThrow(th); + } + } + + private static void initInner(RavenwoodConfig config) throws IOException { + if (sConfig != null) { + throw new RavenwoodRuntimeException("Internal error: init() called without reset()"); + } + sConfig = config; if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) { maybeThrowPendingUncaughtException(false); Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler); } - android.os.Process.init$ravenwood(rule.mUid, rule.mPid); + android.os.Process.init$ravenwood(config.mUid, config.mPid); sOriginalIdentityToken = Binder.clearCallingIdentity(); - Binder.restoreCallingIdentity(packBinderIdentityToken(false, rule.mUid, rule.mPid)); - setSystemProperties(rule.mSystemProperties); + Binder.restoreCallingIdentity(packBinderIdentityToken(false, config.mUid, config.mPid)); + setSystemProperties(config.mSystemProperties); ServiceManager.init$ravenwood(); LocalServices.removeAllServicesForTest(); - ActivityManager.init$ravenwood(rule.mCurrentUser); + ActivityManager.init$ravenwood(config.mCurrentUser); final HandlerThread main; - if (rule.mProvideMainThread) { + if (config.mProvideMainThread) { main = new HandlerThread(MAIN_THREAD_NAME); main.start(); Looper.setMainLooperForTest(main.getLooper()); @@ -142,21 +179,22 @@ public class RavenwoodRuleImpl { emptyPaths, emptyPaths, emptyPaths, emptyPaths, null, null, new DisplayAdjustments().getCompatibilityInfo(), - RavenwoodRuleImpl.class.getClassLoader(), null); + RavenwoodRuntimeEnvironmentController.class.getClassLoader(), null); assertNotNull(ret); return ret; }; - rule.mContext = new RavenwoodContext(rule.mPackageName, main, resourcesSupplier); - rule.mInstrumentation = new Instrumentation(); - rule.mInstrumentation.basicInit(rule.mContext); - InstrumentationRegistry.registerInstance(rule.mInstrumentation, Bundle.EMPTY); + config.mContext = new RavenwoodContext(config.mPackageName, main, resourcesSupplier); + config.mInstrumentation = new Instrumentation(); + config.mInstrumentation.basicInit(config.mContext); + InstrumentationRegistry.registerInstance(config.mInstrumentation, Bundle.EMPTY); - RavenwoodSystemServer.init(rule); + RavenwoodSystemServer.init(config); if (ENABLE_TIMEOUT_STACKS) { - sPendingTimeout = sTimeoutExecutor.schedule(RavenwoodRuleImpl::dumpStacks, + sPendingTimeout = sTimeoutExecutor.schedule( + RavenwoodRuntimeEnvironmentController::dumpStacks, TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } @@ -165,21 +203,33 @@ public class RavenwoodRuleImpl { Objects.requireNonNull(Build.VERSION.SDK); } - public static void reset(RavenwoodRule rule) { + /** + * De-initialize. + */ + public static void reset() { + if (RAVENWOOD_VERBOSE_LOGGING) { + Log.i(TAG, "reset() called here", new RuntimeException("STACKTRACE")); + } + if (sConfig == null) { + throw new RavenwoodRuntimeException("Internal error: reset() already called"); + } + var config = sConfig; + sConfig = null; + if (ENABLE_TIMEOUT_STACKS) { sPendingTimeout.cancel(false); } - RavenwoodSystemServer.reset(rule); + RavenwoodSystemServer.reset(config); InstrumentationRegistry.registerInstance(null, Bundle.EMPTY); - rule.mInstrumentation = null; - if (rule.mContext != null) { - ((RavenwoodContext) rule.mContext).cleanUp(); + config.mInstrumentation = null; + if (config.mContext != null) { + ((RavenwoodContext) config.mContext).cleanUp(); } - rule.mContext = null; + config.mContext = null; - if (rule.mProvideMainThread) { + if (config.mProvideMainThread) { Looper.getMainLooper().quit(); Looper.clearMainLooperForTest(); } diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemServer.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemServer.java index cd6b61df392f..f3a93c1dacad 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemServer.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemServer.java @@ -61,19 +61,19 @@ public class RavenwoodSystemServer { private static TimingsTraceAndSlog sTimings; private static SystemServiceManager sServiceManager; - public static void init(RavenwoodRule rule) { + public static void init(RavenwoodConfig config) { // Avoid overhead if no services required - if (rule.mServicesRequired.isEmpty()) return; + if (config.mServicesRequired.isEmpty()) return; sStartedServices = new ArraySet<>(); sTimings = new TimingsTraceAndSlog(); - sServiceManager = new SystemServiceManager(rule.mContext); + sServiceManager = new SystemServiceManager(config.mContext); sServiceManager.setStartInfo(false, SystemClock.elapsedRealtime(), SystemClock.uptimeMillis()); LocalServices.addService(SystemServiceManager.class, sServiceManager); - startServices(rule.mServicesRequired); + startServices(config.mServicesRequired); sServiceManager.sealStartedServices(); // TODO: expand to include additional boot phases when relevant @@ -81,7 +81,7 @@ public class RavenwoodSystemServer { sServiceManager.startBootPhase(sTimings, SystemService.PHASE_BOOT_COMPLETED); } - public static void reset(RavenwoodRule rule) { + public static void reset(RavenwoodConfig config) { // TODO: consider introducing shutdown boot phases LocalServices.removeServiceForTest(SystemServiceManager.class); diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java index 3ffabefb7681..428eb57f20bf 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java @@ -31,7 +31,7 @@ import java.util.HashMap; import java.util.Map; /** - * Creats a "stats" CSV file containing the test results. + * Collect test result stats and write them into a CSV file containing the test results. * * The output file is created as `/tmp/Ravenwood-stats_[TEST-MODULE=NAME]_[TIMESTAMP].csv`. * A symlink to the latest result will be created as @@ -41,6 +41,21 @@ public class RavenwoodTestStats { private static final String TAG = "RavenwoodTestStats"; private static final String HEADER = "Module,Class,ClassDesc,Passed,Failed,Skipped"; + private static RavenwoodTestStats sInstance; + + /** + * @return a singleton instance. + */ + public static RavenwoodTestStats getInstance() { + if (sInstance == null) { + sInstance = new RavenwoodTestStats(); + } + return sInstance; + } + + /** + * Represents a test result. + */ public enum Result { Passed, Failed, @@ -113,16 +128,25 @@ public class RavenwoodTestStats { }); } + /** + * Call it when a test class is skipped. + */ public void onClassSkipped(Description classDescription) { addResult(classDescription, Description.EMPTY, Result.Skipped); onClassFinished(classDescription); } + /** + * Call it when a test method is finished. + */ public void onTestFinished(Description classDescription, Description testDescription, Result result) { addResult(classDescription, testDescription, result); } + /** + * Call it when a test class is finished. + */ public void onClassFinished(Description classDescription) { int passed = 0; int skipped = 0; diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java index dffb263e77cb..bc944d76018d 100644 --- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java +++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java @@ -26,8 +26,6 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.util.Log; -import com.android.ravenwood.common.SneakyThrow; - import org.junit.Assume; import org.junit.AssumptionViolatedException; import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; @@ -61,6 +59,7 @@ import java.lang.annotation.Target; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Stack; +import java.util.function.BiConsumer; /** * A test runner used for Ravenwood. @@ -83,7 +82,7 @@ import java.util.Stack; * it will basically just delegate to the inner wrapper, and won't do anything special. * (no hooks, etc.) */ -public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orderable { +public final class RavenwoodAwareTestRunner extends Runner implements Filterable, Orderable { public static final String TAG = "Ravenwood"; @Inherited @@ -105,7 +104,6 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde /** Scope of a hook. */ public enum Scope { - Runner, Class, Instance, } @@ -120,21 +118,21 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde private static class RavenwoodClassOuterRule implements TestRule { @Override public Statement apply(Statement base, Description description) { - return getCurrentRunner().updateStatement(base, description, Scope.Class, Order.Outer); + return getCurrentRunner().wrapWithHooks(base, description, Scope.Class, Order.Outer); } } private static class RavenwoodClassInnerRule implements TestRule { @Override public Statement apply(Statement base, Description description) { - return getCurrentRunner().updateStatement(base, description, Scope.Class, Order.Inner); + return getCurrentRunner().wrapWithHooks(base, description, Scope.Class, Order.Inner); } } private static class RavenwoodInstanceOuterRule implements TestRule { @Override public Statement apply(Statement base, Description description) { - return getCurrentRunner().updateStatement( + return getCurrentRunner().wrapWithHooks( base, description, Scope.Instance, Order.Outer); } } @@ -142,7 +140,7 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde private static class RavenwoodInstanceInnerRule implements TestRule { @Override public Statement apply(Statement base, Description description) { - return getCurrentRunner().updateStatement( + return getCurrentRunner().wrapWithHooks( base, description, Scope.Instance, Order.Inner); } } @@ -160,7 +158,7 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde /** Keeps track of the runner on the current thread. */ private static final ThreadLocal sCurrentRunner = new ThreadLocal<>(); - private static RavenwoodAwareTestRunner getCurrentRunner() { + static RavenwoodAwareTestRunner getCurrentRunner() { var runner = sCurrentRunner.get(); if (runner == null) { throw new RuntimeException("Current test runner not set!"); @@ -296,7 +294,7 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde @Override public void run(RunNotifier realNotifier) { - final RunNotifier notifier = new RavenwoodRunNotifier(realNotifier); + final RavenwoodRunNotifier notifier = new RavenwoodRunNotifier(realNotifier); if (mRealRunner instanceof ClassSkippingTestRunner) { mRealRunner.run(notifier); @@ -315,10 +313,26 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde sCurrentRunner.set(this); try { - runWithHooks(getDescription(), Scope.Runner, Order.Outer, - () -> mRealRunner.run(notifier)); + try { + RavenwoodAwareTestRunnerHook.onBeforeInnerRunnerStart( + this, getDescription()); + } catch (Throwable th) { + notifier.reportBeforeTestFailure(getDescription(), th); + return; + } + + // Delegate to the inner runner. + mRealRunner.run(notifier); } finally { sCurrentRunner.remove(); + + try { + RavenwoodAwareTestRunnerHook.onAfterInnerRunnerFinished( + this, getDescription()); + } catch (Throwable th) { + notifier.reportAfterTestFailure(th); + return; + } } } @@ -355,7 +369,7 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde } } - private Statement updateStatement(Statement base, Description description, Scope scope, + private Statement wrapWithHooks(Statement base, Description description, Scope scope, Order order) { if (!isOnRavenwood()) { return base; @@ -368,7 +382,8 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde }; } - private void runWithHooks(Description description, Scope scope, Order order, Runnable r) { + private void runWithHooks(Description description, Scope scope, Order order, Runnable r) + throws Throwable { runWithHooks(description, scope, order, new Statement() { @Override public void evaluate() throws Throwable { @@ -377,7 +392,8 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde }); } - private void runWithHooks(Description description, Scope scope, Order order, Statement s) { + private void runWithHooks(Description description, Scope scope, Order order, Statement s) + throws Throwable { if (isOnRavenwood()) { Assume.assumeTrue( RavenwoodAwareTestRunnerHook.onBefore(this, description, scope, order)); @@ -394,7 +410,7 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde this, description, scope, order, t); } if (shouldThrow) { - SneakyThrow.sneakyThrow(t); + throw t; } } } @@ -615,16 +631,13 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde return true; } if (mAfterTest) { - // Unfortunately, there's no good way to report it, so kill the own process. - onCriticalError( - "Failures detected in @AfterClass, which would be swalloed by tradefed", - th); - return true; // unreachable + reportAfterTestFailure(th); + return true; } return false; } - private void reportBeforeTestFailure(Description suiteDesc, Throwable th) { + public void reportBeforeTestFailure(Description suiteDesc, Throwable th) { // If a failure happens befere running any tests, we'll need to pretend // as if each test in the suite reported the failure, to work around b/364395552. for (var child : suiteDesc.getChildren()) { @@ -646,11 +659,51 @@ public class RavenwoodAwareTestRunner extends Runner implements Filterable, Orde } } } + + public void reportAfterTestFailure(Throwable th) { + // Unfortunately, there's no good way to report it, so kill the own process. + onCriticalError( + "Failures detected in @AfterClass, which would be swallowed by tradefed", + th); + } } + private static volatile BiConsumer sCriticalErrorHanler; + private void onCriticalError(@NonNull String message, @Nullable Throwable th) { - Log.e(TAG, "Critical error! Ravenwood cannot continue. Killing self process: " - + message, th); + Log.e(TAG, "Critical error! " + message, th); + var handler = sCriticalErrorHanler; + if (handler == null) { + handler = sDefaultCriticalErrorHandler; + } + handler.accept(message, th); + } + + private static BiConsumer sDefaultCriticalErrorHandler = (message, th) -> { + Log.e(TAG, "Ravenwood cannot continue. Killing self process.", th); System.exit(1); + }; + + /** + * Contains Ravenwood private APIs. + */ + public static class RavenwoodPrivate { + private RavenwoodPrivate() { + } + + /** + * Set a listener for onCriticalError(), for testing. If a listener is set, we won't call + * System.exit(). + */ + public void setCriticalErrorHandler( + @Nullable BiConsumer handler) { + sCriticalErrorHanler = handler; + } + } + + private static final RavenwoodPrivate sRavenwoodPrivate = new RavenwoodPrivate(); + + public static RavenwoodPrivate private$ravenwood() { + return sRavenwoodPrivate; } } diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java new file mode 100644 index 000000000000..04e0bedc8aab --- /dev/null +++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.platform.test.ravenwood; + +import static android.os.Process.FIRST_APPLICATION_UID; +import static android.os.Process.SYSTEM_UID; +import static android.os.UserHandle.SYSTEM; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.app.Instrumentation; +import android.content.Context; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Represents how to configure the ravenwood environment for a test class. + * + * If a ravenwood test class has a public static field with the {@link Config} annotation, + * Ravenwood will extract the config from it and initializes the environment. The type of the + * field must be of {@link RavenwoodConfig}. + */ +public final class RavenwoodConfig { + /** + * Use this to mark a field as the configuration. + * @hide + */ + @Target({ElementType.FIELD}) + @Retention(RetentionPolicy.RUNTIME) + public @interface Config { + } + + private static final int NOBODY_UID = 9999; + + private static final AtomicInteger sNextPid = new AtomicInteger(100); + + int mCurrentUser = SYSTEM.getIdentifier(); + + /** + * Unless the test author requests differently, run as "nobody", and give each collection of + * tests its own unique PID. + */ + int mUid = NOBODY_UID; + int mPid = sNextPid.getAndIncrement(); + + String mPackageName; + + boolean mProvideMainThread = false; + + final RavenwoodSystemProperties mSystemProperties = new RavenwoodSystemProperties(); + + final List> mServicesRequired = new ArrayList<>(); + + volatile Context mContext; + volatile Instrumentation mInstrumentation; + + private RavenwoodConfig() { + } + + /** + * Return if the current process is running on a Ravenwood test environment. + */ + public static boolean isOnRavenwood() { + return RavenwoodRule.isOnRavenwood(); + } + + public static class Builder { + private final RavenwoodConfig mConfig = new RavenwoodConfig(); + + public Builder() { + } + + /** + * Configure the identity of this process to be the system UID for the duration of the + * test. Has no effect on non-Ravenwood environments. + */ + public Builder setProcessSystem() { + mConfig.mUid = SYSTEM_UID; + return this; + } + + /** + * Configure the identity of this process to be an app UID for the duration of the + * test. Has no effect on non-Ravenwood environments. + */ + public Builder setProcessApp() { + mConfig.mUid = FIRST_APPLICATION_UID; + return this; + } + + /** + * Configure the identity of this process to be the given package name for the duration + * of the test. Has no effect on non-Ravenwood environments. + */ + public Builder setPackageName(@NonNull String packageName) { + mConfig.mPackageName = Objects.requireNonNull(packageName); + return this; + } + + /** + * Configure a "main" thread to be available for the duration of the test, as defined + * by {@code Looper.getMainLooper()}. Has no effect on non-Ravenwood environments. + */ + public Builder setProvideMainThread(boolean provideMainThread) { + mConfig.mProvideMainThread = provideMainThread; + return this; + } + + /** + * Configure the given system property as immutable for the duration of the test. + * Read access to the key is allowed, and write access will fail. When {@code value} is + * {@code null}, the value is left as undefined. + * + * All properties in the {@code debug.*} namespace are automatically mutable, with no + * developer action required. + * + * Has no effect on non-Ravenwood environments. + */ + public Builder setSystemPropertyImmutable(@NonNull String key, + @Nullable Object value) { + mConfig.mSystemProperties.setValue(key, value); + mConfig.mSystemProperties.setAccessReadOnly(key); + return this; + } + + /** + * Configure the given system property as mutable for the duration of the test. + * Both read and write access to the key is allowed, and its value will be reset between + * each test. When {@code value} is {@code null}, the value is left as undefined. + * + * All properties in the {@code debug.*} namespace are automatically mutable, with no + * developer action required. + * + * Has no effect on non-Ravenwood environments. + */ + public Builder setSystemPropertyMutable(@NonNull String key, + @Nullable Object value) { + mConfig.mSystemProperties.setValue(key, value); + mConfig.mSystemProperties.setAccessReadWrite(key); + return this; + } + + /** + * Configure the set of system services that are required for this test to operate. + * + * For example, passing {@code android.hardware.SerialManager.class} as an argument will + * ensure that the underlying service is created, initialized, and ready to use for the + * duration of the test. The {@code SerialManager} instance can be obtained via + * {@code RavenwoodRule.getContext()} and {@code Context.getSystemService()}, and + * {@code SerialManagerInternal} can be obtained via {@code LocalServices.getService()}. + */ + public Builder setServicesRequired(@NonNull Class... services) { + mConfig.mServicesRequired.clear(); + for (Class service : services) { + mConfig.mServicesRequired.add(service); + } + return this; + } + + public RavenwoodConfig build() { + return mConfig; + } + } +} diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java index d569896421eb..7847e7cb5463 100644 --- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java +++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java @@ -16,17 +16,13 @@ package android.platform.test.ravenwood; -import static android.os.Process.FIRST_APPLICATION_UID; -import static android.os.Process.SYSTEM_UID; -import static android.os.UserHandle.SYSTEM; - import static com.android.ravenwood.common.RavenwoodCommonUtils.log; +import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Instrumentation; import android.content.Context; import android.platform.test.annotations.DisabledOnRavenwood; -import android.platform.test.annotations.EnabledOnRavenwood; import com.android.ravenwood.common.RavenwoodCommonUtils; @@ -34,26 +30,17 @@ import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; -import java.util.ArrayList; -import java.util.List; import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Pattern; /** - * {@code @Rule} that configures the Ravenwood test environment. This rule has no effect when - * tests are run on non-Ravenwood test environments. - * - * This rule initializes and resets the Ravenwood environment between each test method to offer a - * hermetic testing environment. - * - * By default, all tests are executed on Ravenwood, but annotations such as - * {@link DisabledOnRavenwood} and {@link EnabledOnRavenwood} can be used at both the method - * and class level to "ignore" tests that may not be ready. When needed, a - * {@link RavenwoodClassRule} can be used in addition to a {@link RavenwoodRule} to ignore tests - * before a test class is fully initialized. + * @deprecated Use {@link RavenwoodConfig} to configure the ravenwood environment instead. + * A {@link RavenwoodRule} is no longer needed for {@link DisabledOnRavenwood}. To get the + * {@link Context} and {@link Instrumentation}, use + * {@link androidx.test.platform.app.InstrumentationRegistry} instead. */ -public class RavenwoodRule implements TestRule { +@Deprecated +public final class RavenwoodRule implements TestRule { private static final String TAG = "RavenwoodRule"; static final boolean IS_ON_RAVENWOOD = RavenwoodCommonUtils.isOnRavenwood(); @@ -105,35 +92,19 @@ public class RavenwoodRule implements TestRule { } } - private static final int NOBODY_UID = 9999; - - private static final AtomicInteger sNextPid = new AtomicInteger(100); - - int mCurrentUser = SYSTEM.getIdentifier(); - - /** - * Unless the test author requests differently, run as "nobody", and give each collection of - * tests its own unique PID. - */ - int mUid = NOBODY_UID; - int mPid = sNextPid.getAndIncrement(); - - String mPackageName; - - boolean mProvideMainThread = false; - - final RavenwoodSystemProperties mSystemProperties = new RavenwoodSystemProperties(); - - final List> mServicesRequired = new ArrayList<>(); - - volatile Context mContext; - volatile Instrumentation mInstrumentation; + private final RavenwoodConfig mConfiguration; public RavenwoodRule() { + mConfiguration = new RavenwoodConfig.Builder().build(); + } + + private RavenwoodRule(RavenwoodConfig config) { + mConfiguration = config; } public static class Builder { - private RavenwoodRule mRule = new RavenwoodRule(); + private final RavenwoodConfig.Builder mBuilder = + new RavenwoodConfig.Builder(); public Builder() { } @@ -143,7 +114,7 @@ public class RavenwoodRule implements TestRule { * test. Has no effect on non-Ravenwood environments. */ public Builder setProcessSystem() { - mRule.mUid = SYSTEM_UID; + mBuilder.setProcessSystem(); return this; } @@ -152,7 +123,7 @@ public class RavenwoodRule implements TestRule { * test. Has no effect on non-Ravenwood environments. */ public Builder setProcessApp() { - mRule.mUid = FIRST_APPLICATION_UID; + mBuilder.setProcessApp(); return this; } @@ -160,8 +131,8 @@ public class RavenwoodRule implements TestRule { * Configure the identity of this process to be the given package name for the duration * of the test. Has no effect on non-Ravenwood environments. */ - public Builder setPackageName(/* @NonNull */ String packageName) { - mRule.mPackageName = Objects.requireNonNull(packageName); + public Builder setPackageName(@NonNull String packageName) { + mBuilder.setPackageName(packageName); return this; } @@ -170,7 +141,7 @@ public class RavenwoodRule implements TestRule { * by {@code Looper.getMainLooper()}. Has no effect on non-Ravenwood environments. */ public Builder setProvideMainThread(boolean provideMainThread) { - mRule.mProvideMainThread = provideMainThread; + mBuilder.setProvideMainThread(provideMainThread); return this; } @@ -184,10 +155,8 @@ public class RavenwoodRule implements TestRule { * * Has no effect on non-Ravenwood environments. */ - public Builder setSystemPropertyImmutable(/* @NonNull */ String key, - /* @Nullable */ Object value) { - mRule.mSystemProperties.setValue(key, value); - mRule.mSystemProperties.setAccessReadOnly(key); + public Builder setSystemPropertyImmutable(@NonNull String key, @Nullable Object value) { + mBuilder.setSystemPropertyImmutable(key, value); return this; } @@ -201,10 +170,8 @@ public class RavenwoodRule implements TestRule { * * Has no effect on non-Ravenwood environments. */ - public Builder setSystemPropertyMutable(/* @NonNull */ String key, - /* @Nullable */ Object value) { - mRule.mSystemProperties.setValue(key, value); - mRule.mSystemProperties.setAccessReadWrite(key); + public Builder setSystemPropertyMutable(@NonNull String key, @Nullable Object value) { + mBuilder.setSystemPropertyMutable(key, value); return this; } @@ -217,16 +184,13 @@ public class RavenwoodRule implements TestRule { * {@code RavenwoodRule.getContext()} and {@code Context.getSystemService()}, and * {@code SerialManagerInternal} can be obtained via {@code LocalServices.getService()}. */ - public Builder setServicesRequired(Class... services) { - mRule.mServicesRequired.clear(); - for (Class service : services) { - mRule.mServicesRequired.add(service); - } + public Builder setServicesRequired(@NonNull Class... services) { + mBuilder.setServicesRequired(services); return this; } public RavenwoodRule build() { - return mRule; + return new RavenwoodRule(mBuilder.build()); } } @@ -246,41 +210,44 @@ public class RavenwoodRule implements TestRule { } /** - * Return a {@code Context} available for usage during the currently running test case. - * - * Each test should obtain needed information or references via this method; - * references must not be stored beyond the scope of a test case. + * @deprecated Use + * {@code androidx.test.platform.app.InstrumentationRegistry.getInstrumentation().getContext()} + * instead. */ + @Deprecated public Context getContext() { - return Objects.requireNonNull(mContext, + return Objects.requireNonNull(mConfiguration.mContext, "Context is only available during @Test execution"); } /** - * Return a {@code Instrumentation} available for usage during the currently running test case. - * - * Each test should obtain needed information or references via this method; - * references must not be stored beyond the scope of a test case. + * @deprecated Use + * {@code androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()} + * instead. */ + @Deprecated public Instrumentation getInstrumentation() { - return Objects.requireNonNull(mInstrumentation, + return Objects.requireNonNull(mConfiguration.mInstrumentation, "Instrumentation is only available during @Test execution"); } - @Override public Statement apply(Statement base, Description description) { - // TODO: Here, we're calling init() / reset() once for each rule. - // That means if a test class has multiple rules -- even if they refer to the same - // rule instance -- we're calling them multiple times. We need to fix it. + if (!RavenwoodConfig.isOnRavenwood()) { + return base; + } return new Statement() { @Override public void evaluate() throws Throwable { - RavenwoodRuleImpl.init(RavenwoodRule.this); + RavenwoodAwareTestRunnerHook.onRavenwoodRuleEnter( + RavenwoodAwareTestRunner.getCurrentRunner(), description, + RavenwoodRule.this); try { base.evaluate(); } finally { - RavenwoodRuleImpl.reset(RavenwoodRule.this); + RavenwoodAwareTestRunnerHook.onRavenwoodRuleExit( + RavenwoodAwareTestRunner.getCurrentRunner(), description, + RavenwoodRule.this); } } }; @@ -339,4 +306,8 @@ public class RavenwoodRule implements TestRule { public static RavenwoodPrivate private$ravenwood() { return sRavenwoodPrivate; } + + RavenwoodConfig getConfiguration() { + return mConfiguration; + } } diff --git a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java index 1e4889ce0678..0178b934a649 100644 --- a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java +++ b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java @@ -19,7 +19,6 @@ import android.platform.test.ravenwood.RavenwoodAwareTestRunner.Order; import android.platform.test.ravenwood.RavenwoodAwareTestRunner.Scope; import org.junit.runner.Description; -import org.junit.runner.Runner; import org.junit.runners.model.TestClass; /** @@ -38,7 +37,7 @@ public class RavenwoodAwareTestRunnerHook { /** * Called when a runner starts, before the inner runner gets a chance to run. */ - public static void onRunnerInitializing(Runner runner, TestClass testClass) { + public static void onRunnerInitializing(RavenwoodAwareTestRunner runner, TestClass testClass) { } /** @@ -47,16 +46,39 @@ public class RavenwoodAwareTestRunnerHook { public static void onClassSkipped(Description description) { } + /** + * Called before the inner runner starts. + */ + public static void onBeforeInnerRunnerStart( + RavenwoodAwareTestRunner runner, Description description) throws Throwable { + } + + /** + * Called after the inner runner finished. + */ + public static void onAfterInnerRunnerFinished( + RavenwoodAwareTestRunner runner, Description description) throws Throwable { + } + /** * Called before a test / class. * * Return false if it should be skipped. */ public static boolean onBefore(RavenwoodAwareTestRunner runner, Description description, - Scope scope, Order order) { + Scope scope, Order order) throws Throwable { return true; } + public static void onRavenwoodRuleEnter(RavenwoodAwareTestRunner runner, + Description description, RavenwoodRule rule) throws Throwable { + } + + public static void onRavenwoodRuleExit(RavenwoodAwareTestRunner runner, + Description description, RavenwoodRule rule) throws Throwable { + } + + /** * Called after a test / class. * diff --git a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java deleted file mode 100644 index a470626dcbe7..000000000000 --- a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.platform.test.ravenwood; - -import org.junit.runner.Description; - -public class RavenwoodRuleImpl { - public static void init(RavenwoodRule rule) { - // No-op when running on a real device - } - - public static void reset(RavenwoodRule rule) { - // No-op when running on a real device - } - - public static void logTestRunner(String label, Description description) { - // No-op when running on a real device - } - - public static long realCurrentTimeMillis() { - return System.currentTimeMillis(); - } -} diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java index 875ce71149cd..96746c679020 100644 --- a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java +++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java @@ -26,6 +26,7 @@ import java.io.FileInputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; +import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; @@ -279,6 +280,18 @@ public class RavenwoodCommonUtils { (isStatic ? "static " : ""))); } + public static void ensureIsPublicMember(Member member, boolean isStatic) { + var ok = Modifier.isPublic(member.getModifiers()) + && (Modifier.isStatic(member.getModifiers()) == isStatic); + if (ok) { + return; // okay + } + throw new AssertionError(String.format( + "%s.%s expected to be public %s", + member.getDeclaringClass().getName(), member.getName(), + (isStatic ? "static" : ""))); + } + @NonNull public static String getStackTraceString(@Nullable Throwable th) { StringWriter stringWriter = new StringWriter(); diff --git a/ravenwood/tests/coretest/Android.bp b/ravenwood/tests/coretest/Android.bp new file mode 100644 index 000000000000..d94475c00240 --- /dev/null +++ b/ravenwood/tests/coretest/Android.bp @@ -0,0 +1,25 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +android_ravenwood_test { + name: "RavenwoodCoreTest", + + static_libs: [ + "androidx.annotation_annotation", + "androidx.test.ext.junit", + "androidx.test.rules", + "junit-params", + "platform-parametric-runner-lib", + "truth", + ], + srcs: [ + "test/**/*.java", + ], + auto_gen_config: true, +} diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerCallbackTest.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerCallbackTest.java new file mode 100644 index 000000000000..6d8fb983504b --- /dev/null +++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerCallbackTest.java @@ -0,0 +1,356 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.runnercallbacktests; + +import static org.junit.Assume.assumeTrue; + +import android.platform.test.annotations.NoRavenizer; +import android.platform.test.ravenwood.RavenwoodAwareTestRunner; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runner.RunWith; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.Statement; + +import java.util.ArrayList; +import java.util.List; + +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + + +/** + * Tests to make sure {@link RavenwoodAwareTestRunner} produces expected callbacks in various + * error situations in places such as @BeforeClass / @AfterClass / Constructors, which are + * out of test method bodies. + */ +@NoRavenizer // This class shouldn't be executed with RavenwoodAwareTestRunner. +public class RavenwoodRunnerCallbackTest extends RavenwoodRunnerTestBase { + + /** + * Throws an exception in @AfterClass. This should produce a critical error. + */ + @RunWith(BlockJUnit4ClassRunner.class) + // CHECKSTYLE:OFF Generated code + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest + testStarted: test1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest) + testFinished: test1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest) + testStarted: test2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest) + testFinished: test2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest) + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest + criticalError: Failures detected in @AfterClass, which would be swallowed by tradefed: FAILURE + testSuiteFinished: classes + testRunFinished: 2,0,0,0 + """) + // CHECKSTYLE:ON + public static class AfterClassFailureTest { + public AfterClassFailureTest() { + } + + @AfterClass + public static void afterClass() { + throw new RuntimeException("FAILURE"); + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } + + } + + /** + * Assumption failure in @BeforeClass. + */ + @RunWith(ParameterizedAndroidJunit4.class) + // Because the test uses ParameterizedAndroidJunit4 with two parameters, + // the whole class is executed twice. + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest + testSuiteStarted: [0] + testStarted: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest) + testAssumptionFailure: got: , expected: is + testFinished: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest) + testStarted: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest) + testAssumptionFailure: got: , expected: is + testFinished: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest) + testSuiteFinished: [0] + testSuiteStarted: [1] + testStarted: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest) + testAssumptionFailure: got: , expected: is + testFinished: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest) + testStarted: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest) + testAssumptionFailure: got: , expected: is + testFinished: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest) + testSuiteFinished: [1] + testSuiteFinished: classes + testRunFinished: 4,0,4,0 + """) + // CHECKSTYLE:ON + public static class BeforeClassAssumptionFailureTest { + public BeforeClassAssumptionFailureTest(String param) { + } + + @BeforeClass + public static void beforeClass() { + Assume.assumeTrue(false); + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } + } + + /** + * General exception in @BeforeClass. + */ + @RunWith(ParameterizedAndroidJunit4.class) + // Because the test uses ParameterizedAndroidJunit4 with two parameters, + // the whole class is executed twice. + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest + testSuiteStarted: [0] + testStarted: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest) + testFailure: FAILURE + testFinished: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest) + testStarted: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest) + testFailure: FAILURE + testFinished: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest) + testSuiteFinished: [0] + testSuiteStarted: [1] + testStarted: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest) + testFailure: FAILURE + testFinished: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest) + testStarted: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest) + testFailure: FAILURE + testFinished: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest) + testSuiteFinished: [1] + testSuiteFinished: classes + testRunFinished: 4,4,0,0 + """) + // CHECKSTYLE:ON + public static class BeforeClassExceptionTest { + public BeforeClassExceptionTest(String param) { + } + + @BeforeClass + public static void beforeClass() { + throw new RuntimeException("FAILURE"); + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } + } + + /** + * Assumption failure from a @ClassRule. + */ + @RunWith(ParameterizedAndroidJunit4.class) + // Because the test uses ParameterizedAndroidJunit4 with two parameters, + // the whole class is executed twice. + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest + testSuiteStarted: [0] + testStarted: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest) + testAssumptionFailure: got: , expected: is + testFinished: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest) + testStarted: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest) + testAssumptionFailure: got: , expected: is + testFinished: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest) + testSuiteFinished: [0] + testSuiteStarted: [1] + testStarted: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest) + testAssumptionFailure: got: , expected: is + testFinished: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest) + testStarted: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest) + testAssumptionFailure: got: , expected: is + testFinished: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest) + testSuiteFinished: [1] + testSuiteFinished: classes + testRunFinished: 4,0,4,0 + """) + // CHECKSTYLE:ON + public static class ClassRuleAssumptionFailureTest { + @ClassRule + public static final TestRule sClassRule = new TestRule() { + @Override + public Statement apply(Statement base, Description description) { + assumeTrue(false); + return null; // unreachable + } + }; + + public ClassRuleAssumptionFailureTest(String param) { + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } + } + + /** + * General exception from a @ClassRule. + */ + @RunWith(ParameterizedAndroidJunit4.class) + // Because the test uses ParameterizedAndroidJunit4 with two parameters, + // the whole class is executed twice. + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest + testSuiteStarted: [0] + testStarted: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest) + testAssumptionFailure: got: , expected: is + testFinished: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest) + testStarted: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest) + testAssumptionFailure: got: , expected: is + testFinished: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest) + testSuiteFinished: [0] + testSuiteStarted: [1] + testStarted: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest) + testAssumptionFailure: got: , expected: is + testFinished: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest) + testStarted: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest) + testAssumptionFailure: got: , expected: is + testFinished: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest) + testSuiteFinished: [1] + testSuiteFinished: classes + testRunFinished: 4,0,4,0 + """) + // CHECKSTYLE:ON + public static class ClassRuleExceptionTest { + @ClassRule + public static final TestRule sClassRule = new TestRule() { + @Override + public Statement apply(Statement base, Description description) { + assumeTrue(false); + return null; // unreachable + } + }; + + public ClassRuleExceptionTest(String param) { + } + + @Parameters + public static List getParams() { + var params = new ArrayList(); + params.add("foo"); + params.add("bar"); + return params; + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } + } + + /** + * General exception from a @ClassRule. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ExceptionFromInnerRunnerConstructorTest) + testFailure: Exception detected in constructor + testFinished: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ExceptionFromInnerRunnerConstructorTest) + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class ExceptionFromInnerRunnerConstructorTest { + public ExceptionFromInnerRunnerConstructorTest(String arg1, String arg2) { + } + + @Test + public void test1() { + } + + @Test + public void test2() { + } + } +} diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerConfigValidationTest.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerConfigValidationTest.java new file mode 100644 index 000000000000..6ee443fac874 --- /dev/null +++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerConfigValidationTest.java @@ -0,0 +1,452 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.runnercallbacktests; + +import static com.google.common.truth.Truth.assertThat; + +import android.platform.test.annotations.NoRavenizer; +import android.platform.test.ravenwood.RavenwoodConfig; +import android.platform.test.ravenwood.RavenwoodRule; + +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; + + +/** + * Test for @Config field extraction and validation. + */ +@NoRavenizer // This class shouldn't be executed with RavenwoodAwareTestRunner. +public class RavenwoodRunnerConfigValidationTest extends RavenwoodRunnerTestBase { + public abstract static class ConfigInBaseClass { + static String PACKAGE_NAME = "com.ConfigInBaseClass"; + + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder() + .setPackageName(PACKAGE_NAME).build(); + } + + /** + * Make sure a config in the base class is detected. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigInBaseClassTest + testStarted: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigInBaseClassTest) + testFinished: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigInBaseClassTest) + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigInBaseClassTest + testSuiteFinished: classes + testRunFinished: 1,0,0,0 + """) + // CHECKSTYLE:ON + public static class ConfigInBaseClassTest extends ConfigInBaseClass { + @Test + public void test() { + assertThat(InstrumentationRegistry.getInstrumentation().getContext().getPackageName()) + .isEqualTo(PACKAGE_NAME); + } + } + + /** + * Make sure a config in the base class is detected. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigOverridingTest + testStarted: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigOverridingTest) + testFinished: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigOverridingTest) + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigOverridingTest + testSuiteFinished: classes + testRunFinished: 1,0,0,0 + """) + // CHECKSTYLE:ON + public static class ConfigOverridingTest extends ConfigInBaseClass { + static String PACKAGE_NAME_OVERRIDE = "com.ConfigOverridingTest"; + + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder() + .setPackageName(PACKAGE_NAME_OVERRIDE).build(); + + @Test + public void test() { + assertThat(InstrumentationRegistry.getInstrumentation().getContext().getPackageName()) + .isEqualTo(PACKAGE_NAME_OVERRIDE); + } + } + + /** + * Test to make sure that if a test has a config error, the failure would be reported from + * each test method. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: testMethod1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest) + testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest.sConfig expected to be public static + testFinished: testMethod1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest) + testStarted: testMethod2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest) + testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest.sConfig expected to be public static + testFinished: testMethod2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest) + testStarted: testMethod3(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest) + testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest.sConfig expected to be public static + testFinished: testMethod3(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest) + testSuiteFinished: classes + testRunFinished: 3,3,0,0 + """) + // CHECKSTYLE:ON + public static class ErrorMustBeReportedFromEachTest { + @RavenwoodConfig.Config + private static RavenwoodConfig sConfig = // Invalid because it's private. + new RavenwoodConfig.Builder().build(); + + @Test + public void testMethod1() { + } + + @Test + public void testMethod2() { + } + + @Test + public void testMethod3() { + } + } + + /** + * Invalid because there are two @Config's. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateConfigTest) + testFailure: Class com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest.DuplicateConfigTest has multiple fields with @RavenwoodConfiguration.Config + testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateConfigTest) + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class DuplicateConfigTest { + + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig1 = + new RavenwoodConfig.Builder().build(); + + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig2 = + new RavenwoodConfig.Builder().build(); + + @Test + public void testConfig() { + } + } + + /** + * @Config's must be static. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonStaticConfigTest) + testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonStaticConfigTest.sConfig expected to be public static + testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonStaticConfigTest) + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class NonStaticConfigTest { + + @RavenwoodConfig.Config + public RavenwoodConfig sConfig = + new RavenwoodConfig.Builder().build(); + + @Test + public void testConfig() { + } + } + + /** + * @Config's must be public. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonPublicConfigTest) + testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonPublicConfigTest.sConfig expected to be public static + testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonPublicConfigTest) + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class NonPublicConfigTest { + + @RavenwoodConfig.Config + RavenwoodConfig sConfig = + new RavenwoodConfig.Builder().build(); + + @Test + public void testConfig() { + } + } + + /** + * @Config's must be of type RavenwoodConfiguration. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WrongTypeConfigTest) + testFailure: Field com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest.WrongTypeConfigTest.sConfig has @RavenwoodConfiguration.Config but type is not RavenwoodConfiguration + testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WrongTypeConfigTest) + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class WrongTypeConfigTest { + + @RavenwoodConfig.Config + public Object sConfig = + new RavenwoodConfig.Builder().build(); + + @Test + public void testConfig() { + } + + } + + /** + * Config can't be used with a (instance) Rule. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WithInstanceRuleTest) + testFailure: RavenwoodConfiguration and RavenwoodRule cannot be used in the same class. Suggest migrating to RavenwoodConfiguration. + testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WithInstanceRuleTest) + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class WithInstanceRuleTest { + + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig = + new RavenwoodConfig.Builder().build(); + + @Rule + public RavenwoodRule mRule = new RavenwoodRule.Builder().build(); + + @Test + public void testConfig() { + } + } + + /** + * Config can't be used with a (static) Rule. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WithStaticRuleTest) + testFailure: Exception detected in constructor + testFinished: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WithStaticRuleTest) + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class WithStaticRuleTest { + + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig = + new RavenwoodConfig.Builder().build(); + + @Rule + public static RavenwoodRule sRule = new RavenwoodRule.Builder().build(); + + @Test + public void testConfig() { + } + } + + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateRulesTest + testStarted: testMultipleRulesNotAllowed(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateRulesTest) + testFailure: Multiple nesting RavenwoodRule's are detected in the same class, which is not supported. + testFinished: testMultipleRulesNotAllowed(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateRulesTest) + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateRulesTest + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class DuplicateRulesTest { + + @Rule + public final RavenwoodRule mRavenwood1 = new RavenwoodRule(); + + @Rule + public final RavenwoodRule mRavenwood2 = new RavenwoodRule(); + + @Test + public void testMultipleRulesNotAllowed() { + } + } + + public static class RuleInBaseClass { + static String PACKAGE_NAME = "com.RuleInBaseClass"; + @Rule + public final RavenwoodRule mRavenwood1 = new RavenwoodRule.Builder() + .setPackageName(PACKAGE_NAME).build(); + } + + /** + * Make sure that RavenwoodRule in a base class takes effect. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleInBaseClassSuccessTest + testStarted: testRuleInBaseClass(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleInBaseClassSuccessTest) + testFinished: testRuleInBaseClass(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleInBaseClassSuccessTest) + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleInBaseClassSuccessTest + testSuiteFinished: classes + testRunFinished: 1,0,0,0 + """) + // CHECKSTYLE:ON + public static class RuleInBaseClassSuccessTest extends RuleInBaseClass { + + @Test + public void testRuleInBaseClass() { + assertThat(InstrumentationRegistry.getInstrumentation().getContext().getPackageName()) + .isEqualTo(PACKAGE_NAME); + } + } + + /** + * Make sure that having a config and a rule in a base class should fail. + * RavenwoodRule. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testStarted: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleInBaseClassTest) + testFailure: RavenwoodConfiguration and RavenwoodRule cannot be used in the same class. Suggest migrating to RavenwoodConfiguration. + testFinished: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleInBaseClassTest) + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class ConfigWithRuleInBaseClassTest extends RuleInBaseClass { + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder().build(); + + @Test + public void test() { + } + } + + /** + * Same as {@link RuleInBaseClass}, but the type of the rule field is not {@link RavenwoodRule}. + */ + public abstract static class RuleWithDifferentTypeInBaseClass { + static String PACKAGE_NAME = "com.RuleWithDifferentTypeInBaseClass"; + @Rule + public final TestRule mRavenwood1 = new RavenwoodRule.Builder() + .setPackageName(PACKAGE_NAME).build(); + } + + /** + * Make sure that RavenwoodRule in a base class takes effect, even if the field type is not + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleWithDifferentTypeInBaseClassSuccessTest + testStarted: testRuleInBaseClass(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleWithDifferentTypeInBaseClassSuccessTest) + testFinished: testRuleInBaseClass(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleWithDifferentTypeInBaseClassSuccessTest) + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleWithDifferentTypeInBaseClassSuccessTest + testSuiteFinished: classes + testRunFinished: 1,0,0,0 + """) + // CHECKSTYLE:ON + public static class RuleWithDifferentTypeInBaseClassSuccessTest extends RuleWithDifferentTypeInBaseClass { + + @Test + public void testRuleInBaseClass() { + assertThat(InstrumentationRegistry.getInstrumentation().getContext().getPackageName()) + .isEqualTo(PACKAGE_NAME); + } + } + + /** + * Make sure that having a config and a rule in a base class should fail, even if the field type is not + * RavenwoodRule. + */ + @RunWith(AndroidJUnit4.class) + // CHECKSTYLE:OFF + @Expected(""" + testRunStarted: classes + testSuiteStarted: classes + testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleWithDifferentTypeInBaseClassTest + testStarted: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleWithDifferentTypeInBaseClassTest) + testFailure: RavenwoodConfiguration and RavenwoodRule cannot be used in the same class. Suggest migrating to RavenwoodConfiguration. + testFinished: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleWithDifferentTypeInBaseClassTest) + testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleWithDifferentTypeInBaseClassTest + testSuiteFinished: classes + testRunFinished: 1,1,0,0 + """) + // CHECKSTYLE:ON + public static class ConfigWithRuleWithDifferentTypeInBaseClassTest extends RuleWithDifferentTypeInBaseClass { + @RavenwoodConfig.Config + public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder().build(); + + @Test + public void test() { + } + } +} diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerTestBase.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerTestBase.java new file mode 100644 index 000000000000..9a6934bf17c5 --- /dev/null +++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerTestBase.java @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.runnercallbacktests; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; + +import android.platform.test.annotations.NoRavenizer; +import android.platform.test.ravenwood.RavenwoodAwareTestRunner; +import android.util.Log; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import org.junit.Test; +import org.junit.runner.Description; +import org.junit.runner.JUnitCore; +import org.junit.runner.Result; +import org.junit.runner.RunWith; +import org.junit.runner.notification.Failure; +import org.junit.runner.notification.RunListener; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.function.BiConsumer; + + +/** + * Base class for tests to make sure {@link RavenwoodAwareTestRunner} produces expected callbacks + * in various situations. (most of them are error situations.) + * + * Subclasses must contain test classes as static inner classes with an {@link Expected} annotation. + * This class finds them using reflections and run them one by one directly using {@link JUnitCore}, + * and check the callbacks. + * + * Subclasses do no need to have any test methods. + * + * The {@link Expected} annotation must contain the expected result as a string. + * + * This test abuses the fact that atest + tradefed + junit won't run nested classes automatically. + * (So atest won't show any results directly from the nested classes.) + * + * The actual test method is {@link #doTest}, which is executed for each target test class, using + * junit-params. + */ +@RunWith(JUnitParamsRunner.class) +@NoRavenizer // This class shouldn't be executed with RavenwoodAwareTestRunner. +public abstract class RavenwoodRunnerTestBase { + private static final String TAG = "RavenwoodRunnerTestBase"; + + /** + * Annotation to specify the expected result for a class. + */ + @Target({ElementType.TYPE}) + @Retention(RetentionPolicy.RUNTIME) + public @interface Expected { + String value(); + } + + /** + * Take a multiline string, strip all of them, remove empty lines, and return it. + */ + private static String stripMultiLines(String resultString) { + var list = new ArrayList(); + for (var line : resultString.split("\n")) { + var s = line.strip(); + if (s.length() > 0) { + list.add(s); + } + } + return String.join("\n", list); + } + + /** + * Extract the expected result from @Expected. + */ + private String getExpectedResult(Class testClazz) { + var expect = testClazz.getAnnotation(Expected.class); + return stripMultiLines(expect.value()); + } + + /** + * List all the nested classrs with an {@link Expected} annotation in a given class. + */ + public Class[] getTestClasses() { + var thisClass = this.getClass(); + var ret = Arrays.stream(thisClass.getNestMembers()) + .filter((c) -> c.getAnnotation(Expected.class) != null) + .toArray(Class[]::new); + + assertThat(ret.length).isGreaterThan(0); + + return ret; + } + + /** + * This is the actual test method. We use junit-params to run this method for each target + * test class, which are returned by {@link #getTestClasses}. + * + * It runs each test class, and compare the result collected with + * {@link ResultCollectingListener} to expected results (as strings). + */ + @Test + @Parameters(method = "getTestClasses") + public void doTest(Class testClazz) { + doTest(testClazz, getExpectedResult(testClazz)); + } + + /** + * Run a given test class, and compare the result collected with + * {@link ResultCollectingListener} to expected results (as a string). + */ + private void doTest(Class testClazz, String expectedResult) { + Log.i(TAG, "Running test for " + testClazz); + var junitCore = new JUnitCore(); + + // Create a listener. + var listener = new ResultCollectingListener(); + junitCore.addListener(listener); + + // Set a listener to critical errors. This will also prevent + // {@link RavenwoodAwareTestRunner} from calling System.exit() when there's + // a critical error. + RavenwoodAwareTestRunner.private$ravenwood().setCriticalErrorHandler( + listener.sCriticalErrorListener); + + try { + // Run the test class. + junitCore.run(testClazz); + } finally { + // Clear the critical error listener. + RavenwoodAwareTestRunner.private$ravenwood().setCriticalErrorHandler(null); + } + + // Check the result. + assertWithMessage("Failure in test class: " + testClazz.getCanonicalName() + "]") + .that(listener.getResult()) + .isEqualTo(expectedResult); + } + + /** + * A JUnit RunListener that collects all the callbacks as a single string. + */ + private static class ResultCollectingListener extends RunListener { + private final ArrayList mResult = new ArrayList<>(); + + public final BiConsumer sCriticalErrorListener = (message, th) -> { + mResult.add("criticalError: " + message + ": " + th.getMessage()); + }; + + @Override + public void testRunStarted(Description description) throws Exception { + mResult.add("testRunStarted: " + description); + } + + @Override + public void testRunFinished(Result result) throws Exception { + mResult.add("testRunFinished: " + + result.getRunCount() + "," + + result.getFailureCount() + "," + + result.getAssumptionFailureCount() + "," + + result.getIgnoreCount()); + } + + @Override + public void testSuiteStarted(Description description) throws Exception { + mResult.add("testSuiteStarted: " + description); + } + + @Override + public void testSuiteFinished(Description description) throws Exception { + mResult.add("testSuiteFinished: " + description); + } + + @Override + public void testStarted(Description description) throws Exception { + mResult.add("testStarted: " + description); + } + + @Override + public void testFinished(Description description) throws Exception { + mResult.add("testFinished: " + description); + } + + @Override + public void testFailure(Failure failure) throws Exception { + mResult.add("testFailure: " + failure.getException().getMessage()); + } + + @Override + public void testAssumptionFailure(Failure failure) { + mResult.add("testAssumptionFailure: " + failure.getException().getMessage()); + } + + @Override + public void testIgnored(Description description) throws Exception { + mResult.add("testIgnored: " + description); + } + + public String getResult() { + return String.join("\n", mResult); + } + } +} -- GitLab From bf0074717d72d55df1e25a4736ad2c6650171cfc Mon Sep 17 00:00:00 2001 From: Lyn Date: Mon, 9 Sep 2024 20:39:51 +0000 Subject: [PATCH 149/492] Fix wrong suppression setting value Fixes: 356768397 Test: manual - check that cooldown setting is on, turn airplane mode on and off, sending high priority notif => notif is suppressed Flag: com.android.systemui.notification_avalanche_suppression Change-Id: I6a54e83b1ab0ccd96ebb8fbf9a06d264922fd4db --- .../CommonVisualInterruptionSuppressors.kt | 20 +++++++++++++++++-- .../VisualInterruptionDecisionProviderImpl.kt | 3 ++- ...ualInterruptionDecisionProviderImplTest.kt | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt index 0efd5f15cb09..ec0827b4c478 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt @@ -61,6 +61,7 @@ import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.util.NotificationChannels import com.android.systemui.util.settings.GlobalSettings +import com.android.systemui.util.settings.SystemSettings import com.android.systemui.util.time.SystemClock import com.android.wm.shell.bubbles.Bubbles import java.util.Optional @@ -279,7 +280,8 @@ class AvalancheSuppressor( private val uiEventLogger: UiEventLogger, private val context: Context, private val notificationManager: NotificationManager, - private val logger: VisualInterruptionDecisionLogger + private val logger: VisualInterruptionDecisionLogger, + private val systemSettings: SystemSettings, ) : VisualInterruptionFilter( types = setOf(PEEK, PULSE), @@ -300,6 +302,11 @@ class AvalancheSuppressor( // education HUNs. private var hasShownOnceForDebug = false + // Sometimes the kotlin flow value is false even when the cooldown setting is true (b/356768397) + // so let's directly check settings until we confirm that the flow is initialized and in sync + // with the real settings value. + private var isCooldownFlowInSync = false + private fun shouldShowEdu(): Boolean { val forceShowOnce = SystemProperties.get(FORCE_SHOW_AVALANCHE_EDU_ONCE, "").equals("1") return !hasSeenEdu || (forceShowOnce && !hasShownOnceForDebug) @@ -479,6 +486,15 @@ class AvalancheSuppressor( } private fun isCooldownEnabled(): Boolean { - return settingsInteractor.isCooldownEnabled.value + val isEnabledFromFlow = settingsInteractor.isCooldownEnabled.value + if (isCooldownFlowInSync) { + return isEnabledFromFlow + } + val isEnabled = + systemSettings.getInt(Settings.System.NOTIFICATION_COOLDOWN_ENABLED, /* def */ 1) == 1 + if (isEnabled == isEnabledFromFlow) { + isCooldownFlowInSync = true + } + return isEnabled } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt index 2f8711a586ef..d4466f8771a6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt @@ -195,7 +195,8 @@ constructor( uiEventLogger, context, notificationManager, - logger + logger, + systemSettings ) ) avalancheProvider.register() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt index ed99705b194e..b177e4a3e22e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt @@ -101,7 +101,7 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro private fun getAvalancheSuppressor() : AvalancheSuppressor { return AvalancheSuppressor( avalancheProvider, systemClock, settingsInteractor, packageManager, - uiEventLogger, context, notificationManager, logger + uiEventLogger, context, notificationManager, logger, systemSettings ) } -- GitLab From 3be9c5a28b7e804d72e4ac312220ee19b488b264 Mon Sep 17 00:00:00 2001 From: Kazuki Takise Date: Fri, 6 Sep 2024 13:00:59 +0900 Subject: [PATCH 150/492] Add multi-display support to focus switching in shell transitions With [1], a transition is created when a task is moved to front even without any visibility change. This change extends this to multi-display scenarios. Task focus is managed per display, which means that, when a top task on a non-top display is clicked, there's no task focus switch, (but only display focus switch). The current transition system doesn't track dipslay focus, so in such cases no transition happens, and there's no way for Shell to know when display focus is switched. With this change, top display is tracked in the same way as top tasks, so a TO_TOP transition is delivered to Shell even when there's no task switch inside a display is involved. [1] If21d076eed4db88139ffc8a7c4c018c2ef5aad93 Bug: 274696524 Test: TransitionTests Flag: com.android.window.flags.enable_display_focus_in_shell_transitions Change-Id: I3f74a169eaea5d71a69132a4aa5693fd27bc372c --- .../com/android/server/wm/Transition.java | 36 ++++++++++-- .../server/wm/WindowManagerService.java | 21 +++++++ .../android/server/wm/TransitionTests.java | 55 ++++++++++++++++++- 3 files changed, 104 insertions(+), 8 deletions(-) diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 7f6dc8472813..fd9db0c91fec 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -73,6 +73,7 @@ import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_W import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_PREDICT_BACK; import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS; import static com.android.server.wm.WindowState.BLAST_TIMEOUT_DURATION; +import static com.android.window.flags.Flags.enableDisplayFocusInShellTransitions; import android.annotation.IntDef; import android.annotation.NonNull; @@ -222,6 +223,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { */ private final ArrayList mOnTopTasksAtReady = new ArrayList<>(); + /** + * Tracks the top display like top tasks so we can trigger a MOVED_TO_TOP transition even when + * a display gets moved to front but there's no change in per-display focused tasks. + */ + private DisplayContent mOnTopDisplayStart = null; + private DisplayContent mOnTopDisplayAtReady = null; + /** * Set of participating windowtokens (activity/wallpaper) which are visible at the end of * the transition animation. @@ -772,6 +780,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { if (dc == null || mTargetDisplays.contains(dc)) return; mTargetDisplays.add(dc); addOnTopTasks(dc, mOnTopTasksStart); + if (mOnTopDisplayStart == null) { + mOnTopDisplayStart = + mController.mAtm.mRootWindowContainer.getTopFocusedDisplayContent(); + } // Handle the case {transition.start(); applyTransaction(wct);} that the animating state // is set before collecting participants. if (mController.isAnimating()) { @@ -998,6 +1010,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { for (int i = 0; i < mTargetDisplays.size(); ++i) { addOnTopTasks(mTargetDisplays.get(i), mOnTopTasksAtReady); } + mOnTopDisplayAtReady = + mController.mAtm.mRootWindowContainer.getTopFocusedDisplayContent(); mController.onTransitionPopulated(this); } } @@ -2082,6 +2096,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { return true; } } + if (enableDisplayFocusInShellTransitions() && mOnTopDisplayStart + != mController.mAtm.mRootWindowContainer.getTopFocusedDisplayContent()) { + return true; + } return false; } @@ -2113,6 +2131,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { includesOrderChange = true; break; } + includesOrderChange |= enableDisplayFocusInShellTransitions() + && mOnTopDisplayStart != mOnTopDisplayAtReady; if (!includesOrderChange && !reportCurrent) { // This transition doesn't include an order change, so if it isn't required to report // the current focus (eg. it's the last of a cluster of transitions), then don't @@ -2123,6 +2143,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // latest state and compare with the last reported state (or our start state if no // reported state exists). ArrayList onTopTasksEnd = new ArrayList<>(); + final DisplayContent onTopDisplayEnd = + mController.mAtm.mRootWindowContainer.getTopFocusedDisplayContent(); for (int d = 0; d < mTargetDisplays.size(); ++d) { addOnTopTasks(mTargetDisplays.get(d), onTopTasksEnd); final int displayId = mTargetDisplays.get(d).mDisplayId; @@ -2130,11 +2152,15 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { for (int i = onTopTasksEnd.size() - 1; i >= 0; --i) { final Task task = onTopTasksEnd.get(i); if (task.getDisplayId() != displayId) continue; - // If it didn't change since last report, don't report - if (reportedOnTop == null) { - if (mOnTopTasksStart.contains(task)) continue; - } else if (reportedOnTop.contains(task)) { - continue; + if (!enableDisplayFocusInShellTransitions() + || mOnTopDisplayStart == onTopDisplayEnd + || displayId != onTopDisplayEnd.mDisplayId) { + // If it didn't change since last report, don't report + if (reportedOnTop == null) { + if (mOnTopTasksStart.contains(task)) continue; + } else if (reportedOnTop.contains(task)) { + continue; + } } // Need to report it. mParticipants.add(task); diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index fb57a1bb94c1..d63cdcd4e32a 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -90,6 +90,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.REMOVE_CONTENT_MODE_UNDEFINED; import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_OPEN; +import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManager.fixScale; import static android.view.WindowManagerGlobal.ADD_OKAY; import static android.view.WindowManagerGlobal.RELAYOUT_RES_CANCEL_AND_REDRAW; @@ -158,6 +159,7 @@ import static com.android.server.wm.WindowManagerServiceDumpProto.ROOT_WINDOW_CO import static com.android.server.wm.WindowManagerServiceDumpProto.WINDOW_FRAMES_VALID; import static com.android.window.flags.Flags.multiCrop; import static com.android.window.flags.Flags.setScPropertiesInClient; +import static com.android.window.flags.Flags.enableDisplayFocusInShellTransitions; import android.Manifest; import android.Manifest.permission; @@ -3238,9 +3240,28 @@ public class WindowManagerService extends IWindowManager.Stub return; } + Transition transition = null; + boolean transitionNewlyCreated = false; + if (enableDisplayFocusInShellTransitions()) { + transition = mAtmService.getTransitionController().requestTransitionIfNeeded( + TRANSIT_TO_FRONT, 0 /* flags */, null /* trigger */, + displayContent); + if (transition != null) { + transitionNewlyCreated = true; + } else { + transition = + mAtmService.getTransitionController().getCollectingTransition(); + } + if (transition != null) { + transition.recordTaskOrder(displayContent); + } + } // Nothing prevented us from moving the display to the top. Let's do it! displayContent.getParent().positionChildAt(WindowContainer.POSITION_TOP, displayContent, true /* includingParents */); + if (transitionNewlyCreated) { + transition.setReady(displayContent, true /* ready */); + } } } } diff --git a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java index 7320c0bd4666..4e2a8fea23b1 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java @@ -51,6 +51,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.server.wm.WindowContainer.POSITION_TOP; +import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL; import static com.android.window.flags.Flags.explicitRefreshRateHints; import static org.junit.Assert.assertEquals; @@ -140,8 +141,7 @@ public class TransitionTests extends WindowTestsBase { } private Transition createTestTransition(int transitType) { - final TransitionController controller = new TestTransitionController( - mock(ActivityTaskManagerService.class)); + final TransitionController controller = new TestTransitionController(mAtm); mSyncEngine = createTestBLASTSyncEngine(); controller.setSyncEngine(mSyncEngine); @@ -2358,7 +2358,7 @@ public class TransitionTests extends WindowTestsBase { } @Test - public void testMoveToTopWhileVisible() { + public void testMoveTaskToTopWhileVisible() { final Transition transition = createTestTransition(TRANSIT_OPEN); final ArrayMap changes = transition.mChanges; final ArraySet participants = transition.mParticipants; @@ -2393,6 +2393,55 @@ public class TransitionTests extends WindowTestsBase { assertEquals(TRANSIT_CHANGE, info.getChanges().get(0).getMode()); } + @Test + @EnableFlags(Flags.FLAG_ENABLE_DISPLAY_FOCUS_IN_SHELL_TRANSITIONS) + public void testMoveDisplayToTop() { + // Set up two displays, each of which has a task. + DisplayContent otherDisplay = createNewDisplay(); + final Consumer setUpTask = (DisplayContent dc) -> { + final Task task = createTask(dc); + final ActivityRecord act = createActivityRecord(task); + final TestWindowState win = createWindowState( + new WindowManager.LayoutParams(TYPE_BASE_APPLICATION), act); + act.addWindow(win); + act.setVisibleRequested(true); + }; + setUpTask.accept(mDisplayContent); + setUpTask.accept(otherDisplay); + mWm.updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL, true /* updateImWindows */); + + final Transition transition = createTestTransition(TRANSIT_OPEN); + final ArrayMap changes = transition.mChanges; + final ArraySet participants = transition.mParticipants; + + // Emulate WindowManagerService#moveDisplayToTopInternal(). + transition.recordTaskOrder(mDefaultDisplay); + mDefaultDisplay.getParent().positionChildAt(WindowContainer.POSITION_TOP, + mDefaultDisplay, true /* includingParents */); + mWm.updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL, true /* updateImWindows */); + transition.setReady(mDefaultDisplay, true /* ready */); + + // Test has order changes, a shallow check of order changes. + assertTrue(transition.hasOrderChanges()); + + // We just moved a display to top, so there shouldn't be any changes. + ArrayList targets = Transition.calculateTargets( + participants, changes); + assertTrue(targets.isEmpty()); + + // After collecting order changes, the task on the newly focused display should be + // considered to get moved to top. + transition.collectOrderChanges(true); + targets = Transition.calculateTargets(participants, changes); + assertEquals(1, targets.size()); + + // Make sure the flag is set + final TransitionInfo info = Transition.calculateTransitionInfo( + transition.mType, 0 /* flags */, targets, mMockT); + assertTrue((info.getChanges().get(0).getFlags() & TransitionInfo.FLAG_MOVED_TO_TOP) != 0); + assertEquals(TRANSIT_CHANGE, info.getChanges().get(0).getMode()); + } + private class OrderChangeTestSetup { final TransitionController mController; final TestTransitionPlayer mPlayer; -- GitLab From be76649522002e001d9a87578a121d0afe58322c Mon Sep 17 00:00:00 2001 From: "Torne (Richard Coles)" Date: Mon, 9 Sep 2024 17:52:57 -0400 Subject: [PATCH 151/492] Replace internal APIs in android.webkit.UserPackage. UserPackage is only consumed by other WebView-related code (which does not care about the UserInfo information), and by Settings (which can query UserInfo itself). To make it easier to move this to a mainline module, remove references to the internal UserInfo from the API surface and instead just store a UserHandle which is a public API. Replace use of the internal getPackageInfoForUser with equivalent public APIs. Bug: 310653407 Test: atest WebViewUpdateManagerTest Flag: NONE cannot flag changed types in method signatures Change-Id: I119862b927c30b43e4309828f8fdf42a826a0cb5 --- core/java/android/webkit/UserPackage.java | 40 +++++++++---------- .../android/server/webkit/TestSystemImpl.java | 8 +--- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/core/java/android/webkit/UserPackage.java b/core/java/android/webkit/UserPackage.java index 1da2af459348..b18dbbc21cda 100644 --- a/core/java/android/webkit/UserPackage.java +++ b/core/java/android/webkit/UserPackage.java @@ -15,12 +15,14 @@ */ package android.webkit; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.UserInfo; +import android.content.pm.PackageManager; import android.os.Build; +import android.os.UserHandle; import android.os.UserManager; import java.util.ArrayList; @@ -31,30 +33,31 @@ import java.util.List; * @hide */ public class UserPackage { - private final UserInfo mUserInfo; + private final UserHandle mUser; private final PackageInfo mPackageInfo; public static final int MINIMUM_SUPPORTED_SDK = Build.VERSION_CODES.TIRAMISU; - public UserPackage(UserInfo user, PackageInfo packageInfo) { - this.mUserInfo = user; - this.mPackageInfo = packageInfo; + public UserPackage(@NonNull UserHandle user, @Nullable PackageInfo packageInfo) { + mUser = user; + mPackageInfo = packageInfo; } /** * Returns a list of (User,PackageInfo) pairs corresponding to the PackageInfos for all * device users for the package named {@param packageName}. */ - public static List getPackageInfosAllUsers(Context context, - String packageName, int packageFlags) { - List users = getAllUsers(context); + public static @NonNull List getPackageInfosAllUsers(@NonNull Context context, + @NonNull String packageName, int packageFlags) { + UserManager userManager = context.getSystemService(UserManager.class); + List users = userManager.getUserHandles(false); List userPackages = new ArrayList(users.size()); - for (UserInfo user : users) { + for (UserHandle user : users) { + PackageManager pm = context.createContextAsUser(user, 0).getPackageManager(); PackageInfo packageInfo = null; try { - packageInfo = context.getPackageManager().getPackageInfoAsUser( - packageName, packageFlags, user.id); - } catch (NameNotFoundException e) { + packageInfo = pm.getPackageInfo(packageName, packageFlags); + } catch (PackageManager.NameNotFoundException e) { } userPackages.add(new UserPackage(user, packageInfo)); } @@ -88,18 +91,11 @@ public class UserPackage { return packageInfo.applicationInfo.targetSdkVersion >= MINIMUM_SUPPORTED_SDK; } - public UserInfo getUserInfo() { - return mUserInfo; + public UserHandle getUser() { + return mUser; } public PackageInfo getPackageInfo() { return mPackageInfo; } - - - private static List getAllUsers(Context context) { - UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE); - return userManager.getUsers(); - } - } diff --git a/services/tests/servicestests/src/com/android/server/webkit/TestSystemImpl.java b/services/tests/servicestests/src/com/android/server/webkit/TestSystemImpl.java index cbf79356e9c4..def33551a820 100644 --- a/services/tests/servicestests/src/com/android/server/webkit/TestSystemImpl.java +++ b/services/tests/servicestests/src/com/android/server/webkit/TestSystemImpl.java @@ -19,7 +19,7 @@ package com.android.server.webkit; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.UserInfo; +import android.os.UserHandle; import android.webkit.UserPackage; import android.webkit.WebViewProviderInfo; @@ -137,16 +137,12 @@ public class TestSystemImpl implements SystemInterface { List ret = new ArrayList(); // Loop over defined users, and find the corresponding package for each user. for (int userId : mUsers) { - ret.add(new UserPackage(createUserInfo(userId), + ret.add(new UserPackage(UserHandle.of(userId), userPackages == null ? null : userPackages.get(userId))); } return ret; } - private static UserInfo createUserInfo(int userId) { - return new UserInfo(userId, "User nr. " + userId, 0 /* flags */); - } - /** * Set package for primary user. */ -- GitLab From d05e5c7e14d31304b2f1e438f77994dfa17c27e6 Mon Sep 17 00:00:00 2001 From: Paul Colta Date: Tue, 27 Aug 2024 14:14:14 -0700 Subject: [PATCH 152/492] HDMI: Declare flag for Avoid Ghost Watch time feature Bug: 332780751 Test: m Flag: EXEMPT flag declaration Change-Id: I8741957df9bc7c411c5349d6050257b6f75e556f --- media/java/android/media/tv/flags/media_tv.aconfig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/media/java/android/media/tv/flags/media_tv.aconfig b/media/java/android/media/tv/flags/media_tv.aconfig index 93bca21f3a9d..c814c95e09d9 100644 --- a/media/java/android/media/tv/flags/media_tv.aconfig +++ b/media/java/android/media/tv/flags/media_tv.aconfig @@ -48,3 +48,11 @@ flag { description: "Tuner V4.0 APIs for Android W" bug: "320419647" } + +flag { + name: "hdmi_control_enhanced_behavior" + is_exported: true + namespace: "media_tv" + description: "Enhance HDMI-CEC power state and activeness transitions" + bug: "332780751" +} -- GitLab From 4d1f672410986a9e0aec478cbad94ca6b117835c Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Fri, 6 Sep 2024 19:20:46 -0700 Subject: [PATCH 153/492] Add tracing to record battery changed broadcast event. Bug: 365410144 Test: manual Flag: com.android.server.flags.trace_battery_changed_broadcast_event Change-Id: I279cb8dc8f1097e5e3b6e898cca721c1ccadee6a --- .../com/android/server/BatteryService.java | 62 +++++++++++++++++-- .../com/android/server/flags/services.aconfig | 11 ++++ 2 files changed, 68 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java index 1470e9a9d925..6657c1c1ba89 100644 --- a/services/core/java/com/android/server/BatteryService.java +++ b/services/core/java/com/android/server/BatteryService.java @@ -238,13 +238,16 @@ public final class BatteryService extends SystemService { final SomeArgs args = (SomeArgs) msg.obj; final Context context; final Intent intent; + final boolean forceUpdate; try { context = (Context) args.arg1; intent = (Intent) args.arg2; + forceUpdate = (Boolean) args.arg3; } finally { args.recycle(); } - broadcastBatteryChangedIntent(context, intent, BATTERY_CHANGED_OPTIONS); + broadcastBatteryChangedIntent(context, intent, BATTERY_CHANGED_OPTIONS, + forceUpdate); return true; } case MSG_BROADCAST_POWER_CONNECTION_CHANGED: { @@ -798,7 +801,7 @@ public final class BatteryService extends SystemService { // We are doing this after sending the above broadcasts, so anything processing // them will get the new sequence number at that point. (See for example how testing // of JobScheduler's BatteryController works.) - sendBatteryChangedIntentLocked(); + sendBatteryChangedIntentLocked(force); if (mLastBatteryLevel != mHealthInfo.batteryLevel || mLastPlugType != mPlugType) { sendBatteryLevelChangedIntentLocked(); } @@ -829,7 +832,7 @@ public final class BatteryService extends SystemService { } } - private void sendBatteryChangedIntentLocked() { + private void sendBatteryChangedIntentLocked(boolean forceUpdate) { // Pack up the values and broadcast them to everyone final Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY @@ -869,15 +872,17 @@ public final class BatteryService extends SystemService { final SomeArgs args = SomeArgs.obtain(); args.arg1 = mContext; args.arg2 = intent; + args.arg3 = forceUpdate; mHandler.obtainMessage(MSG_BROADCAST_BATTERY_CHANGED, args).sendToTarget(); } else { mHandler.post(() -> broadcastBatteryChangedIntent(mContext, - intent, BATTERY_CHANGED_OPTIONS)); + intent, BATTERY_CHANGED_OPTIONS, forceUpdate)); } } private static void broadcastBatteryChangedIntent(Context context, Intent intent, - Bundle options) { + Bundle options, boolean forceUpdate) { + traceBatteryChangedBroadcastEvent(intent, forceUpdate); // TODO (293959093): It is important that SystemUI receives this broadcast as soon as // possible. Ideally, it should be using binder callbacks but until then, dispatch this // as a foreground broadcast to SystemUI. @@ -895,6 +900,53 @@ public final class BatteryService extends SystemService { AppOpsManager.OP_NONE, options, UserHandle.USER_ALL); } + private static void traceBatteryChangedBroadcastEvent(Intent intent, boolean forceUpdate) { + if (!com.android.server.flags.Flags.traceBatteryChangedBroadcastEvent()) { + return; + } + if (!Trace.isTagEnabled(Trace.TRACE_TAG_SYSTEM_SERVER)) return; + + final StringBuilder builder = new StringBuilder(); + builder.append("broadcastBatteryChanged; "); + builder.append("force="); builder.append(forceUpdate); + builder.append(",seq="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_SEQUENCE, -1)); + builder.append(",s="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_STATUS, -1)); + builder.append(",h="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_HEALTH, -1)); + builder.append(",p="); builder.append(intent.getBooleanExtra( + BatteryManager.EXTRA_PRESENT, false)); + builder.append(",l="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_LEVEL, -1)); + builder.append(",bl="); builder.append(intent.getBooleanExtra( + BatteryManager.EXTRA_BATTERY_LOW, false)); + builder.append(",sc="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_SCALE, -1)); + builder.append(",pt="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_PLUGGED, -1)); + builder.append(",v="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_VOLTAGE, -1)); + builder.append(",t="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_TEMPERATURE, -1)); + builder.append(",tech="); builder.append(intent.getStringExtra( + BatteryManager.EXTRA_TECHNOLOGY)); + builder.append(",invc="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_INVALID_CHARGER, -1)); + builder.append(",mcc="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_MAX_CHARGING_CURRENT, -1)); + builder.append(",mcv="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE, -1)); + builder.append(",chc="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_CHARGE_COUNTER, -1)); + builder.append(",cc="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_CYCLE_COUNT, -1)); + builder.append(",chs="); builder.append(intent.getIntExtra( + BatteryManager.EXTRA_CHARGING_STATUS, -1)); + + Trace.instant(Trace.TRACE_TAG_SYSTEM_SERVER, builder.toString()); + } + private void sendBatteryLevelChangedIntentLocked() { Bundle event = new Bundle(); long now = SystemClock.elapsedRealtime(); diff --git a/services/core/java/com/android/server/flags/services.aconfig b/services/core/java/com/android/server/flags/services.aconfig index 649678c13a00..69ba785b3b4f 100644 --- a/services/core/java/com/android/server/flags/services.aconfig +++ b/services/core/java/com/android/server/flags/services.aconfig @@ -56,3 +56,14 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + namespace: "backstage_power" + name: "trace_battery_changed_broadcast_event" + description: "Add tracing to record battery changed broadcast event" + bug: "365410144" + is_fixed_read_only: true + metadata { + purpose: PURPOSE_BUGFIX + } +} -- GitLab From 65388c2c5998e56b2851bf4ee28334ec2d41fab6 Mon Sep 17 00:00:00 2001 From: Chandru S Date: Mon, 9 Sep 2024 22:33:40 +0000 Subject: [PATCH 154/492] Include keyguard dismiss action refactor as part of compose bouncer Test: Everything builds Bug: 310005730 Flag: com.android.systemui.compose_bouncer Flag: com.android.systemui.scene_container Change-Id: I7e4640f70577ec5c64c271a89b866e75b21033bd --- .../bouncer/shared/flag/ComposeBouncerFlags.kt | 4 ++++ .../ui/binder/KeyguardDismissActionBinder.kt | 4 ++-- .../keyguard/ui/binder/KeyguardDismissBinder.kt | 6 ++---- .../keyguard/ui/viewmodel/BouncerToGoneFlows.kt | 4 ++-- .../PrimaryBouncerToGoneTransitionViewModel.kt | 6 +++--- .../phone/StatusBarKeyguardViewManager.java | 15 +++++++++------ 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/shared/flag/ComposeBouncerFlags.kt b/packages/SystemUI/src/com/android/systemui/bouncer/shared/flag/ComposeBouncerFlags.kt index a1111f68f1ee..d7a4863bde02 100644 --- a/packages/SystemUI/src/com/android/systemui/bouncer/shared/flag/ComposeBouncerFlags.kt +++ b/packages/SystemUI/src/com/android/systemui/bouncer/shared/flag/ComposeBouncerFlags.kt @@ -21,6 +21,10 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag object ComposeBouncerFlags { + /** @see [isComposeBouncerOrSceneContainerEnabled] */ + val isEnabled: Boolean + get() = isComposeBouncerOrSceneContainerEnabled() + /** * Returns `true` if the Compose bouncer is enabled or if the scene container framework is * enabled; `false` otherwise. diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardDismissActionBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardDismissActionBinder.kt index 74a7262d7889..69cb6a92137f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardDismissActionBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardDismissActionBinder.kt @@ -17,11 +17,11 @@ package com.android.systemui.keyguard.ui.binder import com.android.keyguard.logging.KeyguardLogger import com.android.systemui.CoreStartable +import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.domain.interactor.KeyguardDismissActionInteractor import com.android.systemui.log.core.LogLevel -import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.util.kotlin.sample import dagger.Lazy import javax.inject.Inject @@ -41,7 +41,7 @@ constructor( ) : CoreStartable { override fun start() { - if (!SceneContainerFlag.isEnabled) { + if (!ComposeBouncerFlags.isEnabled) { return } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardDismissBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardDismissBinder.kt index ac24591d69d7..b55f813a1f84 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardDismissBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardDismissBinder.kt @@ -18,13 +18,12 @@ package com.android.systemui.keyguard.ui.binder import com.android.keyguard.ViewMediatorCallback import com.android.keyguard.logging.KeyguardLogger import com.android.systemui.CoreStartable +import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application -import com.android.systemui.flags.FeatureFlagsClassic import com.android.systemui.keyguard.domain.interactor.KeyguardDismissInteractor import com.android.systemui.keyguard.shared.model.KeyguardDone import com.android.systemui.log.core.LogLevel -import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.user.domain.interactor.SelectedUserInteractor import javax.inject.Inject import kotlinx.coroutines.CoroutineScope @@ -40,11 +39,10 @@ constructor( private val viewMediatorCallback: ViewMediatorCallback, @Application private val scope: CoroutineScope, private val keyguardLogger: KeyguardLogger, - private val featureFlags: FeatureFlagsClassic, ) : CoreStartable { override fun start() { - if (!SceneContainerFlag.isEnabled) { + if (!ComposeBouncerFlags.isEnabled) { return } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlows.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlows.kt index 8485a265fc70..1edfec8f9e68 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlows.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlows.kt @@ -18,6 +18,7 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.app.animation.Interpolators.EMPHASIZED_ACCELERATE import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor +import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags import com.android.systemui.keyguard.domain.interactor.KeyguardDismissActionInteractor import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState @@ -25,7 +26,6 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.keyguard.shared.model.KeyguardState.PRIMARY_BOUNCER import com.android.systemui.keyguard.shared.model.ScrimAlpha import com.android.systemui.keyguard.ui.KeyguardTransitionAnimationFlow -import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.SysuiStatusBarStateController @@ -51,7 +51,7 @@ constructor( ) { /** Common fade for scrim alpha values during *BOUNCER->GONE */ fun scrimAlpha(duration: Duration, fromState: KeyguardState): Flow { - return if (SceneContainerFlag.isEnabled) { + return if (ComposeBouncerFlags.isEnabled) { keyguardDismissActionInteractor .get() .willAnimateDismissActionOnLockscreen diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt index 8811908e1d45..17c678e79d8b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor +import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.domain.interactor.FromPrimaryBouncerTransitionInteractor.Companion.TO_GONE_DURATION import com.android.systemui.keyguard.domain.interactor.KeyguardDismissActionInteractor @@ -25,7 +26,6 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.keyguard.shared.model.KeyguardState.PRIMARY_BOUNCER import com.android.systemui.keyguard.shared.model.ScrimAlpha import com.android.systemui.keyguard.ui.KeyguardTransitionAnimationFlow -import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.statusbar.SysuiStatusBarStateController import dagger.Lazy import javax.inject.Inject @@ -85,7 +85,7 @@ constructor( /** Bouncer container alpha */ val bouncerAlpha: Flow = - if (SceneContainerFlag.isEnabled) { + if (ComposeBouncerFlags.isEnabled) { keyguardDismissActionInteractor .get() .willAnimateDismissActionOnLockscreen @@ -110,7 +110,7 @@ constructor( /** Lockscreen alpha */ val lockscreenAlpha: Flow = - if (SceneContainerFlag.isEnabled) { + if (ComposeBouncerFlags.isEnabled) { keyguardDismissActionInteractor .get() .willAnimateDismissActionOnLockscreen diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 43f9af6016f1..62cba2cff631 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -61,6 +61,7 @@ import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerCallbackInteractor; import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerCallbackInteractor.PrimaryBouncerExpansionCallback; import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor; +import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags; import com.android.systemui.bouncer.ui.BouncerView; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; @@ -70,8 +71,8 @@ import com.android.systemui.dock.DockManager; import com.android.systemui.dreams.DreamOverlayStateController; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.keyguard.KeyguardWmStateRefactor; -import com.android.systemui.keyguard.domain.interactor.KeyguardDismissTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardDismissActionInteractor; +import com.android.systemui.keyguard.domain.interactor.KeyguardDismissTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.keyguard.shared.model.DismissAction; import com.android.systemui.keyguard.shared.model.Edge; @@ -834,7 +835,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void dismissWithAction(OnDismissAction r, Runnable cancelAction, boolean afterKeyguardGone, String message) { - if (SceneContainerFlag.isEnabled()) { + if (ComposeBouncerFlags.INSTANCE.isEnabled()) { if (r == null) { return; } @@ -886,7 +887,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb return; } - if (!SceneContainerFlag.isEnabled()) { + if (!ComposeBouncerFlags.INSTANCE.isEnabled()) { mAfterKeyguardGoneAction = r; mKeyguardGoneCancelAction = cancelAction; mDismissActionWillAnimateOnKeyguard = r != null @@ -960,7 +961,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * Adds a {@param runnable} to be executed after Keyguard is gone. */ public void addAfterKeyguardGoneRunnable(Runnable runnable) { - if (SceneContainerFlag.isEnabled()) { + if (ComposeBouncerFlags.INSTANCE.isEnabled()) { if (runnable != null) { mKeyguardDismissActionInteractor.get().runAfterKeyguardGone(runnable); } @@ -1173,7 +1174,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb // We update the state (which will show the keyguard) only if an animation will run on // the keyguard. If there is no animation, we wait before updating the state so that we // go directly from bouncer to launcher/app. - if (SceneContainerFlag.isEnabled()) { + if (ComposeBouncerFlags.INSTANCE.isEnabled()) { if (mKeyguardDismissActionInteractor.get().runDismissAnimationOnKeyguard()) { updateStates(); } @@ -1300,7 +1301,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } private void executeAfterKeyguardGoneAction() { - if (SceneContainerFlag.isEnabled()) { + if (ComposeBouncerFlags.INSTANCE.isEnabled()) { return; } if (mAfterKeyguardGoneAction != null) { @@ -1696,6 +1697,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb pw.println(" Registered KeyguardViewManagerCallbacks:"); pw.println(" SceneContainerFlag enabled:" + SceneContainerFlag.isEnabled()); + pw.println(" ComposeBouncerFlags enabled:" + + ComposeBouncerFlags.INSTANCE.isEnabled()); for (KeyguardViewManagerCallback callback : mCallbacks) { pw.println(" " + callback); } -- GitLab From 9eb05607c7d6d0ceb6bb33cf95041683d9b3da66 Mon Sep 17 00:00:00 2001 From: Chandru S Date: Mon, 9 Sep 2024 22:19:23 +0000 Subject: [PATCH 155/492] Update KeyguardDismissActionInteractor to work with compose bouncer Test: everything builds, verified that fingerprint auth dismisses keyguard and bouncer. Bug: 310005730 Fixes: 358607623 Fixes: 361793240 Flag: com.android.systemui.compose_bouncer Flag: com.android.systemui.scene_container Change-Id: Iba982234448bd0527d29aceb7f03a9f2bf6d6f61 --- .../KeyguardDismissActionInteractor.kt | 45 ++++++++++++++----- .../KeyguardDismissActionInteractorTest.kt | 13 +++--- .../KeyguardDismissActionInteractorKosmos.kt | 11 +++-- 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractor.kt index 7801c00d83b8..60c53863535d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractor.kt @@ -18,6 +18,7 @@ package com.android.systemui.keyguard.domain.interactor import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor +import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor @@ -32,6 +33,7 @@ import com.android.systemui.scene.domain.resolver.NotifShadeSceneFamilyResolver import com.android.systemui.scene.domain.resolver.QuickSettingsSceneFamilyResolver import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Scenes +import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.util.kotlin.Utils.Companion.sampleFilter import com.android.systemui.util.kotlin.sample import javax.inject.Inject @@ -44,6 +46,7 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNot +import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.stateIn @@ -58,12 +61,14 @@ constructor( transitionInteractor: KeyguardTransitionInteractor, val dismissInteractor: KeyguardDismissInteractor, @Application private val applicationScope: CoroutineScope, - sceneInteractor: SceneInteractor, - deviceEntryInteractor: DeviceEntryInteractor, - quickSettingsSceneFamilyResolver: QuickSettingsSceneFamilyResolver, - notifShadeSceneFamilyResolver: NotifShadeSceneFamilyResolver, + sceneInteractor: dagger.Lazy, + deviceEntryInteractor: dagger.Lazy, + quickSettingsSceneFamilyResolver: dagger.Lazy, + notifShadeSceneFamilyResolver: dagger.Lazy, powerInteractor: PowerInteractor, alternateBouncerInteractor: AlternateBouncerInteractor, + keyguardInteractor: dagger.Lazy, + shadeInteractor: dagger.Lazy, ) { val dismissAction: Flow = repository.dismissAction @@ -98,15 +103,31 @@ constructor( * device is unlocked. Else, false. */ private val isOnShadeWhileUnlocked: Flow = - combine( - sceneInteractor.currentScene, - deviceEntryInteractor.isUnlocked, - ) { scene, isUnlocked -> - isUnlocked && - (quickSettingsSceneFamilyResolver.includesScene(scene) || - notifShadeSceneFamilyResolver.includesScene(scene)) + if (SceneContainerFlag.isEnabled) { + combine( + sceneInteractor.get().currentScene, + deviceEntryInteractor.get().isUnlocked, + ) { scene, isUnlocked -> + isUnlocked && + (quickSettingsSceneFamilyResolver.get().includesScene(scene) || + notifShadeSceneFamilyResolver.get().includesScene(scene)) + } + .distinctUntilChanged() + } else if (ComposeBouncerFlags.isOnlyComposeBouncerEnabled()) { + shadeInteractor.get().isAnyExpanded.sample( + keyguardInteractor.get().isKeyguardDismissible + ) { isAnyExpanded, isKeyguardDismissible -> + isAnyExpanded && isKeyguardDismissible + } + } else { + flow { + error( + "This should not be used when both SceneContainerFlag " + + "and ComposeBouncerFlag are disabled" + ) } - .distinctUntilChanged() + } + val executeDismissAction: Flow<() -> KeyguardDone> = merge( finishedTransitionToGone, diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt index 3cbbb648af94..bea415cbb934 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt @@ -22,8 +22,8 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.shared.model.AuthenticationMethodModel -import com.android.systemui.bouncer.domain.interactor.alternateBouncerInteractor import com.android.systemui.bouncer.data.repository.fakeKeyguardBouncerRepository +import com.android.systemui.bouncer.domain.interactor.alternateBouncerInteractor import com.android.systemui.coroutines.collectLastValue import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.flags.EnableSceneContainer @@ -42,6 +42,7 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.domain.resolver.notifShadeSceneFamilyResolver import com.android.systemui.scene.domain.resolver.quickSettingsSceneFamilyResolver import com.android.systemui.scene.shared.model.Scenes +import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -77,12 +78,14 @@ class KeyguardDismissActionInteractorTest : SysuiTestCase() { transitionInteractor = kosmos.keyguardTransitionInteractor, dismissInteractor = dismissInteractor, applicationScope = testScope.backgroundScope, - sceneInteractor = kosmos.sceneInteractor, - deviceEntryInteractor = kosmos.deviceEntryInteractor, - quickSettingsSceneFamilyResolver = kosmos.quickSettingsSceneFamilyResolver, - notifShadeSceneFamilyResolver = kosmos.notifShadeSceneFamilyResolver, + sceneInteractor = { kosmos.sceneInteractor }, + deviceEntryInteractor = { kosmos.deviceEntryInteractor }, + quickSettingsSceneFamilyResolver = { kosmos.quickSettingsSceneFamilyResolver }, + notifShadeSceneFamilyResolver = { kosmos.notifShadeSceneFamilyResolver }, powerInteractor = kosmos.powerInteractor, alternateBouncerInteractor = kosmos.alternateBouncerInteractor, + keyguardInteractor = { kosmos.keyguardInteractor }, + shadeInteractor = { kosmos.shadeInteractor }, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorKosmos.kt index 27eadb147055..d920c4f05b03 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorKosmos.kt @@ -25,6 +25,7 @@ import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.domain.resolver.notifShadeSceneFamilyResolver import com.android.systemui.scene.domain.resolver.quickSettingsSceneFamilyResolver +import com.android.systemui.shade.domain.interactor.shadeInteractor import kotlinx.coroutines.ExperimentalCoroutinesApi @ExperimentalCoroutinesApi @@ -35,11 +36,13 @@ val Kosmos.keyguardDismissActionInteractor by transitionInteractor = keyguardTransitionInteractor, dismissInteractor = keyguardDismissInteractor, applicationScope = testScope.backgroundScope, - sceneInteractor = sceneInteractor, - deviceEntryInteractor = deviceEntryInteractor, - quickSettingsSceneFamilyResolver = quickSettingsSceneFamilyResolver, - notifShadeSceneFamilyResolver = notifShadeSceneFamilyResolver, + sceneInteractor = { sceneInteractor }, + deviceEntryInteractor = { deviceEntryInteractor }, + quickSettingsSceneFamilyResolver = { quickSettingsSceneFamilyResolver }, + notifShadeSceneFamilyResolver = { notifShadeSceneFamilyResolver }, powerInteractor = powerInteractor, alternateBouncerInteractor = alternateBouncerInteractor, + keyguardInteractor = { keyguardInteractor }, + shadeInteractor = { shadeInteractor }, ) } -- GitLab From 57b9d11335735afaf3ee49c6b1edd92cab7dd69c Mon Sep 17 00:00:00 2001 From: Jacqueline Bronger Date: Tue, 10 Sep 2024 01:20:02 +0200 Subject: [PATCH 156/492] Show mute icon when volume at zero. Previously there were different icons for mute vs volume set to zero on TV only. Bug: 340265802 Bug: 351992317 Test: atest VolumeDialogImplTest + manual Flag: EXEMPT bugfix Change-Id: I11016de7a73dc4900e72f472d0f5ee144eb5df58 --- .../res/drawable/ic_volume_media_off.xml | 20 ------------------- .../systemui/volume/VolumeDialogImpl.java | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 packages/SystemUI/res/drawable/ic_volume_media_off.xml diff --git a/packages/SystemUI/res/drawable/ic_volume_media_off.xml b/packages/SystemUI/res/drawable/ic_volume_media_off.xml deleted file mode 100644 index 875b7b6d1f40..000000000000 --- a/packages/SystemUI/res/drawable/ic_volume_media_off.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index eb9151868b79..8dbc42374b5f 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -1993,7 +1993,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, : R.drawable.ic_volume_media_bt; } } else if (isStreamMuted(ss)) { - iconRes = (ss.muted && isTv()) ? R.drawable.ic_volume_media_off : row.iconMuteRes; + iconRes = row.iconMuteRes; } else { iconRes = mShowLowMediaVolumeIcon && ss.level * 2 < (ss.levelMax + ss.levelMin) ? R.drawable.ic_volume_media_low : row.iconRes; -- GitLab From b91437020051b4f7fb78dbe14b40dd2f7c754f48 Mon Sep 17 00:00:00 2001 From: Dipankar Bhardwaj Date: Wed, 21 Aug 2024 14:26:50 +0000 Subject: [PATCH 157/492] Restrict access to directories Restricted access to Android/data, Android/obb and Android/sandbox directories and its sub-directories. Replacing path's pattern match check with file equality check. Test: atest DocumentsClientTest Bug: 341680936 Flag: EXEMPT bug fix Change-Id: I8879900e57e1702d11797b81e86d0cc3f55bac22 --- .../ExternalStorageProvider.java | 79 ++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java index 3409c29d3c2c..defbc1142adb 100644 --- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java @@ -16,8 +16,6 @@ package com.android.externalstorage; -import static java.util.regex.Pattern.CASE_INSENSITIVE; - import android.annotation.NonNull; import android.annotation.Nullable; import android.app.usage.StorageStatsManager; @@ -61,12 +59,15 @@ import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.UUID; -import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * Presents content of the shared (a.k.a. "external") storage. @@ -89,12 +90,9 @@ public class ExternalStorageProvider extends FileSystemProvider { private static final Uri BASE_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY).build(); - /** - * Regex for detecting {@code /Android/data/}, {@code /Android/obb/} and - * {@code /Android/sandbox/} along with all their subdirectories and content. - */ - private static final Pattern PATTERN_RESTRICTED_ANDROID_SUBTREES = - Pattern.compile("^Android/(?:data|obb|sandbox)(?:/.+)?", CASE_INSENSITIVE); + private static final String PRIMARY_EMULATED_STORAGE_PATH = "/storage/emulated/"; + + private static final String STORAGE_PATH = "/storage/"; private static final String[] DEFAULT_ROOT_PROJECTION = new String[] { Root.COLUMN_ROOT_ID, Root.COLUMN_FLAGS, Root.COLUMN_ICON, Root.COLUMN_TITLE, @@ -309,10 +307,69 @@ public class ExternalStorageProvider extends FileSystemProvider { return false; } - final String path = getPathFromDocId(documentId); - return PATTERN_RESTRICTED_ANDROID_SUBTREES.matcher(path).matches(); + try { + final RootInfo root = getRootFromDocId(documentId); + final String canonicalPath = getPathFromDocId(documentId); + return isRestrictedPath(root.rootId, canonicalPath); + } catch (Exception e) { + return true; + } } + /** + * Based on the given root id and path, we restrict path access if file is Android/data or + * Android/obb or Android/sandbox or one of their subdirectories. + * + * @param canonicalPath of the file + * @return true if path is restricted + */ + private boolean isRestrictedPath(String rootId, String canonicalPath) { + if (rootId == null || canonicalPath == null) { + return true; + } + + final String rootPath; + if (rootId.equalsIgnoreCase(ROOT_ID_PRIMARY_EMULATED)) { + // Creates "/storage/emulated/" + rootPath = PRIMARY_EMULATED_STORAGE_PATH + UserHandle.myUserId(); + } else { + // Creates "/storage/" + rootPath = STORAGE_PATH + rootId; + } + List restrictedPathList = Arrays.asList( + Paths.get(rootPath, "Android", "data"), + Paths.get(rootPath, "Android", "obb"), + Paths.get(rootPath, "Android", "sandbox")); + // We need to identify restricted parent paths which actually exist on the device + List validRestrictedPathsToCheck = restrictedPathList.stream().filter( + Files::exists).collect(Collectors.toList()); + + boolean isRestricted = false; + java.nio.file.Path filePathToCheck = Paths.get(rootPath, canonicalPath); + try { + while (filePathToCheck != null) { + for (java.nio.file.Path restrictedPath : validRestrictedPathsToCheck) { + if (Files.isSameFile(restrictedPath, filePathToCheck)) { + isRestricted = true; + Log.v(TAG, "Restricting access for path: " + filePathToCheck); + break; + } + } + if (isRestricted) { + break; + } + + filePathToCheck = filePathToCheck.getParent(); + } + } catch (Exception e) { + Log.w(TAG, "Error in checking file equality check.", e); + isRestricted = true; + } + + return isRestricted; + } + + /** * Check that the directory is the root of storage or blocked file from tree. *

-- GitLab From 2af2a8c35619557d206c0616a21e12470854f1a5 Mon Sep 17 00:00:00 2001 From: Abhishek Gadewar Date: Mon, 9 Sep 2024 17:08:08 -0700 Subject: [PATCH 158/492] ThermalManager: Don't hold mSamples lock while calling power HAL Summary: There is no need to hold the lock while making the call to the power HAL. In the case the HAL call takes a long time due to hardware reads, holding the lock may cause lock contention from other threads. Test: build passes Tags: Change-Id: I6b1f8d1228de17e4bf188bd99037b02ac7ebff1a Signed-off-by: Abhishek Gadewar --- .../java/com/android/server/power/ThermalManagerService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/power/ThermalManagerService.java b/services/core/java/com/android/server/power/ThermalManagerService.java index 24d7acd772c1..10985a79466e 100644 --- a/services/core/java/com/android/server/power/ThermalManagerService.java +++ b/services/core/java/com/android/server/power/ThermalManagerService.java @@ -1591,9 +1591,9 @@ public class ThermalManagerService extends SystemService { long mInactivityThresholdMillis = INACTIVITY_THRESHOLD_MILLIS; void updateThresholds() { - synchronized (mSamples) { - List thresholds = + List thresholds = mHalWrapper.getTemperatureThresholds(true, Temperature.TYPE_SKIN); + synchronized (mSamples) { if (Flags.allowThermalHeadroomThresholds()) { Arrays.fill(mHeadroomThresholds, Float.NaN); } -- GitLab From 7f30249a02c059800bb4eb4b71fd8b22ffe2ee2f Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Fri, 6 Sep 2024 15:49:34 -0700 Subject: [PATCH 159/492] Add interface for radio service user controller Refactored radio service user controller to interface to avoid mocking static methods in unit tests, which causes test flakiness. Bug: 363965571 Flag: EXEMPT refactor Test: atest BroadcastRadioTests Change-Id: I1c05ff684bc969c704cb1531ee1c7efb84465003 --- .../RadioServiceUserControllerTest.java | 14 ++--- .../aidl/BroadcastRadioServiceImplTest.java | 15 +++--- .../broadcastradio/aidl/RadioModuleTest.java | 7 ++- .../broadcastradio/aidl/TunerSessionTest.java | 33 ++++++------ .../hal2/BroadcastRadioServiceHidlTest.java | 15 +++--- .../hal2/RadioModuleHidlTest.java | 7 ++- .../StartProgramListUpdatesFanoutTest.java | 20 ++++--- .../hal2/TunerSessionHidlTest.java | 32 +++++------ .../broadcastradio/BroadcastRadioService.java | 5 +- .../broadcastradio/IRadioServiceAidlImpl.java | 5 +- .../broadcastradio/IRadioServiceHidlImpl.java | 9 ++-- .../RadioServiceUserController.java | 34 +++--------- .../RadioServiceUserControllerImpl.java | 54 +++++++++++++++++++ .../aidl/BroadcastRadioServiceImpl.java | 10 ++-- .../broadcastradio/aidl/RadioModule.java | 14 +++-- .../broadcastradio/aidl/TunerSession.java | 25 +++++---- .../hal1/BroadcastRadioService.java | 7 ++- .../server/broadcastradio/hal1/Tuner.java | 22 ++++---- .../hal2/BroadcastRadioService.java | 14 +++-- .../broadcastradio/hal2/RadioModule.java | 16 +++--- .../broadcastradio/hal2/TunerSession.java | 28 +++++----- 21 files changed, 234 insertions(+), 152 deletions(-) create mode 100644 services/core/java/com/android/server/broadcastradio/RadioServiceUserControllerImpl.java diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java index 516253b0ebff..9c9dfe8174f2 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java @@ -41,6 +41,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe private static final int USER_ID_1 = 11; private static final int USER_ID_2 = 12; + private RadioServiceUserController mUserController; @Mock private UserHandle mUserHandleMock; @@ -55,6 +56,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe public void setUp() { doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle()); doReturn(USER_ID_1).when(() -> ActivityManager.getCurrentUser()); + mUserController = new RadioServiceUserControllerImpl(); } @Test @@ -62,7 +64,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); assertWithMessage("Current user") - .that(RadioServiceUserController.isCurrentOrSystemUser()).isTrue(); + .that(mUserController.isCurrentOrSystemUser()).isTrue(); } @Test @@ -70,7 +72,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_2); assertWithMessage("Non-current user") - .that(RadioServiceUserController.isCurrentOrSystemUser()).isFalse(); + .that(mUserController.isCurrentOrSystemUser()).isFalse(); } @Test @@ -79,7 +81,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(UserHandle.USER_SYSTEM); assertWithMessage("System user") - .that(RadioServiceUserController.isCurrentOrSystemUser()).isTrue(); + .that(mUserController.isCurrentOrSystemUser()).isTrue(); } @Test @@ -88,13 +90,13 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser); assertWithMessage("User when activity manager fails") - .that(RadioServiceUserController.isCurrentOrSystemUser()).isFalse(); + .that(mUserController.isCurrentOrSystemUser()).isFalse(); } @Test public void getCurrentUser() { assertWithMessage("Current user") - .that(RadioServiceUserController.getCurrentUser()).isEqualTo(USER_ID_1); + .that(mUserController.getCurrentUser()).isEqualTo(USER_ID_1); } @Test @@ -103,6 +105,6 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser); assertWithMessage("Current user when activity manager fails") - .that(RadioServiceUserController.getCurrentUser()).isEqualTo(UserHandle.USER_NULL); + .that(mUserController.getCurrentUser()).isEqualTo(UserHandle.USER_NULL); } } diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImplTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImplTest.java index 22f3bd4abe11..63f12d82b48a 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImplTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImplTest.java @@ -91,12 +91,13 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes private IAnnouncementListener mAnnouncementListenerMock; @Mock private IBinder mListenerBinderMock; + @Mock + private RadioServiceUserController mUserControllerMock; @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { builder.spyStatic(ServiceManager.class) - .spyStatic(RadioModule.class) - .spyStatic(RadioServiceUserController.class); + .spyStatic(RadioModule.class); } @Test @@ -156,7 +157,7 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes @Test public void openSession_forNonCurrentUser_throwsException() throws Exception { createBroadcastRadioService(); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); IllegalStateException thrown = assertThrows(IllegalStateException.class, () -> mBroadcastRadioService.openSession(FM_RADIO_MODULE_ID, @@ -206,9 +207,9 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes } private void createBroadcastRadioService() throws RemoteException { - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); mockServiceManager(); - mBroadcastRadioService = new BroadcastRadioServiceImpl(SERVICE_LIST); + mBroadcastRadioService = new BroadcastRadioServiceImpl(SERVICE_LIST, mUserControllerMock); } private void mockServiceManager() throws RemoteException { @@ -222,9 +223,9 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes any(IServiceCallback.class))); doReturn(mFmRadioModuleMock).when(() -> RadioModule.tryLoadingModule( - eq(FM_RADIO_MODULE_ID), anyString(), any(IBinder.class))); + eq(FM_RADIO_MODULE_ID), anyString(), any(IBinder.class), any())); doReturn(mDabRadioModuleMock).when(() -> RadioModule.tryLoadingModule( - eq(DAB_RADIO_MODULE_ID), anyString(), any(IBinder.class))); + eq(DAB_RADIO_MODULE_ID), anyString(), any(IBinder.class), any())); when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock); when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/RadioModuleTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/RadioModuleTest.java index a952bde956d8..368df090070b 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/RadioModuleTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/RadioModuleTest.java @@ -34,6 +34,8 @@ import android.hardware.radio.RadioManager; import android.os.ParcelableException; import android.os.RemoteException; +import com.android.server.broadcastradio.RadioServiceUserController; + import com.google.common.truth.Expect; import org.junit.Before; @@ -63,6 +65,8 @@ public final class RadioModuleTest { private IAnnouncementListener mListenerMock; @Mock private android.hardware.broadcastradio.ICloseHandle mHalCloseHandleMock; + @Mock + private RadioServiceUserController mUserControllerMock; // RadioModule under test private RadioModule mRadioModule; @@ -70,7 +74,8 @@ public final class RadioModuleTest { @Before public void setup() throws RemoteException { - mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES); + mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES, + mUserControllerMock); // TODO(b/241118988): test non-null image for getImage method when(mBroadcastRadioMock.getImage(anyInt())).thenReturn(null); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java index 92dfe38c31fe..e0b97dc3cb2a 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java @@ -152,6 +152,8 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Mock private IBroadcastRadio mBroadcastRadioMock; private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks; + @Mock + private RadioServiceUserController mUserControllerMock; // RadioModule under test private RadioModule mRadioModule; @@ -170,8 +172,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(RadioServiceUserController.class).spyStatic(CompatChanges.class) - .spyStatic(Binder.class); + builder.spyStatic(CompatChanges.class).spyStatic(Binder.class); } @Before @@ -184,11 +185,11 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { eq(ConversionUtils.RADIO_U_VERSION_REQUIRED), anyInt())); doReturn(USER_ID_1).when(mUserHandleMock).getIdentifier(); doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle()); - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); - doReturn(USER_ID_1).when(() -> RadioServiceUserController.getCurrentUser()); + doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); + doReturn(USER_ID_1).when(mUserControllerMock).getCurrentUser(); mRadioModule = new RadioModule(mBroadcastRadioMock, - AidlTestUtils.makeDefaultModuleProperties()); + AidlTestUtils.makeDefaultModuleProperties(), mUserControllerMock); doAnswer(invocation -> { mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0]; @@ -237,7 +238,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Test public void setConfiguration_forNonCurrentUser_doesNotInvokesCallback() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setConfiguration(FM_BAND_CONFIG); @@ -434,7 +435,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Test public void tune_forNonCurrentUser_doesNotTune() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); ProgramSelector initialSel = AidlTestUtils.makeFmSelector(AM_FM_FREQUENCY_LIST[1]); RadioManager.ProgramInfo tuneInfo = AidlTestUtils.makeProgramInfo(initialSel, SIGNAL_QUALITY); @@ -514,7 +515,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); mHalCurrentInfo = AidlTestUtils.makeHalProgramInfo( ConversionUtils.programSelectorToHalProgramSelector(initialSel), SIGNAL_QUALITY); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].step(/* directionDown= */ true, /* skipSubChannel= */ false); @@ -593,7 +594,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); mHalCurrentInfo = AidlTestUtils.makeHalProgramInfo( ConversionUtils.programSelectorToHalProgramSelector(initialSel), SIGNAL_QUALITY); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].seek(/* directionDown= */ true, /* skipSubChannel= */ false); @@ -627,7 +628,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Test public void cancel_forNonCurrentUser_doesNotCancel() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].cancel(); @@ -698,7 +699,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Test public void startBackgroundScan_forNonCurrentUser_doesNotInvokesCallback() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].startBackgroundScan(); @@ -968,7 +969,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(), /* includeCategories= */ true, /* excludeModifications= */ false); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].startProgramListUpdates(filter); @@ -1007,7 +1008,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(), /* includeCategories= */ true, /* excludeModifications= */ false); mTunerSessions[0].startProgramListUpdates(filter); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].stopProgramListUpdates(); @@ -1073,7 +1074,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { public void setConfigFlag_forNonCurrentUser_doesNotSetConfigFlag() throws Exception { openAidlClients(/* numClients= */ 1); int flag = UNSUPPORTED_CONFIG_FLAG + 1; - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setConfigFlag(flag, /* value= */ true); @@ -1138,7 +1139,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); Map parametersSet = Map.of("mockParam1", "mockValue1", "mockParam2", "mockValue2"); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setParameters(parametersSet); @@ -1192,7 +1193,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { public void onCurrentProgramInfoChanged_withNonCurrentUser_doesNotInvokeCallback() throws Exception { openAidlClients(1); - doReturn(USER_ID_2).when(() -> RadioServiceUserController.getCurrentUser()); + doReturn(USER_ID_2).when(mUserControllerMock).getCurrentUser(); mHalTunerCallback.onCurrentProgramInfoChanged(AidlTestUtils.makeHalProgramInfo( AidlTestUtils.makeHalFmSelector(AM_FM_FREQUENCY_LIST[1]), SIGNAL_QUALITY)); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/BroadcastRadioServiceHidlTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/BroadcastRadioServiceHidlTest.java index acf698bce33d..7c3f221f9bf5 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/BroadcastRadioServiceHidlTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/BroadcastRadioServiceHidlTest.java @@ -88,11 +88,12 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes private IAnnouncementListener mAnnouncementListenerMock; @Mock private IBinder mBinderMock; + @Mock + private RadioServiceUserController mUserControllerMock; @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(RadioModule.class) - .spyStatic(RadioServiceUserController.class); + builder.spyStatic(RadioModule.class); } @Test @@ -156,7 +157,7 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes @Test public void openSession_forNonCurrentUser_throwsException() throws Exception { createBroadcastRadioService(); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + when(mUserControllerMock.isCurrentOrSystemUser()).thenReturn(false); IllegalStateException thrown = assertThrows(IllegalStateException.class, () -> mBroadcastRadioService.openSession(FM_RADIO_MODULE_ID, @@ -206,11 +207,11 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes } private void createBroadcastRadioService() throws RemoteException { - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + when(mUserControllerMock.isCurrentOrSystemUser()).thenReturn(true); mockServiceManager(); mBroadcastRadioService = new BroadcastRadioService(/* nextModuleId= */ FM_RADIO_MODULE_ID, - mServiceManagerMock); + mServiceManagerMock, mUserControllerMock); } private void mockServiceManager() throws RemoteException { @@ -231,9 +232,9 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes }).thenReturn(true); doReturn(mFmRadioModuleMock).when(() -> RadioModule.tryLoadingModule( - eq(FM_RADIO_MODULE_ID), anyString())); + eq(FM_RADIO_MODULE_ID), anyString(), any())); doReturn(mDabRadioModuleMock).when(() -> RadioModule.tryLoadingModule( - eq(DAB_RADIO_MODULE_ID), anyString())); + eq(DAB_RADIO_MODULE_ID), anyString(), any())); when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock); when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/RadioModuleHidlTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/RadioModuleHidlTest.java index 1f5e77038728..b53f7ca879aa 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/RadioModuleHidlTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/RadioModuleHidlTest.java @@ -36,6 +36,8 @@ import android.hardware.radio.ICloseHandle; import android.hardware.radio.RadioManager; import android.os.RemoteException; +import com.android.server.broadcastradio.RadioServiceUserController; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -61,13 +63,16 @@ public final class RadioModuleHidlTest { private IAnnouncementListener mListenerMock; @Mock private android.hardware.broadcastradio.V2_0.ICloseHandle mHalCloseHandleMock; + @Mock + private RadioServiceUserController mUserControllerMock; private RadioModule mRadioModule; private android.hardware.broadcastradio.V2_0.IAnnouncementListener mHalListener; @Before public void setup() throws RemoteException { - mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES); + mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES, + mUserControllerMock); when(mBroadcastRadioMock.getImage(anyInt())).thenReturn(new ArrayList(0)); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/StartProgramListUpdatesFanoutTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/StartProgramListUpdatesFanoutTest.java index 8c16d79133ce..fa0744775f6d 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/StartProgramListUpdatesFanoutTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/StartProgramListUpdatesFanoutTest.java @@ -38,13 +38,13 @@ import android.hardware.radio.RadioManager; import android.hardware.radio.UniqueProgramIdentifier; import android.os.RemoteException; -import com.android.dx.mockito.inline.extended.StaticMockitoSessionBuilder; -import com.android.server.broadcastradio.ExtendedRadioMockitoTestCase; import com.android.server.broadcastradio.RadioServiceUserController; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import org.mockito.verification.VerificationWithTimeout; @@ -55,7 +55,8 @@ import java.util.List; /** * Tests for v2 HAL RadioModule. */ -public class StartProgramListUpdatesFanoutTest extends ExtendedRadioMockitoTestCase { +@RunWith(MockitoJUnitRunner.class) +public class StartProgramListUpdatesFanoutTest { private static final String TAG = "BroadcastRadioTests.hal2.StartProgramListUpdatesFanout"; private static final VerificationWithTimeout CB_TIMEOUT = timeout(500); @@ -64,6 +65,8 @@ public class StartProgramListUpdatesFanoutTest extends ExtendedRadioMockitoTestC @Mock IBroadcastRadio mBroadcastRadioMock; @Mock ITunerSession mHalTunerSessionMock; private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks; + @Mock + private RadioServiceUserController mUserControllerMock; // RadioModule under test private RadioModule mRadioModule; @@ -110,17 +113,12 @@ public class StartProgramListUpdatesFanoutTest extends ExtendedRadioMockitoTestC private static final RadioManager.ProgramInfo TEST_DAB_INFO = TestUtils.makeProgramInfo( TEST_DAB_SELECTOR, TEST_QUALITY); - @Override - protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(RadioServiceUserController.class); - } - @Before public void setup() throws RemoteException { - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); - mRadioModule = new RadioModule(mBroadcastRadioMock, - TestUtils.makeDefaultModuleProperties()); + mRadioModule = new RadioModule(mBroadcastRadioMock, TestUtils.makeDefaultModuleProperties(), + mUserControllerMock); doAnswer((Answer) invocation -> { mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0]; diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java index 55aae9d3396a..c18a6e31748d 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java @@ -110,21 +110,23 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Mock ITunerSession mHalTunerSessionMock; private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks; + @Mock + private RadioServiceUserController mUserControllerMock; @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(RadioServiceUserController.class).spyStatic(Binder.class); + builder.spyStatic(Binder.class); } @Before public void setup() throws Exception { doReturn(USER_ID_1).when(mUserHandleMock).getIdentifier(); doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle()); - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); - doReturn(USER_ID_1).when(() -> RadioServiceUserController.getCurrentUser()); + doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); + doReturn(USER_ID_1).when(mUserControllerMock).getCurrentUser(); mRadioModule = new RadioModule(mBroadcastRadioMock, - TestUtils.makeDefaultModuleProperties()); + TestUtils.makeDefaultModuleProperties(), mUserControllerMock); doAnswer(invocation -> { mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0]; @@ -228,7 +230,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Test public void setConfiguration_forNonCurrentUser_doesNotInvokesCallback() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setConfiguration(FM_BAND_CONFIG); @@ -403,7 +405,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Test public void tune_forNonCurrentUser_doesNotTune() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); ProgramSelector initialSel = TestUtils.makeFmSelector(AM_FM_FREQUENCY_LIST[1]); RadioManager.ProgramInfo tuneInfo = TestUtils.makeProgramInfo(initialSel, SIGNAL_QUALITY); @@ -481,7 +483,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); mHalCurrentInfo = TestUtils.makeHalProgramInfo( Convert.programSelectorToHal(initialSel), SIGNAL_QUALITY); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].step(/* directionDown= */ true, /* skipSubChannel= */ false); @@ -559,7 +561,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); mHalCurrentInfo = TestUtils.makeHalProgramInfo( Convert.programSelectorToHal(initialSel), SIGNAL_QUALITY); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].seek(/* directionDown= */ true, /* skipSubChannel= */ false); @@ -593,7 +595,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Test public void cancel_forNonCurrentUser_doesNotCancel() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].cancel(); @@ -663,7 +665,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Test public void startBackgroundScan_forNonCurrentUser_doesNotInvokesCallback() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].startBackgroundScan(); @@ -676,7 +678,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(), /* includeCategories= */ true, /* excludeModifications= */ false); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].startProgramListUpdates(filter); @@ -715,7 +717,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { ProgramList.Filter aidlFilter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(), /* includeCategories= */ true, /* excludeModifications= */ false); mTunerSessions[0].startProgramListUpdates(aidlFilter); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].stopProgramListUpdates(); @@ -781,7 +783,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { public void setConfigFlag_forNonCurrentUser_doesNotSetConfigFlag() throws Exception { openAidlClients(/* numClients= */ 1); int flag = UNSUPPORTED_CONFIG_FLAG + 1; - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setConfigFlag(flag, /* value= */ true); @@ -846,7 +848,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); Map parametersSet = Map.of("mockParam1", "mockValue1", "mockParam2", "mockValue2"); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setParameters(parametersSet); @@ -900,7 +902,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { public void onCurrentProgramInfoChanged_withNonCurrentUser_doesNotInvokeCallback() throws Exception { openAidlClients(1); - doReturn(USER_ID_2).when(() -> RadioServiceUserController.getCurrentUser()); + doReturn(USER_ID_2).when(mUserControllerMock).getCurrentUser(); mHalTunerCallback.onCurrentProgramInfoChanged(TestUtils.makeHalProgramInfo( TestUtils.makeHalFmSelector(/* freq= */ 97300), SIGNAL_QUALITY)); diff --git a/services/core/java/com/android/server/broadcastradio/BroadcastRadioService.java b/services/core/java/com/android/server/broadcastradio/BroadcastRadioService.java index 028b9b0bcbc0..fcbcb0262c95 100644 --- a/services/core/java/com/android/server/broadcastradio/BroadcastRadioService.java +++ b/services/core/java/com/android/server/broadcastradio/BroadcastRadioService.java @@ -32,8 +32,9 @@ public final class BroadcastRadioService extends SystemService { public BroadcastRadioService(Context context) { super(context); ArrayList serviceNameList = IRadioServiceAidlImpl.getServicesNames(); - mServiceImpl = serviceNameList.isEmpty() ? new IRadioServiceHidlImpl(this) - : new IRadioServiceAidlImpl(this, serviceNameList); + RadioServiceUserController userController = new RadioServiceUserControllerImpl(); + mServiceImpl = serviceNameList.isEmpty() ? new IRadioServiceHidlImpl(this, userController) + : new IRadioServiceAidlImpl(this, serviceNameList, userController); } @Override diff --git a/services/core/java/com/android/server/broadcastradio/IRadioServiceAidlImpl.java b/services/core/java/com/android/server/broadcastradio/IRadioServiceAidlImpl.java index 16514fa813dc..332958d39a8c 100644 --- a/services/core/java/com/android/server/broadcastradio/IRadioServiceAidlImpl.java +++ b/services/core/java/com/android/server/broadcastradio/IRadioServiceAidlImpl.java @@ -69,8 +69,9 @@ final class IRadioServiceAidlImpl extends IRadioService.Stub { return serviceList; } - IRadioServiceAidlImpl(BroadcastRadioService service, ArrayList serviceList) { - this(service, new BroadcastRadioServiceImpl(serviceList)); + IRadioServiceAidlImpl(BroadcastRadioService service, List serviceList, + RadioServiceUserController userController) { + this(service, new BroadcastRadioServiceImpl(serviceList, userController)); Slogf.i(TAG, "Initialize BroadcastRadioServiceAidl(%s)", service); } diff --git a/services/core/java/com/android/server/broadcastradio/IRadioServiceHidlImpl.java b/services/core/java/com/android/server/broadcastradio/IRadioServiceHidlImpl.java index ab083429a200..67d3c95f3a23 100644 --- a/services/core/java/com/android/server/broadcastradio/IRadioServiceHidlImpl.java +++ b/services/core/java/com/android/server/broadcastradio/IRadioServiceHidlImpl.java @@ -59,13 +59,16 @@ final class IRadioServiceHidlImpl extends IRadioService.Stub { @GuardedBy("mLock") private final List mV1Modules; - IRadioServiceHidlImpl(BroadcastRadioService service) { + IRadioServiceHidlImpl(BroadcastRadioService service, + RadioServiceUserController userController) { mService = Objects.requireNonNull(service, "broadcast radio service cannot be null"); - mHal1Client = new com.android.server.broadcastradio.hal1.BroadcastRadioService(); + Objects.requireNonNull(userController, "user controller cannot be null"); + mHal1Client = new com.android.server.broadcastradio.hal1.BroadcastRadioService( + userController); mV1Modules = mHal1Client.loadModules(); OptionalInt max = mV1Modules.stream().mapToInt(RadioManager.ModuleProperties::getId).max(); mHal2Client = new com.android.server.broadcastradio.hal2.BroadcastRadioService( - max.isPresent() ? max.getAsInt() + 1 : 0); + max.isPresent() ? max.getAsInt() + 1 : 0, userController); } @VisibleForTesting diff --git a/services/core/java/com/android/server/broadcastradio/RadioServiceUserController.java b/services/core/java/com/android/server/broadcastradio/RadioServiceUserController.java index c705ebe686f2..2f8a2e623f95 100644 --- a/services/core/java/com/android/server/broadcastradio/RadioServiceUserController.java +++ b/services/core/java/com/android/server/broadcastradio/RadioServiceUserController.java @@ -16,19 +16,11 @@ package com.android.server.broadcastradio; -import android.app.ActivityManager; -import android.os.Binder; -import android.os.UserHandle; - /** - * Controller to handle users in {@link com.android.server.broadcastradio.BroadcastRadioService} + * Controller interface to handle users in + * {@link com.android.server.broadcastradio.BroadcastRadioService} */ -public final class RadioServiceUserController { - - private RadioServiceUserController() { - throw new UnsupportedOperationException( - "RadioServiceUserController class is noninstantiable"); - } +public interface RadioServiceUserController { /** * Check if the user calling the method in Broadcast Radio Service is the current user or the @@ -37,26 +29,12 @@ public final class RadioServiceUserController { * @return {@code true} if the user calling this method is the current user of system user, * {@code false} otherwise. */ - public static boolean isCurrentOrSystemUser() { - int callingUser = Binder.getCallingUserHandle().getIdentifier(); - return callingUser == getCurrentUser() || callingUser == UserHandle.USER_SYSTEM; - } + boolean isCurrentOrSystemUser(); /** * Get current foreground user for Broadcast Radio Service * * @return foreground user id. */ - public static int getCurrentUser() { - int userId = UserHandle.USER_NULL; - final long identity = Binder.clearCallingIdentity(); - try { - userId = ActivityManager.getCurrentUser(); - } catch (RuntimeException e) { - // Activity manager not running, nothing we can do assume user 0. - } finally { - Binder.restoreCallingIdentity(identity); - } - return userId; - } -} + int getCurrentUser(); +} \ No newline at end of file diff --git a/services/core/java/com/android/server/broadcastradio/RadioServiceUserControllerImpl.java b/services/core/java/com/android/server/broadcastradio/RadioServiceUserControllerImpl.java new file mode 100644 index 000000000000..740609f56d03 --- /dev/null +++ b/services/core/java/com/android/server/broadcastradio/RadioServiceUserControllerImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.broadcastradio; + +import android.app.ActivityManager; +import android.os.Binder; +import android.os.UserHandle; + +/** + * Implementation for the controller to handle users in + * {@link com.android.server.broadcastradio.BroadcastRadioService} + */ +public final class RadioServiceUserControllerImpl implements RadioServiceUserController { + + /** + * @see RadioServiceUserController#isCurrentOrSystemUser() + */ + @Override + public boolean isCurrentOrSystemUser() { + int callingUser = Binder.getCallingUserHandle().getIdentifier(); + return callingUser == getCurrentUser() || callingUser == UserHandle.USER_SYSTEM; + } + + /** + * @see RadioServiceUserController#getCurrentUser() + */ + @Override + public int getCurrentUser() { + int userId = UserHandle.USER_NULL; + final long identity = Binder.clearCallingIdentity(); + try { + userId = ActivityManager.getCurrentUser(); + } catch (RuntimeException e) { + // Activity manager not running, nothing we can do assume user 0. + } finally { + Binder.restoreCallingIdentity(identity); + } + return userId; + } +} diff --git a/services/core/java/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImpl.java b/services/core/java/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImpl.java index 7b504659c197..06024b57e45f 100644 --- a/services/core/java/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImpl.java +++ b/services/core/java/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImpl.java @@ -51,6 +51,7 @@ public final class BroadcastRadioServiceImpl { private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private final Object mLock = new Object(); + private final RadioServiceUserController mUserController; @GuardedBy("mLock") private int mNextModuleId; @@ -77,7 +78,7 @@ public final class BroadcastRadioServiceImpl { } RadioModule radioModule = - RadioModule.tryLoadingModule(moduleId, name, newBinder); + RadioModule.tryLoadingModule(moduleId, name, newBinder, mUserController); if (radioModule == null) { Slogf.w(TAG, "No module %s with id %d (HAL AIDL)", name, moduleId); return; @@ -141,9 +142,12 @@ public final class BroadcastRadioServiceImpl { * BroadcastRadio HAL services * * @param serviceNameList list of names of AIDL BroadcastRadio HAL services + * @param userController User controller implementation */ - public BroadcastRadioServiceImpl(ArrayList serviceNameList) { + public BroadcastRadioServiceImpl(List serviceNameList, + RadioServiceUserController userController) { mNextModuleId = 0; + mUserController = Objects.requireNonNull(userController, "User controller can not be null"); if (DEBUG) { Slogf.d(TAG, "Initializing BroadcastRadioServiceImpl %s", IBroadcastRadio.DESCRIPTOR); } @@ -202,7 +206,7 @@ public final class BroadcastRadioServiceImpl { if (DEBUG) { Slogf.d(TAG, "Open AIDL radio session"); } - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.e(TAG, "Cannot open tuner on AIDL HAL client for non-current user"); throw new IllegalStateException("Cannot open session for non-current user"); } diff --git a/services/core/java/com/android/server/broadcastradio/aidl/RadioModule.java b/services/core/java/com/android/server/broadcastradio/aidl/RadioModule.java index a176a3275ee9..20ee49e25dc2 100644 --- a/services/core/java/com/android/server/broadcastradio/aidl/RadioModule.java +++ b/services/core/java/com/android/server/broadcastradio/aidl/RadioModule.java @@ -62,6 +62,7 @@ final class RadioModule { private final Handler mHandler; private final RadioEventLogger mLogger; private final RadioManager.ModuleProperties mProperties; + private final RadioServiceUserController mUserController; /** * Tracks antenna state reported by HAL (if any). @@ -194,15 +195,18 @@ final class RadioModule { }; @VisibleForTesting - RadioModule(IBroadcastRadio service, RadioManager.ModuleProperties properties) { + RadioModule(IBroadcastRadio service, RadioManager.ModuleProperties properties, + RadioServiceUserController userController) { mProperties = Objects.requireNonNull(properties, "properties cannot be null"); mService = Objects.requireNonNull(service, "service cannot be null"); mHandler = new Handler(Looper.getMainLooper()); + mUserController = Objects.requireNonNull(userController, "User controller can not be null"); mLogger = new RadioEventLogger(TAG, RADIO_EVENT_LOGGER_QUEUE_SIZE); } @Nullable - static RadioModule tryLoadingModule(int moduleId, String moduleName, IBinder serviceBinder) { + static RadioModule tryLoadingModule(int moduleId, String moduleName, IBinder serviceBinder, + RadioServiceUserController userController) { try { Slogf.i(TAG, "Try loading module for module id = %d, module name = %s", moduleId, moduleName); @@ -232,7 +236,7 @@ final class RadioModule { RadioManager.ModuleProperties prop = ConversionUtils.propertiesFromHalProperties( moduleId, moduleName, service.getProperties(), amfmConfig, dabConfig); - return new RadioModule(service, prop); + return new RadioModule(service, prop, userController); } catch (RemoteException ex) { Slogf.e(TAG, ex, "Failed to load module %s", moduleName); return null; @@ -256,7 +260,7 @@ final class RadioModule { RadioManager.ProgramInfo currentProgramInfo; synchronized (mLock) { boolean isFirstTunerSession = mAidlTunerSessions.isEmpty(); - tunerSession = new TunerSession(this, mService, userCb); + tunerSession = new TunerSession(this, mService, userCb, mUserController); mAidlTunerSessions.add(tunerSession); antennaConnected = mAntennaConnected; currentProgramInfo = mCurrentProgramInfo; @@ -440,7 +444,7 @@ final class RadioModule { @GuardedBy("mLock") private void fanoutAidlCallbackLocked(AidlCallbackRunnable runnable) { - int currentUserId = RadioServiceUserController.getCurrentUser(); + int currentUserId = mUserController.getCurrentUser(); List deadSessions = null; for (int i = 0; i < mAidlTunerSessions.size(); i++) { if (mAidlTunerSessions.valueAt(i).mUserId != currentUserId diff --git a/services/core/java/com/android/server/broadcastradio/aidl/TunerSession.java b/services/core/java/com/android/server/broadcastradio/aidl/TunerSession.java index e90a1dda6cf5..0152c08ad5cc 100644 --- a/services/core/java/com/android/server/broadcastradio/aidl/TunerSession.java +++ b/services/core/java/com/android/server/broadcastradio/aidl/TunerSession.java @@ -52,6 +52,7 @@ final class TunerSession extends ITuner.Stub { final android.hardware.radio.ITunerCallback mCallback; private final int mUid; private final IBroadcastRadio mService; + private final RadioServiceUserController mUserController; @GuardedBy("mLock") private boolean mIsClosed; @@ -65,11 +66,13 @@ final class TunerSession extends ITuner.Stub { private RadioManager.BandConfig mPlaceHolderConfig; TunerSession(RadioModule radioModule, IBroadcastRadio service, - android.hardware.radio.ITunerCallback callback) { + android.hardware.radio.ITunerCallback callback, + RadioServiceUserController userController) { mModule = Objects.requireNonNull(radioModule, "radioModule cannot be null"); mService = Objects.requireNonNull(service, "service cannot be null"); mUserId = Binder.getCallingUserHandle().getIdentifier(); mCallback = Objects.requireNonNull(callback, "callback cannot be null"); + mUserController = Objects.requireNonNull(userController, "User controller can not be null"); mUid = Binder.getCallingUid(); mLogger = new RadioEventLogger(TAG, TUNER_EVENT_LOGGER_QUEUE_SIZE); } @@ -126,7 +129,7 @@ final class TunerSession extends ITuner.Stub { @Override public void setConfiguration(RadioManager.BandConfig config) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot set configuration for AIDL HAL client from non-current user"); return; } @@ -169,7 +172,7 @@ final class TunerSession extends ITuner.Stub { public void step(boolean directionDown, boolean skipSubChannel) throws RemoteException { mLogger.logRadioEvent("Step with direction %s, skipSubChannel? %s", directionDown ? "down" : "up", skipSubChannel ? "yes" : "no"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot step on AIDL HAL client from non-current user"); return; } @@ -187,7 +190,7 @@ final class TunerSession extends ITuner.Stub { public void seek(boolean directionDown, boolean skipSubChannel) throws RemoteException { mLogger.logRadioEvent("Seek with direction %s, skipSubChannel? %s", directionDown ? "down" : "up", skipSubChannel ? "yes" : "no"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot scan on AIDL HAL client from non-current user"); return; } @@ -204,7 +207,7 @@ final class TunerSession extends ITuner.Stub { @Override public void tune(ProgramSelector selector) throws RemoteException { mLogger.logRadioEvent("Tune with selector %s", selector); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot tune on AIDL HAL client from non-current user"); return; } @@ -226,7 +229,7 @@ final class TunerSession extends ITuner.Stub { @Override public void cancel() { Slogf.i(TAG, "Cancel"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot cancel on AIDL HAL client from non-current user"); return; } @@ -255,7 +258,7 @@ final class TunerSession extends ITuner.Stub { @Override public boolean startBackgroundScan() { Slogf.w(TAG, "Explicit background scan trigger is not supported with HAL AIDL"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot start background scan on AIDL HAL client from non-current user"); return false; } @@ -268,7 +271,7 @@ final class TunerSession extends ITuner.Stub { @Override public void startProgramListUpdates(ProgramList.Filter filter) throws RemoteException { mLogger.logRadioEvent("Start programList updates %s", filter); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot start program list updates on AIDL HAL client from non-current user"); return; @@ -344,7 +347,7 @@ final class TunerSession extends ITuner.Stub { @Override public void stopProgramListUpdates() throws RemoteException { mLogger.logRadioEvent("Stop programList updates"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot stop program list updates on AIDL HAL client from non-current user"); return; @@ -389,7 +392,7 @@ final class TunerSession extends ITuner.Stub { public void setConfigFlag(int flag, boolean value) throws RemoteException { mLogger.logRadioEvent("set ConfigFlag %s to %b ", ConfigFlag.$.toString(flag), value); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot set config flag for AIDL HAL client from non-current user"); return; } @@ -406,7 +409,7 @@ final class TunerSession extends ITuner.Stub { @Override public Map setParameters(Map parameters) { mLogger.logRadioEvent("Set parameters "); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot set parameters for AIDL HAL client from non-current user"); return new ArrayMap<>(); } diff --git a/services/core/java/com/android/server/broadcastradio/hal1/BroadcastRadioService.java b/services/core/java/com/android/server/broadcastradio/hal1/BroadcastRadioService.java index fb42c94b56f4..6a6a3ae44c8b 100644 --- a/services/core/java/com/android/server/broadcastradio/hal1/BroadcastRadioService.java +++ b/services/core/java/com/android/server/broadcastradio/hal1/BroadcastRadioService.java @@ -35,6 +35,7 @@ public class BroadcastRadioService { * This field is used by native code, do not access or modify. */ private final long mNativeContext = nativeInit(); + private final RadioServiceUserController mUserController; private final Object mLock = new Object(); @@ -50,6 +51,10 @@ public class BroadcastRadioService { private native Tuner nativeOpenTuner(long nativeContext, int moduleId, RadioManager.BandConfig config, boolean withAudio, ITunerCallback callback); + public BroadcastRadioService(RadioServiceUserController userController) { + mUserController = Objects.requireNonNull(userController, "User controller can not be null"); + } + public @NonNull List loadModules() { synchronized (mLock) { return Objects.requireNonNull(nativeLoadModules(mNativeContext)); @@ -58,7 +63,7 @@ public class BroadcastRadioService { public ITuner openTuner(int moduleId, RadioManager.BandConfig bandConfig, boolean withAudio, ITunerCallback callback) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.e(TAG, "Cannot open tuner on HAL 1.x client for non-current user"); throw new IllegalStateException("Cannot open tuner for non-current user"); } diff --git a/services/core/java/com/android/server/broadcastradio/hal1/Tuner.java b/services/core/java/com/android/server/broadcastradio/hal1/Tuner.java index 7cac4091c583..8e64600d2694 100644 --- a/services/core/java/com/android/server/broadcastradio/hal1/Tuner.java +++ b/services/core/java/com/android/server/broadcastradio/hal1/Tuner.java @@ -28,6 +28,7 @@ import android.os.IBinder; import android.os.RemoteException; import com.android.server.broadcastradio.RadioServiceUserController; +import com.android.server.broadcastradio.RadioServiceUserControllerImpl; import com.android.server.utils.Slogf; import java.util.List; @@ -51,6 +52,7 @@ class Tuner extends ITuner.Stub { private boolean mIsMuted = false; private int mRegion; private final boolean mWithAudio; + private final RadioServiceUserController mUserController = new RadioServiceUserControllerImpl(); Tuner(@NonNull ITunerCallback clientCallback, int halRev, int region, boolean withAudio, int band) { @@ -127,7 +129,7 @@ class Tuner extends ITuner.Stub { @Override public void setConfiguration(RadioManager.BandConfig config) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot set configuration for HAL 1.x client from non-current user"); return; } @@ -176,7 +178,7 @@ class Tuner extends ITuner.Stub { @Override public void step(boolean directionDown, boolean skipSubChannel) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot step on HAL 1.x client from non-current user"); return; } @@ -189,7 +191,7 @@ class Tuner extends ITuner.Stub { @Override public void seek(boolean directionDown, boolean skipSubChannel) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot seek on HAL 1.x client from non-current user"); return; } @@ -202,7 +204,7 @@ class Tuner extends ITuner.Stub { @Override public void tune(ProgramSelector selector) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot tune on HAL 1.x client from non-current user"); return; } @@ -219,7 +221,7 @@ class Tuner extends ITuner.Stub { @Override public void cancel() { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot cancel on HAL 1.x client from non-current user"); return; } @@ -231,7 +233,7 @@ class Tuner extends ITuner.Stub { @Override public void cancelAnnouncement() { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot cancel announcement on HAL 1.x client from non-current user"); return; } @@ -260,7 +262,7 @@ class Tuner extends ITuner.Stub { @Override public boolean startBackgroundScan() { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot start background scan on HAL 1.x client from non-current user"); return false; @@ -285,7 +287,7 @@ class Tuner extends ITuner.Stub { @Override public void startProgramListUpdates(ProgramList.Filter filter) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot start program list updates on HAL 1.x client from non-current user"); return; @@ -295,7 +297,7 @@ class Tuner extends ITuner.Stub { @Override public void stopProgramListUpdates() { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot stop program list updates on HAL 1.x client from non-current user"); return; @@ -321,7 +323,7 @@ class Tuner extends ITuner.Stub { @Override public void setConfigFlag(int flag, boolean value) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot set config flag for HAL 1.x client from non-current user"); return; } diff --git a/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java b/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java index a4efa2e330f8..3227afd82dbd 100644 --- a/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java +++ b/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java @@ -50,6 +50,8 @@ public final class BroadcastRadioService { private final Object mLock = new Object(); + private final RadioServiceUserController mUserController; + @GuardedBy("mLock") private int mNextModuleId; @@ -75,7 +77,8 @@ public final class BroadcastRadioService { moduleId = mNextModuleId; } - RadioModule radioModule = RadioModule.tryLoadingModule(moduleId, serviceName); + RadioModule radioModule = RadioModule.tryLoadingModule(moduleId, serviceName, + mUserController); if (radioModule == null) { return; } @@ -123,8 +126,9 @@ public final class BroadcastRadioService { } }; - public BroadcastRadioService(int nextModuleId) { + public BroadcastRadioService(int nextModuleId, RadioServiceUserController userController) { mNextModuleId = nextModuleId; + mUserController = Objects.requireNonNull(userController, "User controller can not be null"); try { IServiceManager manager = IServiceManager.getService(); if (manager == null) { @@ -138,8 +142,10 @@ public final class BroadcastRadioService { } @VisibleForTesting - BroadcastRadioService(int nextModuleId, IServiceManager manager) { + BroadcastRadioService(int nextModuleId, IServiceManager manager, + RadioServiceUserController userController) { mNextModuleId = nextModuleId; + mUserController = Objects.requireNonNull(userController, "User controller can not be null"); Objects.requireNonNull(manager, "Service manager cannot be null"); try { manager.registerForNotifications(IBroadcastRadio.kInterfaceName, "", mServiceListener); @@ -171,7 +177,7 @@ public final class BroadcastRadioService { public ITuner openSession(int moduleId, @Nullable RadioManager.BandConfig legacyConfig, boolean withAudio, @NonNull ITunerCallback callback) throws RemoteException { Slogf.v(TAG, "Open HIDL 2.0 session with module id " + moduleId); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.e(TAG, "Cannot open tuner on HAL 2.0 client for non-current user"); throw new IllegalStateException("Cannot open session for non-current user"); } diff --git a/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java b/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java index d3b244886a64..a0d6cc2c75b0 100644 --- a/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java +++ b/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java @@ -66,6 +66,7 @@ final class RadioModule { private final Object mLock = new Object(); private final Handler mHandler; private final RadioEventLogger mEventLogger; + private final RadioServiceUserController mUserController; @GuardedBy("mLock") private ITunerSession mHalTunerSession; @@ -148,16 +149,18 @@ final class RadioModule { private final Set mAidlTunerSessions = new ArraySet<>(); @VisibleForTesting - RadioModule(@NonNull IBroadcastRadio service, - @NonNull RadioManager.ModuleProperties properties) { + RadioModule(IBroadcastRadio service, RadioManager.ModuleProperties properties, + RadioServiceUserController userController) { mProperties = Objects.requireNonNull(properties); mService = Objects.requireNonNull(service); mHandler = new Handler(Looper.getMainLooper()); + mUserController = Objects.requireNonNull(userController, "User controller can not be null"); mEventLogger = new RadioEventLogger(TAG, RADIO_EVENT_LOGGER_QUEUE_SIZE); } @Nullable - static RadioModule tryLoadingModule(int idx, @NonNull String fqName) { + static RadioModule tryLoadingModule(int idx, String fqName, + RadioServiceUserController controller) { try { Slogf.i(TAG, "Try loading module for idx " + idx + ", fqName " + fqName); IBroadcastRadio service = IBroadcastRadio.getService(fqName); @@ -179,7 +182,7 @@ final class RadioModule { RadioManager.ModuleProperties prop = Convert.propertiesFromHal(idx, fqName, service.getProperties(), amfmConfig.value, dabConfig.value); - return new RadioModule(service, prop); + return new RadioModule(service, prop, controller); } catch (RemoteException ex) { Slogf.e(TAG, "Failed to load module " + fqName, ex); return null; @@ -208,7 +211,8 @@ final class RadioModule { }); mHalTunerSession = Objects.requireNonNull(hwSession.value); } - TunerSession tunerSession = new TunerSession(this, mHalTunerSession, userCb); + TunerSession tunerSession = new TunerSession(this, mHalTunerSession, userCb, + mUserController); mAidlTunerSessions.add(tunerSession); // Propagate state to new client. Note: These callbacks are invoked while holding mLock @@ -375,7 +379,7 @@ final class RadioModule { @GuardedBy("mLock") private void fanoutAidlCallbackLocked(AidlCallbackRunnable runnable) { - int currentUserId = RadioServiceUserController.getCurrentUser(); + int currentUserId = mUserController.getCurrentUser(); List deadSessions = null; for (TunerSession tunerSession : mAidlTunerSessions) { if (tunerSession.mUserId != currentUserId && tunerSession.mUserId diff --git a/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java b/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java index 80efacdb12ee..f7d7d2695f5b 100644 --- a/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java +++ b/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java @@ -16,7 +16,6 @@ package com.android.server.broadcastradio.hal2; -import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Bitmap; import android.hardware.broadcastradio.V2_0.ConfigFlag; @@ -55,6 +54,7 @@ final class TunerSession extends ITuner.Stub { private final ITunerSession mHwSession; final int mUserId; final android.hardware.radio.ITunerCallback mCallback; + private final RadioServiceUserController mUserController; @GuardedBy("mLock") private boolean mIsClosed = false; @@ -66,12 +66,14 @@ final class TunerSession extends ITuner.Stub { // necessary only for older APIs compatibility private RadioManager.BandConfig mDummyConfig = null; - TunerSession(@NonNull RadioModule module, @NonNull ITunerSession hwSession, - @NonNull android.hardware.radio.ITunerCallback callback) { + TunerSession(RadioModule module, ITunerSession hwSession, + android.hardware.radio.ITunerCallback callback, + RadioServiceUserController userController) { mModule = Objects.requireNonNull(module); mHwSession = Objects.requireNonNull(hwSession); mUserId = Binder.getCallingUserHandle().getIdentifier(); mCallback = Objects.requireNonNull(callback); + mUserController = Objects.requireNonNull(userController, "User controller can not be null"); mEventLogger = new RadioEventLogger(TAG, TUNER_EVENT_LOGGER_QUEUE_SIZE); } @@ -120,7 +122,7 @@ final class TunerSession extends ITuner.Stub { @Override public void setConfiguration(RadioManager.BandConfig config) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot set configuration for HAL 2.0 client from non-current user"); return; } @@ -162,7 +164,7 @@ final class TunerSession extends ITuner.Stub { public void step(boolean directionDown, boolean skipSubChannel) throws RemoteException { mEventLogger.logRadioEvent("Step with direction %s, skipSubChannel? %s", directionDown ? "down" : "up", skipSubChannel ? "yes" : "no"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot step on HAL 2.0 client from non-current user"); return; } @@ -177,7 +179,7 @@ final class TunerSession extends ITuner.Stub { public void seek(boolean directionDown, boolean skipSubChannel) throws RemoteException { mEventLogger.logRadioEvent("Seek with direction %s, skipSubChannel? %s", directionDown ? "down" : "up", skipSubChannel ? "yes" : "no"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot scan on HAL 2.0 client from non-current user"); return; } @@ -191,7 +193,7 @@ final class TunerSession extends ITuner.Stub { @Override public void tune(ProgramSelector selector) throws RemoteException { mEventLogger.logRadioEvent("Tune with selector %s", selector); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot tune on HAL 2.0 client from non-current user"); return; } @@ -205,7 +207,7 @@ final class TunerSession extends ITuner.Stub { @Override public void cancel() { Slogf.i(TAG, "Cancel"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot cancel on HAL 2.0 client from non-current user"); return; } @@ -230,7 +232,7 @@ final class TunerSession extends ITuner.Stub { @Override public boolean startBackgroundScan() { Slogf.w(TAG, "Explicit background scan trigger is not supported with HAL 2.0"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot start background scan on HAL 2.0 client from non-current user"); return false; @@ -242,7 +244,7 @@ final class TunerSession extends ITuner.Stub { @Override public void startProgramListUpdates(ProgramList.Filter filter) { mEventLogger.logRadioEvent("start programList updates %s", filter); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot start program list updates on HAL 2.0 client from non-current user"); return; @@ -306,7 +308,7 @@ final class TunerSession extends ITuner.Stub { @Override public void stopProgramListUpdates() throws RemoteException { mEventLogger.logRadioEvent("Stop programList updates"); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot stop program list updates on HAL 2.0 client from non-current user"); return; @@ -355,7 +357,7 @@ final class TunerSession extends ITuner.Stub { @Override public void setConfigFlag(int flag, boolean value) throws RemoteException { mEventLogger.logRadioEvent("Set ConfigFlag %s = %b", ConfigFlag.toString(flag), value); - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot set config flag for HAL 2.0 client from non-current user"); return; } @@ -368,7 +370,7 @@ final class TunerSession extends ITuner.Stub { @Override public Map setParameters(Map parameters) { - if (!RadioServiceUserController.isCurrentOrSystemUser()) { + if (!mUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot set parameters for HAL 2.0 client from non-current user"); return new ArrayMap<>(); } -- GitLab From 2545348f6036e6743d06b8e9c156b726bd0225b2 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Fri, 6 Sep 2024 16:17:18 -0700 Subject: [PATCH 160/492] Move binder to radio service user controller Bug: 363965571 Flag: EXEMPT refactor Test: atest BroadcastRadioTests Change-Id: I1315393a0a1bfa0b0c05f48b23f51b171e1b2ff0 --- .../RadioServiceUserControllerTest.java | 32 ++++++++++++------- .../broadcastradio/aidl/TunerSessionTest.java | 9 ++---- .../hal2/TunerSessionHidlTest.java | 16 ++-------- .../RadioServiceUserController.java | 8 +++++ .../RadioServiceUserControllerImpl.java | 10 +++++- .../broadcastradio/aidl/TunerSession.java | 2 +- .../broadcastradio/hal2/TunerSession.java | 3 +- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java index 9c9dfe8174f2..44beb55b77db 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java @@ -19,18 +19,18 @@ package com.android.server.broadcastradio; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doThrow; -import static com.google.common.truth.Truth.assertWithMessage; - import static org.mockito.Mockito.when; import android.app.ActivityManager; -import android.app.compat.CompatChanges; import android.os.Binder; import android.os.UserHandle; import com.android.dx.mockito.inline.extended.StaticMockitoSessionBuilder; +import com.google.common.truth.Expect; + import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.mockito.Mock; @@ -46,10 +46,12 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe @Mock private UserHandle mUserHandleMock; + @Rule + public final Expect expect = Expect.create(); + @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(ActivityManager.class).spyStatic(Binder.class) - .spyStatic(CompatChanges.class); + builder.spyStatic(ActivityManager.class).spyStatic(Binder.class); } @Before @@ -63,7 +65,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe public void isCurrentOrSystemUser_forCurrentUser_returnsFalse() { when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); - assertWithMessage("Current user") + expect.withMessage("Current user") .that(mUserController.isCurrentOrSystemUser()).isTrue(); } @@ -71,7 +73,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe public void isCurrentOrSystemUser_forNonCurrentUser_returnsFalse() { when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_2); - assertWithMessage("Non-current user") + expect.withMessage("Non-current user") .that(mUserController.isCurrentOrSystemUser()).isFalse(); } @@ -80,7 +82,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); when(mUserHandleMock.getIdentifier()).thenReturn(UserHandle.USER_SYSTEM); - assertWithMessage("System user") + expect.withMessage("System user") .that(mUserController.isCurrentOrSystemUser()).isTrue(); } @@ -89,13 +91,13 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser); - assertWithMessage("User when activity manager fails") + expect.withMessage("User when activity manager fails") .that(mUserController.isCurrentOrSystemUser()).isFalse(); } @Test public void getCurrentUser() { - assertWithMessage("Current user") + expect.withMessage("Current user") .that(mUserController.getCurrentUser()).isEqualTo(USER_ID_1); } @@ -104,7 +106,15 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser); - assertWithMessage("Current user when activity manager fails") + expect.withMessage("Current user when activity manager fails") .that(mUserController.getCurrentUser()).isEqualTo(UserHandle.USER_NULL); } + + @Test + public void getCallingUserId() { + when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); + + expect.withMessage("Calling user id") + .that(mUserController.getCallingUserId()).isEqualTo(USER_ID_1); + } } diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java index e0b97dc3cb2a..24d18e0893d0 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java @@ -49,12 +49,10 @@ import android.hardware.radio.ProgramSelector; import android.hardware.radio.RadioManager; import android.hardware.radio.RadioTuner; import android.hardware.radio.UniqueProgramIdentifier; -import android.os.Binder; import android.os.DeadObjectException; import android.os.ParcelableException; import android.os.RemoteException; import android.os.ServiceSpecificException; -import android.os.UserHandle; import android.platform.test.flag.junit.SetFlagsRule; import android.util.ArrayMap; import android.util.ArraySet; @@ -148,8 +146,6 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { // Mocks @Mock - private UserHandle mUserHandleMock; - @Mock private IBroadcastRadio mBroadcastRadioMock; private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks; @Mock @@ -172,7 +168,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(CompatChanges.class).spyStatic(Binder.class); + builder.spyStatic(CompatChanges.class); } @Before @@ -183,8 +179,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { doReturn(true).when(() -> CompatChanges.isChangeEnabled( eq(ConversionUtils.RADIO_U_VERSION_REQUIRED), anyInt())); - doReturn(USER_ID_1).when(mUserHandleMock).getIdentifier(); - doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle()); + doReturn(USER_ID_1).when(mUserControllerMock).getCallingUserId(); doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); doReturn(USER_ID_1).when(mUserControllerMock).getCurrentUser(); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java index c18a6e31748d..62445cf90028 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java @@ -44,16 +44,12 @@ import android.hardware.radio.ProgramList; import android.hardware.radio.ProgramSelector; import android.hardware.radio.RadioManager; import android.hardware.radio.RadioTuner; -import android.os.Binder; import android.os.DeadObjectException; import android.os.ParcelableException; import android.os.RemoteException; -import android.os.UserHandle; import android.util.ArrayMap; import android.util.ArraySet; -import com.android.dx.mockito.inline.extended.StaticMockitoSessionBuilder; -import com.android.server.broadcastradio.ExtendedRadioMockitoTestCase; import com.android.server.broadcastradio.RadioServiceUserController; import com.google.common.truth.Expect; @@ -76,7 +72,7 @@ import java.util.Map; * Tests for HIDL HAL TunerSession. */ @RunWith(MockitoJUnitRunner.class) -public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { +public final class TunerSessionHidlTest { private static final int USER_ID_1 = 11; private static final int USER_ID_2 = 12; @@ -103,8 +99,6 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Rule public final Expect mExpect = Expect.create(); - @Mock - private UserHandle mUserHandleMock; @Mock private IBroadcastRadio mBroadcastRadioMock; @Mock @@ -113,15 +107,9 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Mock private RadioServiceUserController mUserControllerMock; - @Override - protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(Binder.class); - } - @Before public void setup() throws Exception { - doReturn(USER_ID_1).when(mUserHandleMock).getIdentifier(); - doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle()); + doReturn(USER_ID_1).when(mUserControllerMock).getCallingUserId(); doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); doReturn(USER_ID_1).when(mUserControllerMock).getCurrentUser(); diff --git a/services/core/java/com/android/server/broadcastradio/RadioServiceUserController.java b/services/core/java/com/android/server/broadcastradio/RadioServiceUserController.java index 2f8a2e623f95..c15ccf193563 100644 --- a/services/core/java/com/android/server/broadcastradio/RadioServiceUserController.java +++ b/services/core/java/com/android/server/broadcastradio/RadioServiceUserController.java @@ -37,4 +37,12 @@ public interface RadioServiceUserController { * @return foreground user id. */ int getCurrentUser(); + + /** + * Get id of the user handle assigned to the process that sent the binder transaction that is + * being processed + * + * @return Id of the user handle + */ + int getCallingUserId(); } \ No newline at end of file diff --git a/services/core/java/com/android/server/broadcastradio/RadioServiceUserControllerImpl.java b/services/core/java/com/android/server/broadcastradio/RadioServiceUserControllerImpl.java index 740609f56d03..e305d208000c 100644 --- a/services/core/java/com/android/server/broadcastradio/RadioServiceUserControllerImpl.java +++ b/services/core/java/com/android/server/broadcastradio/RadioServiceUserControllerImpl.java @@ -31,7 +31,7 @@ public final class RadioServiceUserControllerImpl implements RadioServiceUserCon */ @Override public boolean isCurrentOrSystemUser() { - int callingUser = Binder.getCallingUserHandle().getIdentifier(); + int callingUser = getCallingUserId(); return callingUser == getCurrentUser() || callingUser == UserHandle.USER_SYSTEM; } @@ -51,4 +51,12 @@ public final class RadioServiceUserControllerImpl implements RadioServiceUserCon } return userId; } + + /** + * @see RadioServiceUserController#getCallingUserId() + */ + @Override + public int getCallingUserId() { + return Binder.getCallingUserHandle().getIdentifier(); + } } diff --git a/services/core/java/com/android/server/broadcastradio/aidl/TunerSession.java b/services/core/java/com/android/server/broadcastradio/aidl/TunerSession.java index 0152c08ad5cc..f22661b72da1 100644 --- a/services/core/java/com/android/server/broadcastradio/aidl/TunerSession.java +++ b/services/core/java/com/android/server/broadcastradio/aidl/TunerSession.java @@ -70,9 +70,9 @@ final class TunerSession extends ITuner.Stub { RadioServiceUserController userController) { mModule = Objects.requireNonNull(radioModule, "radioModule cannot be null"); mService = Objects.requireNonNull(service, "service cannot be null"); - mUserId = Binder.getCallingUserHandle().getIdentifier(); mCallback = Objects.requireNonNull(callback, "callback cannot be null"); mUserController = Objects.requireNonNull(userController, "User controller can not be null"); + mUserId = mUserController.getCallingUserId(); mUid = Binder.getCallingUid(); mLogger = new RadioEventLogger(TAG, TUNER_EVENT_LOGGER_QUEUE_SIZE); } diff --git a/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java b/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java index f7d7d2695f5b..dc164b1e6eff 100644 --- a/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java +++ b/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java @@ -26,7 +26,6 @@ import android.hardware.radio.ITuner; import android.hardware.radio.ProgramList; import android.hardware.radio.ProgramSelector; import android.hardware.radio.RadioManager; -import android.os.Binder; import android.os.RemoteException; import android.util.ArrayMap; import android.util.ArraySet; @@ -71,9 +70,9 @@ final class TunerSession extends ITuner.Stub { RadioServiceUserController userController) { mModule = Objects.requireNonNull(module); mHwSession = Objects.requireNonNull(hwSession); - mUserId = Binder.getCallingUserHandle().getIdentifier(); mCallback = Objects.requireNonNull(callback); mUserController = Objects.requireNonNull(userController, "User controller can not be null"); + mUserId = mUserController.getCallingUserId(); mEventLogger = new RadioEventLogger(TAG, TUNER_EVENT_LOGGER_QUEUE_SIZE); } -- GitLab From d1a4e7d2c11e45ce67a1f65383bd1d0bc9cb6bd3 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Wed, 4 Sep 2024 16:01:58 +0000 Subject: [PATCH 161/492] Fix PackageManager#getPackageArchiveInfo to cache derived fields After switching from old parser to PackageParser2, getPackageArchiveInfo doesn't call hideAsFinal(), which results in assignDerivedFields2() not called and app info flags not initalized. As a result, appinfo.flags is always 0. Fix it by calling hideAsFinal() to cache derived fields. Alternative fix is to call assignDerivedFields2() in hideAsParsed(), but I am not sure if that is what the API wants to do. Change-Id: I33c1d8446739d6982df1fbec29e65b1c6c33556d --- core/java/android/content/pm/PackageManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 65ab379b182b..bca30b4fec5a 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -8842,6 +8842,7 @@ public abstract class PackageManager { try { ParsedPackage pp = parser2.parsePackage(apkFile, parserFlags, false); + pp.hideAsFinal(); return PackageInfoCommonUtils.generate(pp, flagsBits, UserHandle.myUserId()); } catch (PackageParserException e) { -- GitLab From 3983f8beb40cdb5f59237544b4dcd1991939f09b Mon Sep 17 00:00:00 2001 From: Michael Wachenschwanz Date: Mon, 9 Sep 2024 17:18:46 -0700 Subject: [PATCH 162/492] Fix double modifyRawOomAdj in computeOomAdjLSP The modifyRawOomAdj will happen as a part of the setIntermediateAdjLSP step. Also remove duplicate of the BFGS schedgroup restriction logic. Flag: EXEMPTED bugfix Fixes: 360656013 Test: atest MockingOomAdjusterTests Change-Id: I8549ad06ee066e8d31db848595fc2b129cf8a1fb --- .../com/android/server/am/OomAdjuster.java | 19 -------- .../server/am/MockingOomAdjusterTests.java | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java index 3f54cfc03114..a5ab5343bccb 100644 --- a/services/core/java/com/android/server/am/OomAdjuster.java +++ b/services/core/java/com/android/server/am/OomAdjuster.java @@ -2532,25 +2532,6 @@ public class OomAdjuster { } } - state.setCurRawAdj(adj); - adj = psr.modifyRawOomAdj(adj); - if (adj > state.getMaxAdj()) { - adj = state.getMaxAdj(); - if (adj <= PERCEPTIBLE_LOW_APP_ADJ) { - schedGroup = SCHED_GROUP_DEFAULT; - } - } - - // Put bound foreground services in a special sched group for additional - // restrictions on screen off - if (procState >= PROCESS_STATE_BOUND_FOREGROUND_SERVICE - && mService.mWakefulness.get() != PowerManagerInternal.WAKEFULNESS_AWAKE - && !state.shouldScheduleLikeTopApp()) { - if (schedGroup > SCHED_GROUP_RESTRICTED) { - schedGroup = SCHED_GROUP_RESTRICTED; - } - } - // apply capability from FGS. if (psr.hasForegroundServices()) { capability |= capabilityFromFGS; diff --git a/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java b/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java index d9573559fa8d..776897bebf61 100644 --- a/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java +++ b/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java @@ -1180,6 +1180,25 @@ public class MockingOomAdjusterTests { assertBfsl(app); } + @SuppressWarnings("GuardedBy") + @Test + public void testUpdateOomAdj_DoOne_BoundFgService_Sleeping() { + ProcessRecord app = spy(makeDefaultProcessRecord(MOCKAPP_PID, MOCKAPP_UID, + MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false)); + ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID, + MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false)); + bindService(app, client, null, null, Context.BIND_FOREGROUND_SERVICE, mock(IBinder.class)); + client.mState.setMaxAdj(PERSISTENT_PROC_ADJ); + mService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_ASLEEP); + updateOomAdj(client, app); + mService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE); + + assertProcStates(app, PROCESS_STATE_BOUND_FOREGROUND_SERVICE, VISIBLE_APP_ADJ, + SCHED_GROUP_RESTRICTED); + assertProcStates(client, PROCESS_STATE_PERSISTENT, PERSISTENT_PROC_ADJ, + SCHED_GROUP_DEFAULT); + } + @SuppressWarnings("GuardedBy") @Test public void testUpdateOomAdj_DoOne_Service_BoundNotForeground() { @@ -2764,6 +2783,30 @@ public class MockingOomAdjusterTests { "started-services", false); } + @SuppressWarnings("GuardedBy") + @Test + public void testUpdateOomAdj_DoOne_AboveClient() { + ProcessRecord app = spy(makeDefaultProcessRecord(MOCKAPP_PID, MOCKAPP_UID, + MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, true)); + ProcessRecord service = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID, + MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, true)); + doReturn(PROCESS_STATE_TOP).when(mService.mAtmInternal).getTopProcessState(); + doReturn(app).when(mService).getTopApp(); + mService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE); + updateOomAdj(app); + + assertEquals(FOREGROUND_APP_ADJ, app.mState.getSetAdj()); + + // Simulate binding to a service in the same process using BIND_ABOVE_CLIENT and + // verify that its OOM adjustment level is unaffected. + bindService(service, app, null, null, Context.BIND_ABOVE_CLIENT, mock(IBinder.class)); + app.mServices.updateHasAboveClientLocked(); + assertTrue(app.mServices.hasAboveClient()); + + updateOomAdj(app); + assertEquals(VISIBLE_APP_ADJ, app.mState.getSetAdj()); + } + @SuppressWarnings("GuardedBy") @Test public void testUpdateOomAdj_DoOne_AboveClient_SameProcess() { -- GitLab From fe993f7d33e975a490e4dc9e4cd728944cd2d97c Mon Sep 17 00:00:00 2001 From: Chandru S Date: Tue, 10 Sep 2024 01:39:20 +0000 Subject: [PATCH 163/492] Fix issue with PIN output content not center aligned as expected. Before this all the dots were left aligned. Fixes: 365648186 Test: turn on flexiglass 1. Set PIN bouncer 2. Enter pin digits and see the dots are horizontally centered 3. disable flexiglass and enable compose_bouncer and verify the same Flag: com.android.systemui.scene_container Flag: com.android.systemui.compose_bouncer Change-Id: Ib9cde15b0f2d3adc670360029648c6b6bcd1ff8b --- .../systemui/bouncer/ui/composable/PinInputDisplay.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinInputDisplay.kt b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinInputDisplay.kt index ba885f7da2cf..1f98cd8e07c0 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinInputDisplay.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinInputDisplay.kt @@ -65,7 +65,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.Constraints import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import androidx.compose.ui.window.Dialog import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.compose.PlatformOutlinedButton import com.android.compose.animation.Easings @@ -355,7 +354,10 @@ private class PinInputRow( fun Content(modifier: Modifier) { // Wrap PIN entry in a Box so it is visible to accessibility (even if empty). - Box(modifier = modifier.fillMaxWidth().wrapContentHeight()) { + Box( + modifier = modifier.fillMaxWidth().wrapContentHeight(), + contentAlignment = Alignment.Center, + ) { Row( modifier .heightIn(min = shapeAnimations.shapeSize) -- GitLab From 2af98404abd5856af364fc3d033a351b8d74ca8d Mon Sep 17 00:00:00 2001 From: Willie Koomson Date: Tue, 10 Sep 2024 01:48:42 +0000 Subject: [PATCH 164/492] Write RemoteViews actions to proto (1/3) This change adds support for writing the following RemoteViews actions to proto: AttributeReflectionAction BitmapReflectionAction ComplexUnitDimensionReflectionAction LayoutParamAction NightModeReflectionAction ReflectionAction RemoveFromParentAction Test: RemoteViewsProto test Bug: 308041327 Flag: android.appwidget.flags.remote_views_proto Change-Id: I3b191abdb518123c3f5d2c0ed5be1672c4fd21cd --- core/java/android/widget/RemoteViews.java | 873 +++++++++++++++++- core/proto/android/widget/remoteviews.proto | 86 ++ .../android/widget/RemoteViewsProtoTest.java | 155 ---- 3 files changed, 955 insertions(+), 159 deletions(-) delete mode 100644 core/tests/coretests/src/android/widget/RemoteViewsProtoTest.java diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index a395c1a05744..89ea85200cd6 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -153,6 +153,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; +import java.util.function.Function; import java.util.function.Predicate; /** @@ -712,6 +713,24 @@ public class RemoteViews implements Parcelable, Filter { } public abstract void writeToParcel(Parcel dest, int flags); + + /** + * Override to return true if this Action can be serialized to Protobuf, and implement + * writeToProto / createFromProto. + * + * If this returns false, then the action will be omitted from RemoteViews previews created + * with createPreviewFromProto / writePreviewToProto. + * + * Because Parcelables should not be serialized to disk, any action that contains an Intent, + * PendingIntent, or Bundle should return false here. + */ + public boolean canWriteToProto() { + return false; + } + + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + throw new UnsupportedOperationException(); + } } /** @@ -1506,6 +1525,7 @@ public class RemoteViews implements Parcelable, Filter { switch (in.getFieldNumber()) { case (int) RemoteViewsProto.RemoteCollectionCache.ENTRIES: final LongSparseArray entry = new LongSparseArray<>(); + final long entryToken = in.start( RemoteViewsProto.RemoteCollectionCache.ENTRIES); while (in.nextField() != NO_MORE_FIELDS) { @@ -1533,10 +1553,12 @@ public class RemoteViews implements Parcelable, Filter { } } in.end(entryToken); + checkContainsKeys(entry, new long[]{RemoteViewsProto.RemoteCollectionCache.Entry.ID, RemoteViewsProto.RemoteCollectionCache.Entry.URI, RemoteViewsProto.RemoteCollectionCache.Entry.ITEMS}); + entries.add(entry); break; default: @@ -2247,6 +2269,62 @@ public class RemoteViews implements Parcelable, Filter { public int getActionTag() { return BITMAP_REFLECTION_ACTION_TAG; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.BITMAP_REFLECTION_ACTION); + out.write(RemoteViewsProto.BitmapReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.BitmapReflectionAction.METHOD_NAME, mMethodName); + out.write(RemoteViewsProto.BitmapReflectionAction.BITMAP_ID, mBitmapId); + out.end(token); + } + } + + private PendingResources createFromBitmapReflectionActionFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.BITMAP_REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.BitmapReflectionAction.VIEW_ID: + values.put(RemoteViewsProto.BitmapReflectionAction.VIEW_ID, + in.readString(RemoteViewsProto.BitmapReflectionAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.BitmapReflectionAction.METHOD_NAME: + values.put(RemoteViewsProto.BitmapReflectionAction.METHOD_NAME, + in.readString(RemoteViewsProto.BitmapReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.BitmapReflectionAction.BITMAP_ID: + values.put(RemoteViewsProto.BitmapReflectionAction.BITMAP_ID, + in.readInt(RemoteViewsProto.BitmapReflectionAction.BITMAP_ID)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.BitmapReflectionAction.VIEW_ID, + RemoteViewsProto.BitmapReflectionAction.METHOD_NAME}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.BitmapReflectionAction.VIEW_ID); + return new BitmapReflectionAction(viewId, + (String) values.get(RemoteViewsProto.BitmapReflectionAction.METHOD_NAME), + rootData.mBitmapCache.getBitmapForId( + (int) values.get(RemoteViewsProto.BitmapReflectionAction.BITMAP_ID, + 0))); + }; + } /** @@ -2560,6 +2638,268 @@ public class RemoteViews implements Parcelable, Filter { public int getActionTag() { return REFLECTION_ACTION_TAG; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.REFLECTION_ACTION); + out.write(RemoteViewsProto.ReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.ReflectionAction.METHOD_NAME, mMethodName); + out.write(RemoteViewsProto.ReflectionAction.PARAMETER_TYPE, mType); + if (this.mValue != null) { + switch (this.mType) { + case BOOLEAN: + // ProtoOutputStream will omit this write if the value is false + out.write(RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE, + (boolean) this.mValue); + break; + case BYTE: + out.write(RemoteViewsProto.ReflectionAction.BYTE_VALUE, + new byte[]{(byte) this.mValue}); + break; + case SHORT: + out.write(RemoteViewsProto.ReflectionAction.SHORT_VALUE, + (short) this.mValue); + break; + case INT: + out.write(RemoteViewsProto.ReflectionAction.INT_VALUE, (int) this.mValue); + break; + case LONG: + out.write(RemoteViewsProto.ReflectionAction.LONG_VALUE, (long) this.mValue); + break; + case FLOAT: + out.write(RemoteViewsProto.ReflectionAction.FLOAT_VALUE, + (float) this.mValue); + break; + case DOUBLE: + out.write(RemoteViewsProto.ReflectionAction.DOUBLE_VALUE, + (double) this.mValue); + break; + case CHAR: + out.write(RemoteViewsProto.ReflectionAction.CHAR_VALUE, + (Character) this.mValue); + break; + case STRING: + out.write(RemoteViewsProto.ReflectionAction.STRING_VALUE, + (String) this.mValue); + break; + case CHAR_SEQUENCE: + long csToken = out.start( + RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE); + RemoteViewsSerializers.writeCharSequenceToProto(out, + (CharSequence) this.mValue); + out.end(csToken); + break; + case URI: + out.write(RemoteViewsProto.ReflectionAction.URI_VALUE, + ((Uri) this.mValue).toString()); + break; + case BITMAP: + final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + ((Bitmap) this.mValue).compress(Bitmap.CompressFormat.WEBP_LOSSLESS, 100, + bytes); + out.write(RemoteViewsProto.ReflectionAction.BITMAP_VALUE, + bytes.toByteArray()); + break; + case BLEND_MODE: + out.write(RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE, + BlendMode.toValue((BlendMode) this.mValue)); + break; + case COLOR_STATE_LIST: + writeColorStateListToProto(out, (ColorStateList) this.mValue, + RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE); + break; + case ICON: + writeIconToProto(out, appResources, (Icon) this.mValue, + RemoteViewsProto.ReflectionAction.ICON_VALUE); + break; + case BUNDLE: + case INTENT: + default: + break; + } + } + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.ReflectionAction.VIEW_ID: + values.put(RemoteViewsProto.ReflectionAction.VIEW_ID, + in.readString(RemoteViewsProto.ReflectionAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.ReflectionAction.METHOD_NAME: + values.put(RemoteViewsProto.ReflectionAction.METHOD_NAME, + in.readString(RemoteViewsProto.ReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.ReflectionAction.PARAMETER_TYPE: + values.put(RemoteViewsProto.ReflectionAction.PARAMETER_TYPE, + in.readInt(RemoteViewsProto.ReflectionAction.PARAMETER_TYPE)); + break; + case (int) RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE: + values.put(RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE, + in.readBoolean(RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.BYTE_VALUE: + values.put(RemoteViewsProto.ReflectionAction.BYTE_VALUE, + in.readBytes(RemoteViewsProto.ReflectionAction.BYTE_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.SHORT_VALUE: + values.put(RemoteViewsProto.ReflectionAction.SHORT_VALUE, + (short) in.readInt(RemoteViewsProto.ReflectionAction.SHORT_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.INT_VALUE: + values.put(RemoteViewsProto.ReflectionAction.INT_VALUE, + in.readInt(RemoteViewsProto.ReflectionAction.INT_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.LONG_VALUE: + values.put(RemoteViewsProto.ReflectionAction.LONG_VALUE, + in.readLong(RemoteViewsProto.ReflectionAction.LONG_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.FLOAT_VALUE: + values.put(RemoteViewsProto.ReflectionAction.FLOAT_VALUE, + in.readFloat(RemoteViewsProto.ReflectionAction.FLOAT_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.DOUBLE_VALUE: + values.put(RemoteViewsProto.ReflectionAction.DOUBLE_VALUE, + in.readDouble(RemoteViewsProto.ReflectionAction.DOUBLE_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.CHAR_VALUE: + values.put(RemoteViewsProto.ReflectionAction.CHAR_VALUE, + (char) in.readInt(RemoteViewsProto.ReflectionAction.CHAR_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.STRING_VALUE: + values.put(RemoteViewsProto.ReflectionAction.STRING_VALUE, + in.readString(RemoteViewsProto.ReflectionAction.STRING_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE: + values.put(RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE, + createCharSequenceFromProto(in, + RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.URI_VALUE: + values.put(RemoteViewsProto.ReflectionAction.URI_VALUE, + in.readString(RemoteViewsProto.ReflectionAction.URI_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.BITMAP_VALUE: + byte[] bitmapData = in.readBytes( + RemoteViewsProto.ReflectionAction.BITMAP_VALUE); + values.put(RemoteViewsProto.ReflectionAction.BITMAP_VALUE, + BitmapFactory.decodeByteArray(bitmapData, 0, bitmapData.length)); + break; + case (int) RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE: + values.put(RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE, + createColorStateListFromProto(in, + RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.ICON_VALUE: + values.put(RemoteViewsProto.ReflectionAction.ICON_VALUE, + createIconFromProto(in, + RemoteViewsProto.ReflectionAction.ICON_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE: + values.put(RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE, + BlendMode.fromValue(in.readInt( + RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE))); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.ReflectionAction.VIEW_ID, + RemoteViewsProto.ReflectionAction.METHOD_NAME, + RemoteViewsProto.ReflectionAction.PARAMETER_TYPE}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.ReflectionAction.VIEW_ID); + Object value = null; + int parameterType = (int) values.get( + RemoteViewsProto.ReflectionAction.PARAMETER_TYPE); + switch (parameterType) { + case BOOLEAN: + value = (boolean) values.get( + RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE, false); + break; + case BYTE: + byte[] bytes = (byte[]) values.get( + RemoteViewsProto.ReflectionAction.BYTE_VALUE); + if (bytes != null && bytes.length > 0) { + value = bytes[0]; + } + break; + case SHORT: + value = (short) values.get(RemoteViewsProto.ReflectionAction.SHORT_VALUE, + 0); + break; + case INT: + value = (int) values.get(RemoteViewsProto.ReflectionAction.INT_VALUE, 0); + break; + case LONG: + value = (long) values.get(RemoteViewsProto.ReflectionAction.LONG_VALUE, 0); + break; + case FLOAT: + value = (float) values.get(RemoteViewsProto.ReflectionAction.FLOAT_VALUE, + 0); + break; + case DOUBLE: + value = (double) values.get(RemoteViewsProto.ReflectionAction.DOUBLE_VALUE, + 0); + break; + case CHAR: + value = (char) values.get(RemoteViewsProto.ReflectionAction.CHAR_VALUE, 0); + break; + case STRING: + value = (String) values.get(RemoteViewsProto.ReflectionAction.STRING_VALUE); + break; + case CHAR_SEQUENCE: + value = (CharSequence) values.get( + RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE); + break; + case URI: + value = Uri.parse( + (String) values.get(RemoteViewsProto.ReflectionAction.URI_VALUE)); + break; + case BITMAP: + value = (Bitmap) values.get(RemoteViewsProto.ReflectionAction.BITMAP_VALUE); + break; + case BLEND_MODE: + value = (BlendMode) values.get( + RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE); + break; + case COLOR_STATE_LIST: + value = (ColorStateList) values.get( + RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE); + break; + case ICON: + value = ((PendingResources) values.get( + RemoteViewsProto.ReflectionAction.ICON_VALUE)).create(context, + resources, rootData, depth); + break; + case BUNDLE: + case INTENT: + default: + // omit the action for unsupported parameter types + return null; + } + return new ReflectionAction(viewId, + (String) values.get(RemoteViewsProto.ReflectionAction.METHOD_NAME), + parameterType, value); + }; + } } private static final class ResourceReflectionAction extends BaseReflectionAction { @@ -2740,7 +3080,87 @@ public class RemoteViews implements Parcelable, Filter { public int getActionTag() { return ATTRIBUTE_REFLECTION_ACTION_TAG; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.ATTRIBUTE_REFLECTION_ACTION); + out.write(RemoteViewsProto.AttributeReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.AttributeReflectionAction.METHOD_NAME, mMethodName); + out.write(RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE, mType); + out.write(RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE, mResourceType); + if (mAttrId != 0) { + out.write(RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID, + appResources.getResourceName(mAttrId)); + } + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.ATTRIBUTE_REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.AttributeReflectionAction.VIEW_ID: { + values.put(RemoteViewsProto.AttributeReflectionAction.VIEW_ID, + in.readString(RemoteViewsProto.AttributeReflectionAction.VIEW_ID)); + break; + } + case (int) RemoteViewsProto.AttributeReflectionAction.METHOD_NAME: + values.put(RemoteViewsProto.AttributeReflectionAction.METHOD_NAME, + in.readString( + RemoteViewsProto.AttributeReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID: + values.put(RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID, + in.readString( + RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID)); + break; + case (int) RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE: + values.put(RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE, + in.readInt( + RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE)); + break; + case (int) RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE: + values.put(RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE, + in.readInt( + RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.AttributeReflectionAction.VIEW_ID, + RemoteViewsProto.AttributeReflectionAction.METHOD_NAME, + RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE, + RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.AttributeReflectionAction.VIEW_ID); + int attributeId = (values.indexOfKey( + RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID) >= 0) + ? getAsIdentifier(resources, values, + RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID) : 0; + return new AttributeReflectionAction(viewId, + (String) values.get(RemoteViewsProto.AttributeReflectionAction.METHOD_NAME), + (int) values.get(RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE), + (int) values.get(RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE), + attributeId); + }; + } } + private static final class ComplexUnitDimensionReflectionAction extends BaseReflectionAction { private final float mValue; @ComplexDimensionUnit @@ -2794,6 +3214,101 @@ public class RemoteViews implements Parcelable, Filter { public int getActionTag() { return COMPLEX_UNIT_DIMENSION_REFLECTION_ACTION_TAG; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start( + RemoteViewsProto.Action.COMPLEX_UNIT_DIMENSION_REFLECTION_ACTION); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME, + mMethodName); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.PARAMETER_TYPE, mType); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.DIMENSION_VALUE, + mValue); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.UNIT, mUnit); + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start( + RemoteViewsProto.Action.COMPLEX_UNIT_DIMENSION_REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID: + values.put(RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID, + in.readString( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME: + values.put( + RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME, + in.readString( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.ComplexUnitDimensionReflectionAction.PARAMETER_TYPE: + values.put( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.PARAMETER_TYPE, + in.readInt( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction + .PARAMETER_TYPE)); + break; + case (int) RemoteViewsProto + .ComplexUnitDimensionReflectionAction.DIMENSION_VALUE: + values.put( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.DIMENSION_VALUE, + in.readFloat( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction + .DIMENSION_VALUE)); + break; + case (int) RemoteViewsProto.ComplexUnitDimensionReflectionAction.UNIT: + values.put(RemoteViewsProto.ComplexUnitDimensionReflectionAction.UNIT, + in.readInt( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.UNIT)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, + new long[]{RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID, + RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME, + RemoteViewsProto.ComplexUnitDimensionReflectionAction.PARAMETER_TYPE}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID); + return new ComplexUnitDimensionReflectionAction(viewId, (String) values.get( + RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME), + (int) values.get( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.PARAMETER_TYPE), + (float) values.get( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.DIMENSION_VALUE, + 0), + (int) values.get(RemoteViewsProto.ComplexUnitDimensionReflectionAction.UNIT, + 0)); + }; + } } private static final class NightModeReflectionAction extends BaseReflectionAction { @@ -2868,6 +3383,145 @@ public class RemoteViews implements Parcelable, Filter { visitIconUri((Icon) mLightValue, visitor); } } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.NIGHT_MODE_REFLECTION_ACTION); + out.write(RemoteViewsProto.NightModeReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.NightModeReflectionAction.METHOD_NAME, mMethodName); + out.write(RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE, mType); + switch (this.mType) { + case ICON: + writeIconToProto(out, appResources, (Icon) mLightValue, + RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON); + writeIconToProto(out, appResources, (Icon) mDarkValue, + RemoteViewsProto.NightModeReflectionAction.DARK_ICON); + break; + case COLOR_STATE_LIST: + writeColorStateListToProto(out, (ColorStateList) mLightValue, + RemoteViewsProto.NightModeReflectionAction.LIGHT_COLOR_STATE_LIST); + writeColorStateListToProto(out, (ColorStateList) mDarkValue, + RemoteViewsProto.NightModeReflectionAction.DARK_COLOR_STATE_LIST); + break; + case INT: + out.write(RemoteViewsProto.NightModeReflectionAction.LIGHT_INT, + (int) mLightValue); + out.write(RemoteViewsProto.NightModeReflectionAction.DARK_INT, + (int) mDarkValue); + break; + } + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.NIGHT_MODE_REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.NightModeReflectionAction.VIEW_ID: + values.put(RemoteViewsProto.NightModeReflectionAction.VIEW_ID, + in.readString(RemoteViewsProto.NightModeReflectionAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.METHOD_NAME: + values.put(RemoteViewsProto.NightModeReflectionAction.METHOD_NAME, + in.readString( + RemoteViewsProto.NightModeReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE: + values.put(RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE, + in.readInt( + RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON: + values.put(RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON, + createIconFromProto(in, + RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.LIGHT_COLOR_STATE_LIST: + values.put( + RemoteViewsProto.NightModeReflectionAction.LIGHT_COLOR_STATE_LIST, + createColorStateListFromProto(in, + RemoteViewsProto + .NightModeReflectionAction.LIGHT_COLOR_STATE_LIST)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.LIGHT_INT: + values.put(RemoteViewsProto.NightModeReflectionAction.LIGHT_INT, + in.readInt(RemoteViewsProto.NightModeReflectionAction.LIGHT_INT)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.DARK_ICON: + values.put(RemoteViewsProto.NightModeReflectionAction.DARK_ICON, + createIconFromProto(in, + RemoteViewsProto.NightModeReflectionAction.DARK_ICON)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.DARK_COLOR_STATE_LIST: + values.put(RemoteViewsProto.NightModeReflectionAction.DARK_COLOR_STATE_LIST, + createColorStateListFromProto(in, + RemoteViewsProto + .NightModeReflectionAction.DARK_COLOR_STATE_LIST)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.DARK_INT: + values.put(RemoteViewsProto.NightModeReflectionAction.DARK_INT, + in.readInt(RemoteViewsProto.NightModeReflectionAction.DARK_INT)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.NightModeReflectionAction.VIEW_ID, + RemoteViewsProto.NightModeReflectionAction.METHOD_NAME, + RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.NightModeReflectionAction.VIEW_ID); + String methodName = (String) values.get( + RemoteViewsProto.NightModeReflectionAction.METHOD_NAME); + int parameterType = (int) values.get( + RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE); + switch (parameterType) { + case ICON: + PendingResources pendingLightIcon = + (PendingResources) values.get( + RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON); + PendingResources pendingDarkIcon = + (PendingResources) values.get( + RemoteViewsProto.NightModeReflectionAction.DARK_ICON); + Icon lightIcon = pendingLightIcon != null ? pendingLightIcon.create(context, + resources, rootData, depth) : null; + Icon darkIcon = pendingDarkIcon != null ? pendingDarkIcon.create(context, + resources, rootData, depth) : null; + return new NightModeReflectionAction(viewId, methodName, parameterType, + lightIcon, darkIcon); + case COLOR_STATE_LIST: + return new NightModeReflectionAction(viewId, methodName, parameterType, + (ColorStateList) values.get( + RemoteViewsProto + .NightModeReflectionAction.LIGHT_COLOR_STATE_LIST), + (ColorStateList) values.get( + RemoteViewsProto + .NightModeReflectionAction.DARK_COLOR_STATE_LIST)); + case INT: + return new NightModeReflectionAction(viewId, methodName, parameterType, + (int) values.get( + RemoteViewsProto.NightModeReflectionAction.LIGHT_INT, 0), + (int) values.get( + RemoteViewsProto.NightModeReflectionAction.DARK_INT, 0)); + default: + throw new RuntimeException("Unknown parameterType: " + parameterType); + } + }; + } } /** @@ -3353,6 +4007,46 @@ public class RemoteViews implements Parcelable, Filter { public int mergeBehavior() { return MERGE_APPEND; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.REMOVE_FROM_PARENT_ACTION); + out.write(RemoteViewsProto.RemoveFromParentAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.REMOVE_FROM_PARENT_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.RemoveFromParentAction.VIEW_ID: + values.put(RemoteViewsProto.RemoveFromParentAction.VIEW_ID, + in.readString(RemoteViewsProto.RemoveFromParentAction.VIEW_ID)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.RemoveFromParentAction.VIEW_ID}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.RemoveFromParentAction.VIEW_ID); + return new RemoveFromParentAction(viewId); + }; + } } /** @@ -3768,6 +4462,64 @@ public class RemoteViews implements Parcelable, Filter { public String getUniqueKey() { return super.getUniqueKey() + mProperty; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.LAYOUT_PARAM_ACTION); + out.write(RemoteViewsProto.LayoutParamAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.LayoutParamAction.PROPERTY, mProperty); + out.write(RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE, mValue); + out.write(RemoteViewsProto.LayoutParamAction.VALUE_TYPE, mValueType); + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.LAYOUT_PARAM_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.LayoutParamAction.VIEW_ID: + values.put(RemoteViewsProto.LayoutParamAction.VIEW_ID, + in.readString(RemoteViewsProto.LayoutParamAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.LayoutParamAction.PROPERTY: + values.put(RemoteViewsProto.LayoutParamAction.PROPERTY, + in.readInt(RemoteViewsProto.LayoutParamAction.PROPERTY)); + break; + case (int) RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE: + values.put(RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE, + in.readInt(RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE)); + break; + case (int) RemoteViewsProto.LayoutParamAction.VALUE_TYPE: + values.put(RemoteViewsProto.LayoutParamAction.VALUE_TYPE, + in.readInt(RemoteViewsProto.LayoutParamAction.VALUE_TYPE)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.LayoutParamAction.VIEW_ID}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.LayoutParamAction.VIEW_ID); + return new LayoutParamAction(viewId, + (int) values.get(RemoteViewsProto.LayoutParamAction.PROPERTY, 0), + (int) values.get(RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE, 0), + (int) values.get(RemoteViewsProto.LayoutParamAction.VALUE_TYPE, 0)); + }; + } } /** @@ -7668,6 +8420,7 @@ public class RemoteViews implements Parcelable, Filter { values.put(RemoteViewsProto.RemoteCollectionItems.IDS, new ArrayList()); values.put(RemoteViewsProto.RemoteCollectionItems.VIEWS, new ArrayList>()); + while (in.nextField() != NO_MORE_FIELDS) { switch (in.getFieldNumber()) { case (int) RemoteViewsProto.RemoteCollectionItems.IDS: @@ -7704,6 +8457,7 @@ public class RemoteViews implements Parcelable, Filter { checkContainsKeys(values, new long[]{RemoteViewsProto.RemoteCollectionItems.VIEW_TYPE_COUNT}); + return (context, resources, rootData, depth) -> { List idList = (List) values.get( RemoteViewsProto.RemoteCollectionItems.IDS); @@ -8149,6 +8903,16 @@ public class RemoteViews implements Parcelable, Filter { out.write(SizeFProto.HEIGHT, mIdealSize.getHeight()); out.end(token); } + + if (mActions != null) { + for (Action action : mActions) { + if (action.canWriteToProto()) { + final long token = out.start(RemoteViewsProto.ACTIONS); + action.writeToProto(out, context, appResources); + out.end(token); + } + } + } } else if (hasSizedRemoteViews()) { out.write(RemoteViewsProto.MODE, MODE_HAS_SIZED_REMOTEVIEWS); for (RemoteViews view : mSizedRemoteViews) { @@ -8192,6 +8956,7 @@ public class RemoteViews implements Parcelable, Filter { String mLayoutResName = null; String mLightBackgroundResName = null; String mViewResName = null; + final List> mActions = new ArrayList<>(); final List> mSizedRemoteViews = new ArrayList<>(); PendingResources mLandscapeViews = null; PendingResources mPortraitViews = null; @@ -8230,6 +8995,14 @@ public class RemoteViews implements Parcelable, Filter { case (int) RemoteViewsProto.PROVIDER_INSTANCE_ID: ref.mProviderInstanceId = in.readInt(RemoteViewsProto.PROVIDER_INSTANCE_ID); break; + case (int) RemoteViewsProto.ACTIONS: + final long actionsToken = in.start(RemoteViewsProto.ACTIONS); + final PendingResources action = createActionFromProto(ref.mRv, in); + if (action != null) { + ref.mActions.add(action); + } + in.end(actionsToken); + break; case (int) RemoteViewsProto.SIZED_REMOTEVIEWS: final long sizedToken = in.start(RemoteViewsProto.SIZED_REMOTEVIEWS); ref.mSizedRemoteViews.add(createFromProto(in)); @@ -8328,19 +9101,27 @@ public class RemoteViews implements Parcelable, Filter { } } if (ref.mPopulateRemoteCollectionCache != null) { - ref.mPopulateRemoteCollectionCache.create(context, resources, rootData, depth); + ref.mPopulateRemoteCollectionCache.create(appContext, appResources, rootData, + depth); } if (ref.mProviderInstanceId != -1) { rv.mProviderInstanceId = ref.mProviderInstanceId; } if (ref.mMode == MODE_NORMAL) { rv.setIdealSize(ref.mIdealSize); + for (PendingResources pendingAction : ref.mActions) { + Action action = pendingAction.create(appContext, appResources, rootData, depth); + if (action != null) { + rv.addAction(action); + } + } return rv; } else if (ref.mMode == MODE_HAS_SIZED_REMOTEVIEWS) { List sizedViews = new ArrayList<>(); for (RemoteViews.PendingResources pendingViews : ref.mSizedRemoteViews) { - RemoteViews views = pendingViews.create(context, resources, rootData, depth); + RemoteViews views = pendingViews.create(appContext, appResources, rootData, + depth); sizedViews.add(views); } rv.initializeSizedRemoteViews(sizedViews.iterator()); @@ -8349,8 +9130,8 @@ public class RemoteViews implements Parcelable, Filter { checkProtoResultNotNull(ref.mLandscapeViews, "Missing landscape views"); checkProtoResultNotNull(ref.mPortraitViews, "Missing portrait views"); RemoteViews parentRv = new RemoteViews( - ref.mLandscapeViews.create(context, resources, rootData, depth), - ref.mPortraitViews.create(context, resources, rootData, depth)); + ref.mLandscapeViews.create(appContext, appResources, rootData, depth), + ref.mPortraitViews.create(appContext, appResources, rootData, depth)); parentRv.initializeFrom(/* src= */ rv, /* hierarchyRoot= */ rv); return parentRv; } else { @@ -8370,6 +9151,35 @@ public class RemoteViews implements Parcelable, Filter { throws Exception; } + @Nullable + private static PendingResources createActionFromProto(RemoteViews rv, + ProtoInputStream in) throws Exception { + int actionFieldId = in.nextField(); + if (actionFieldId == NO_MORE_FIELDS) { + // action was omitted + return null; + } + switch (actionFieldId) { + case (int) RemoteViewsProto.Action.ATTRIBUTE_REFLECTION_ACTION: + return AttributeReflectionAction.createFromProto(in); + case (int) RemoteViewsProto.Action.BITMAP_REFLECTION_ACTION: + return rv.createFromBitmapReflectionActionFromProto(in); + case (int) RemoteViewsProto.Action.COMPLEX_UNIT_DIMENSION_REFLECTION_ACTION: + return ComplexUnitDimensionReflectionAction.createFromProto(in); + case (int) RemoteViewsProto.Action.LAYOUT_PARAM_ACTION: + return LayoutParamAction.createFromProto(in); + case (int) RemoteViewsProto.Action.NIGHT_MODE_REFLECTION_ACTION: + return NightModeReflectionAction.createFromProto(in); + case (int) RemoteViewsProto.Action.REFLECTION_ACTION: + return ReflectionAction.createFromProto(in); + case (int) RemoteViewsProto.Action.REMOVE_FROM_PARENT_ACTION: + return RemoveFromParentAction.createFromProto(in); + default: + throw new RuntimeException("Unhandled field while reading Action proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + private static void checkValidResource(int id, String message, String resName) throws Exception { if (id == 0) throw new Exception(message + ": " + resName); @@ -8392,6 +9202,22 @@ public class RemoteViews implements Parcelable, Filter { } } + private static int getAsIdentifier(Resources resources, LongSparseArray array, long fieldId) + throws Exception { + String resName = (String) array.get(fieldId); + int id = resources.getIdentifier(resName, /* defType= */ null, /* defPackage= */ null); + checkValidResource(id, "Invalid id", resName); + return id; + } + + private static int getAsIdentifier(Resources resources, SparseArray array, int key) + throws Exception { + String resName = (String) array.get(key); + int id = resources.getIdentifier(resName, /* defType= */ null, /* defPackage= */ null); + checkValidResource(id, "Invalid id", resName); + return id; + } + private static SizeF createSizeFFromProto(ProtoInputStream in) throws Exception { float width = 0; float height = 0; @@ -8411,4 +9237,43 @@ public class RemoteViews implements Parcelable, Filter { return new SizeF(width, height); } + + private static void writeIconToProto(ProtoOutputStream out, Resources appResources, Icon icon, + long fieldId) { + long token = out.start(fieldId); + RemoteViewsSerializers.writeIconToProto(out, appResources, icon); + out.end(token); + } + + private static PendingResources createIconFromProto(ProtoInputStream in, long fieldId) + throws Exception { + long token = in.start(fieldId); + Function icon = RemoteViewsSerializers.createIconFromProto(in); + in.end(token); + return (context, resources, rootData, depth) -> icon.apply(resources); + } + + private static void writeColorStateListToProto(ProtoOutputStream out, + ColorStateList colorStateList, long fieldId) { + long token = out.start(fieldId); + colorStateList.writeToProto(out); + out.end(token); + } + + private static ColorStateList createColorStateListFromProto(ProtoInputStream in, long fieldId) + throws Exception { + long token = in.start(fieldId); + ColorStateList colorStateList = ColorStateList.createFromProto(in); + in.end(token); + return colorStateList; + } + + private static CharSequence createCharSequenceFromProto(ProtoInputStream in, long fieldId) + throws Exception { + long token = in.start(fieldId); + CharSequence cs = RemoteViewsSerializers.createCharSequenceFromProto(in); + in.end(token); + return cs; + } + } diff --git a/core/proto/android/widget/remoteviews.proto b/core/proto/android/widget/remoteviews.proto index 5892396bddc4..47c97b08666b 100644 --- a/core/proto/android/widget/remoteviews.proto +++ b/core/proto/android/widget/remoteviews.proto @@ -54,6 +54,7 @@ message RemoteViewsProto { optional bool has_draw_instructions = 13; repeated bytes bitmap_cache = 14; optional RemoteCollectionCache remote_collection_cache = 15; + repeated Action actions = 16; message RemoteCollectionCache { message Entry { @@ -288,6 +289,91 @@ message RemoteViewsProto { } } } + + message Action { + oneof action { + AttributeReflectionAction attribute_reflection_action = 1; + BitmapReflectionAction bitmap_reflection_action = 2; + ComplexUnitDimensionReflectionAction complex_unit_dimension_reflection_action = 3; + LayoutParamAction layout_param_action = 4; + NightModeReflectionAction night_mode_reflection_action = 5; + ReflectionAction reflection_action = 6; + RemoveFromParentAction remove_from_parent_action = 7; + } + } + + message AttributeReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 parameter_type = 3; + optional int32 resource_type = 4; + optional string attribute_id = 5; + } + + message BitmapReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 bitmap_id = 3; + } + + message ComplexUnitDimensionReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 parameter_type = 3; + optional float dimension_value = 4; + optional int32 unit = 5; + } + + message LayoutParamAction { + optional string view_id = 1; + optional int32 property = 2; + optional int32 layout_value = 3; + optional int32 value_type = 4; + } + + message NightModeReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 parameter_type = 3; + oneof light { + Icon light_icon = 4; + android.content.res.ColorStateListProto light_color_state_list = 5; + int32 light_int = 6; + } + oneof dark { + Icon dark_icon = 7; + android.content.res.ColorStateListProto dark_color_state_list = 8; + int32 dark_int = 9; + } + } + + message ReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 parameter_type = 3; + oneof reflection_value { + bool boolean_value = 4; + bytes byte_value = 5; + int32 short_value = 6; + int32 int_value = 7; + int64 long_value = 8; + float float_value = 9; + double double_value = 10; + int32 char_value = 11; + string string_value = 12; + CharSequence char_sequence_value = 13; + string uri_value = 14; + bytes bitmap_value = 15; + android.content.res.ColorStateListProto color_state_list_value = 16; + Icon icon_value = 17; + int32 blend_mode_value = 18; + // Intent and Bundle values are excluded. + } + } + + message RemoveFromParentAction { + optional string view_id = 1; + } } diff --git a/core/tests/coretests/src/android/widget/RemoteViewsProtoTest.java b/core/tests/coretests/src/android/widget/RemoteViewsProtoTest.java deleted file mode 100644 index 7c140329f0e4..000000000000 --- a/core/tests/coretests/src/android/widget/RemoteViewsProtoTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.widget; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import android.content.Context; -import android.util.SizeF; -import android.util.proto.ProtoInputStream; -import android.util.proto.ProtoOutputStream; -import android.view.View; - -import androidx.test.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.filters.SmallTest; - -import com.android.frameworks.coretests.R; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; - -import java.util.Map; - -/** - * Tests for RemoteViews. - */ -@RunWith(AndroidJUnit4.class) -@SmallTest -public class RemoteViewsProtoTest { - - // This can point to any other package which exists on the device. - private static final String OTHER_PACKAGE = "com.android.systemui"; - - @Rule - public final ExpectedException exception = ExpectedException.none(); - - private Context mContext; - private String mPackage; - private LinearLayout mContainer; - - @Before - public void setup() { - mContext = InstrumentationRegistry.getContext(); - mPackage = mContext.getPackageName(); - mContainer = new LinearLayout(mContext); - } - - @Test - public void copy_canStillBeApplied() { - RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test); - - RemoteViews clone = recreateFromProto(original); - - clone.apply(mContext, mContainer); - } - - @SuppressWarnings("ReturnValueIgnored") - @Test - public void clone_repeatedly() { - RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test); - - recreateFromProto(original); - recreateFromProto(original); - - original.apply(mContext, mContainer); - } - - @Test - public void clone_chained() { - RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test); - - RemoteViews clone = recreateFromProto(recreateFromProto(original)); - - - clone.apply(mContext, mContainer); - } - - @Test - public void landscapePortraitViews_lightBackgroundLayoutFlag() { - RemoteViews inner = new RemoteViews(mPackage, R.layout.remote_views_text); - inner.setLightBackgroundLayoutId(R.layout.remote_views_light_background_text); - - RemoteViews parent = new RemoteViews(inner, inner); - parent.addFlags(RemoteViews.FLAG_USE_LIGHT_BACKGROUND_LAYOUT); - - View view = recreateFromProto(parent).apply(mContext, mContainer); - assertNull(view.findViewById(R.id.text)); - assertNotNull(view.findViewById(R.id.light_background_text)); - } - - @Test - public void sizedViews_lightBackgroundLayoutFlag() { - RemoteViews inner = new RemoteViews(mPackage, R.layout.remote_views_text); - inner.setLightBackgroundLayoutId(R.layout.remote_views_light_background_text); - - RemoteViews parent = new RemoteViews( - Map.of(new SizeF(0, 0), inner, new SizeF(100, 100), inner)); - parent.addFlags(RemoteViews.FLAG_USE_LIGHT_BACKGROUND_LAYOUT); - - View view = recreateFromProto(parent).apply(mContext, mContainer); - assertNull(view.findViewById(R.id.text)); - assertNotNull(view.findViewById(R.id.light_background_text)); - } - - @Test - public void nestedLandscapeViews() throws Exception { - RemoteViews views = new RemoteViews(mPackage, R.layout.remote_views_test); - for (int i = 0; i < 10; i++) { - views = new RemoteViews(views, new RemoteViews(mPackage, R.layout.remote_views_test)); - } - // writeTo/createFromProto works - recreateFromProto(views); - - views = new RemoteViews(mPackage, R.layout.remote_views_test); - for (int i = 0; i < 11; i++) { - views = new RemoteViews(views, new RemoteViews(mPackage, R.layout.remote_views_test)); - } - // writeTo/createFromProto fails - exception.expect(IllegalArgumentException.class); - recreateFromProtoNoRethrow(views); - } - - private RemoteViews recreateFromProto(RemoteViews views) { - try { - return recreateFromProtoNoRethrow(views); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private RemoteViews recreateFromProtoNoRethrow(RemoteViews views) throws Exception { - ProtoOutputStream out = new ProtoOutputStream(); - views.writePreviewToProto(mContext, out); - ProtoInputStream in = new ProtoInputStream(out.getBytes()); - return RemoteViews.createPreviewFromProto(mContext, in); - } -} -- GitLab From 4bcca6499e8261e2569bff739ba02ccabb62441e Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Mon, 9 Sep 2024 11:47:54 +0000 Subject: [PATCH 165/492] Avoid starting window being stuck while launch transient launch. While entering transient launch transition, the transient hide task and it's descendant won't be add to sync group, so if an Activity request finish itself during collect transient launch, the starting window can be stuck to next activity because the close activity transition will be collect within the same transition. So while able to remove starting window, checking the sync state of the activity instead of isCollecting. Flag: EXEMPT bugfix Bug: 365040473 Test: atest ActivityRecordTests Test: simulate with sample app by following the description on issue. Change-Id: I444802c434a3522a07fcb4d647a8a8008b441018 --- services/core/java/com/android/server/wm/ActivityRecord.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index e562ea84d001..6b51cd33d86a 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2849,7 +2849,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final boolean hasImeSurface; if (mStartingData != null) { if (mStartingData.mWaitForSyncTransactionCommit - || mTransitionController.isCollecting(this)) { + || mSyncState != SYNC_STATE_NONE) { mStartingData.mRemoveAfterTransaction = AFTER_TRANSACTION_REMOVE_DIRECTLY; mStartingData.mPrepareRemoveAnimation = prepareAnimation; return; -- GitLab From dba6488fb1f81aaefbb393bdd65b8af872572a28 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Tue, 10 Sep 2024 13:22:54 +0900 Subject: [PATCH 166/492] Add nona to owner of Paint Bug: N/A Test: N/A Flag: EXEMPT only changing OWNERS Change-Id: Ibf3c8c5b4bcae195097c9bab4d9d3f833d5c66df --- graphics/java/android/graphics/OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/java/android/graphics/OWNERS b/graphics/java/android/graphics/OWNERS index 9fa8f1b284bb..ef8d26cc65b9 100644 --- a/graphics/java/android/graphics/OWNERS +++ b/graphics/java/android/graphics/OWNERS @@ -11,3 +11,4 @@ per-file BLASTBufferQueue.java = file:/services/core/java/com/android/server/wm/ per-file FontFamily.java = file:fonts/OWNERS per-file FontListParser.java = file:fonts/OWNERS per-file Typeface.java = file:fonts/OWNERS +per-file Paint.java = file:fonts/OWNERS -- GitLab From 8f9218a51dd3650f09e1cbcfa7c4c0cab2d8da6b Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Mon, 9 Sep 2024 15:01:02 +0900 Subject: [PATCH 167/492] Move some exported flags into 24Q3.aconfig - use_bounds_for_width The code dependency is already removed by I2c30b8e330b6d896888f08794ca30ca81c8a7f01 - word_style_auto Code Dependency: I5949f357dade0e034fb64016e4eeac3df863c8c3 CTS: I0923b913450677a9a9fa96b53e00f89ec5b212b6 - letter_spacing_justification Code Dependency: I98ab2af28ca24026eb6655324ea520e669f26e73 CTS: Ifc3033e3b9c8078903b9c071047c1003985e51a7 Bug: 63938206 Bug: 280005585 Bug: 283193133 Bug: 364533012 Flag: EXEMPT removing use_bounds_for_width Test: N/A Change-Id: Ic99ea27cfd0300b04fdd7bc1b252910d57039c61 --- core/java/android/text/flags/24Q3.aconfig | 28 +++++++++++++++++++ core/java/android/text/flags/flags.aconfig | 24 ---------------- .../android/text/TextLineLetterSpacingTest.kt | 4 --- 3 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 core/java/android/text/flags/24Q3.aconfig diff --git a/core/java/android/text/flags/24Q3.aconfig b/core/java/android/text/flags/24Q3.aconfig new file mode 100644 index 000000000000..99e78c974dbf --- /dev/null +++ b/core/java/android/text/flags/24Q3.aconfig @@ -0,0 +1,28 @@ +package: "com.android.text.flags" +container: "system" + +# This aconfig file contains released flags in 24Q3 those cannot be removed. + +flag { + name: "use_bounds_for_width" + is_exported: true + namespace: "text" + description: "Feature flag for preventing horizontal clipping." + bug: "63938206" +} + +flag { + name: "word_style_auto" + is_exported: true + namespace: "text" + description: "A feature flag that implements line break word style auto." + bug: "280005585" +} + +flag { + name: "letter_spacing_justification" + is_exported: true + namespace: "text" + description: "A feature flag that implement inter character justification." + bug: "283193133" +} diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index 02f8779a4b46..c13ed1632fdb 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -50,30 +50,6 @@ flag { } } -flag { - name: "use_bounds_for_width" - is_exported: true - namespace: "text" - description: "Feature flag for preventing horizontal clipping." - bug: "63938206" -} - -flag { - name: "word_style_auto" - is_exported: true - namespace: "text" - description: "A feature flag that implements line break word style auto." - bug: "280005585" -} - -flag { - name: "letter_spacing_justification" - is_exported: true - namespace: "text" - description: "A feature flag that implement inter character justification." - bug: "283193133" -} - flag { name: "escape_clears_focus" namespace: "text" diff --git a/core/tests/coretests/src/android/text/TextLineLetterSpacingTest.kt b/core/tests/coretests/src/android/text/TextLineLetterSpacingTest.kt index 71980c125f01..e4e04a028588 100644 --- a/core/tests/coretests/src/android/text/TextLineLetterSpacingTest.kt +++ b/core/tests/coretests/src/android/text/TextLineLetterSpacingTest.kt @@ -17,11 +17,9 @@ package android.text import android.graphics.Paint -import android.platform.test.annotations.RequiresFlagsEnabled import android.platform.test.flag.junit.DeviceFlagsValueProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest -import com.android.text.flags.Flags.FLAG_LETTER_SPACING_JUSTIFICATION import com.google.common.truth.Truth.assertThat import org.junit.Rule import org.junit.Test @@ -40,7 +38,6 @@ class TextLineLetterSpacingTest { @JvmField val mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule() - @RequiresFlagsEnabled(FLAG_LETTER_SPACING_JUSTIFICATION) @Test fun calculateRunFlagTest() { // Only one Bidi run @@ -84,7 +81,6 @@ class TextLineLetterSpacingTest { .isEqualTo(LEFT_EDGE) } - @RequiresFlagsEnabled(FLAG_LETTER_SPACING_JUSTIFICATION) @Test fun resolveRunFlagForSubSequenceTest() { val runStart = 5 -- GitLab From 30ad8993f1a6b1d1b13ef5e0acc4bc5208c2ddf0 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Mon, 9 Sep 2024 15:33:36 +0900 Subject: [PATCH 168/492] Move fix_line_height_for_locale to 24Q3.aconfig Bug: 303326708 Bug: 364533012 Flag: EXEMPT removing com.android.text.flags.fix_line_height_for_locale Test: N/A Change-Id: I8b68efc1ed3ecb046b4cdcc9ad04118b0c649ad9 --- core/java/android/text/ClientFlags.java | 7 ------- core/java/android/text/TextFlags.java | 2 -- core/java/android/text/flags/24Q3.aconfig | 8 ++++++++ core/java/android/text/flags/flags.aconfig | 8 -------- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/core/java/android/text/ClientFlags.java b/core/java/android/text/ClientFlags.java index 5f2823b7630f..901bf562f194 100644 --- a/core/java/android/text/ClientFlags.java +++ b/core/java/android/text/ClientFlags.java @@ -34,13 +34,6 @@ public class ClientFlags { return TextFlags.isFeatureEnabled(Flags.FLAG_NO_BREAK_NO_HYPHENATION_SPAN); } - /** - * @see Flags#fixLineHeightForLocale() - */ - public static boolean fixLineHeightForLocale() { - return TextFlags.isFeatureEnabled(Flags.FLAG_FIX_LINE_HEIGHT_FOR_LOCALE); - } - /** * @see Flags#fixMisalignedContextMenu() */ diff --git a/core/java/android/text/TextFlags.java b/core/java/android/text/TextFlags.java index 8ee2ad0ef35e..a78aa7e0312a 100644 --- a/core/java/android/text/TextFlags.java +++ b/core/java/android/text/TextFlags.java @@ -56,7 +56,6 @@ public final class TextFlags { */ public static final String[] TEXT_ACONFIGS_FLAGS = { Flags.FLAG_NO_BREAK_NO_HYPHENATION_SPAN, - Flags.FLAG_FIX_LINE_HEIGHT_FOR_LOCALE, Flags.FLAG_FIX_MISALIGNED_CONTEXT_MENU, }; @@ -67,7 +66,6 @@ public final class TextFlags { */ public static final boolean[] TEXT_ACONFIG_DEFAULT_VALUE = { Flags.noBreakNoHyphenationSpan(), - Flags.fixLineHeightForLocale(), Flags.fixMisalignedContextMenu(), }; diff --git a/core/java/android/text/flags/24Q3.aconfig b/core/java/android/text/flags/24Q3.aconfig index 99e78c974dbf..6524ed32acf4 100644 --- a/core/java/android/text/flags/24Q3.aconfig +++ b/core/java/android/text/flags/24Q3.aconfig @@ -26,3 +26,11 @@ flag { description: "A feature flag that implement inter character justification." bug: "283193133" } + +flag { + name: "fix_line_height_for_locale" + is_exported: true + namespace: "text" + description: "Feature flag that preserve the line height of the TextView and EditText even if the the locale is different from Latin" + bug: "303326708" +} diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index c13ed1632fdb..f8a98da4d36f 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -11,14 +11,6 @@ flag { bug: "281769620" } -flag { - name: "fix_line_height_for_locale" - is_exported: true - namespace: "text" - description: "Feature flag that preserve the line height of the TextView and EditText even if the the locale is different from Latin" - bug: "303326708" -} - flag { name: "no_break_no_hyphenation_span" is_exported: true -- GitLab From 64559297bcfb683818cfa9c797f630af2ea5bbb6 Mon Sep 17 00:00:00 2001 From: Toshiki Kikuchi Date: Fri, 6 Sep 2024 14:06:28 +0900 Subject: [PATCH 169/492] =?UTF-8?q?Don=E2=80=99t=20consider=20move=20witho?= =?UTF-8?q?ut=20actual=20bounds=20change=20as=20drag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL prevents DMWindowDecor from flipping `mIsDragging` for ACTION_MOVE without actual bounds change. Otherwise, no one resets the flag when... 1) ACTION_DOWN on caption button 2) ACTION_MOVE without actual bounds change on caption button Note that ACTION_MOVE can be fired even when there is no position change from the previous ACTION_DOWN 3) ACTION_UP on caption button 4) onClick on caption button so the caption button click is ignored. Bug: 364990718 Test: DesktopModeWindowDecorViewModelTests Flag: EXEMPT bugfix Change-Id: Icc15380b26f85c93a724966a7e09472b56f0d259 --- .../DesktopModeWindowDecorViewModel.java | 63 +++++++++++------ .../FluidResizeTaskPositioner.java | 3 +- .../wm/shell/windowdecor/TaskDragResizer.java | 2 +- .../wm/shell/windowdecor/TaskPositioner.kt | 22 ++++++ .../VeiledResizeTaskPositioner.java | 3 +- .../DesktopModeWindowDecorViewModelTests.kt | 70 ++++++++++++++++++- 6 files changed, 134 insertions(+), 29 deletions(-) create mode 100644 libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/TaskPositioner.kt diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java index c88c1e28b011..75e710848863 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java @@ -197,6 +197,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { }); } }; + private final TaskPositionerFactory mTaskPositionerFactory; public DesktopModeWindowDecorViewModel( Context context, @@ -246,7 +247,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { new SparseArray<>(), interactionJankMonitor, desktopTasksLimiter, - activityOrientationChangeHandler); + activityOrientationChangeHandler, + new TaskPositionerFactory()); } @VisibleForTesting @@ -275,7 +277,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { SparseArray windowDecorByTaskId, InteractionJankMonitor interactionJankMonitor, Optional desktopTasksLimiter, - Optional activityOrientationChangeHandler) { + Optional activityOrientationChangeHandler, + TaskPositionerFactory taskPositionerFactory) { mContext = context; mMainExecutor = shellExecutor; mMainHandler = mainHandler; @@ -329,6 +332,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { } } }; + mTaskPositionerFactory = taskPositionerFactory; shellInit.addInitCallback(this::onInit, this); } @@ -822,7 +826,10 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { decoration.mTaskSurface, e.getRawX(dragPointerIdx), newTaskBounds); - updateDragStatus(e.getActionMasked()); + // Flip mIsDragging only if the bounds actually changed. + if (mIsDragging || !newTaskBounds.equals(mOnDragStartInitialBounds)) { + updateDragStatus(e.getActionMasked()); + } return true; } case MotionEvent.ACTION_UP: @@ -1273,23 +1280,18 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { mMultiInstanceHelper); mWindowDecorByTaskId.put(taskInfo.taskId, windowDecoration); - final DragPositioningCallback dragPositioningCallback; - if (!DesktopModeStatus.isVeiledResizeEnabled()) { - dragPositioningCallback = new FluidResizeTaskPositioner( - mTaskOrganizer, mTransitions, windowDecoration, mDisplayController, - mDragStartListener, mTransactionFactory); - windowDecoration.setTaskDragResizer( - (FluidResizeTaskPositioner) dragPositioningCallback); - } else { - dragPositioningCallback = new VeiledResizeTaskPositioner( - mTaskOrganizer, windowDecoration, mDisplayController, - mDragStartListener, mTransitions, mInteractionJankMonitor); - windowDecoration.setTaskDragResizer( - (VeiledResizeTaskPositioner) dragPositioningCallback); - } + final TaskPositioner taskPositioner = mTaskPositionerFactory.create( + mTaskOrganizer, + windowDecoration, + mDisplayController, + mDragStartListener, + mTransitions, + mInteractionJankMonitor, + mTransactionFactory); + windowDecoration.setTaskDragResizer(taskPositioner); final DesktopModeTouchEventListener touchEventListener = - new DesktopModeTouchEventListener(taskInfo, dragPositioningCallback); + new DesktopModeTouchEventListener(taskInfo, taskPositioner); windowDecoration.setOnMaximizeOrRestoreClickListener(() -> { onMaximizeOrRestore(taskInfo.taskId, "maximize_menu"); return Unit.INSTANCE; @@ -1323,7 +1325,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { windowDecoration.setCaptionListeners( touchEventListener, touchEventListener, touchEventListener, touchEventListener); windowDecoration.setExclusionRegionListener(mExclusionRegionListener); - windowDecoration.setDragPositioningCallback(dragPositioningCallback); + windowDecoration.setDragPositioningCallback(taskPositioner); windowDecoration.setDragDetector(touchEventListener.mDragDetector); windowDecoration.relayout(taskInfo, startT, finishT, false /* applyStartTransactionOnDraw */, false /* shouldSetTaskPositionAndCrop */); @@ -1472,6 +1474,25 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { } } } -} - + @VisibleForTesting + static class TaskPositionerFactory { + TaskPositioner create( + ShellTaskOrganizer taskOrganizer, + DesktopModeWindowDecoration windowDecoration, + DisplayController displayController, + DragPositioningCallbackUtility.DragStartListener dragStartListener, + Transitions transitions, + InteractionJankMonitor interactionJankMonitor, + Supplier transactionFactory) { + if (!DesktopModeStatus.isVeiledResizeEnabled()) { + return new FluidResizeTaskPositioner( + taskOrganizer, transitions, windowDecoration, displayController, + dragStartListener, transactionFactory); + } + return new VeiledResizeTaskPositioner( + taskOrganizer, windowDecoration, displayController, + dragStartListener, transitions, interactionJankMonitor); + } + } +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java index e2d42b2783da..3853f1f086c1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java @@ -49,8 +49,7 @@ import java.util.function.Supplier; * that we send the final shell transition since we still utilize the {@link #onTransitionConsumed} * callback. */ -class FluidResizeTaskPositioner implements DragPositioningCallback, - TaskDragResizer, Transitions.TransitionHandler { +class FluidResizeTaskPositioner implements TaskPositioner, Transitions.TransitionHandler { private final ShellTaskOrganizer mTaskOrganizer; private final Transitions mTransitions; private final WindowDecoration mWindowDecoration; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/TaskDragResizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/TaskDragResizer.java index 40421b599889..d7ea0c3a8e62 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/TaskDragResizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/TaskDragResizer.java @@ -19,7 +19,7 @@ package com.android.wm.shell.windowdecor; /** * Holds the state of a drag resize. */ -interface TaskDragResizer { +public interface TaskDragResizer { /** * Returns true if task is currently being resized or animating the final transition after diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/TaskPositioner.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/TaskPositioner.kt new file mode 100644 index 000000000000..96c43da0cdf2 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/TaskPositioner.kt @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.wm.shell.windowdecor + +/** + * Interface for TaskPositioner. + */ +interface TaskPositioner : DragPositioningCallback, TaskDragResizer diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java index 4a884eb50595..599815530f63 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java @@ -47,8 +47,7 @@ import java.util.function.Supplier; * If the drag is resizing the task, we resize the veil instead. * If the drag is repositioning, we update in the typical manner. */ -public class VeiledResizeTaskPositioner implements DragPositioningCallback, - TaskDragResizer, Transitions.TransitionHandler { +public class VeiledResizeTaskPositioner implements TaskPositioner, Transitions.TransitionHandler { private DesktopModeWindowDecoration mDesktopWindowDecoration; private ShellTaskOrganizer mTaskOrganizer; diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt index be0549b6655d..3690fdd1f46a 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt @@ -34,6 +34,7 @@ import android.hardware.display.VirtualDisplay import android.hardware.input.InputManager import android.net.Uri import android.os.Handler +import android.os.SystemClock import android.os.UserHandle import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags @@ -52,10 +53,12 @@ import android.view.InputMonitor import android.view.InsetsSource import android.view.InsetsState import android.view.KeyEvent +import android.view.MotionEvent import android.view.Surface import android.view.SurfaceControl import android.view.SurfaceView import android.view.View +import android.view.ViewRootImpl import android.view.WindowInsets.Type.statusBars import android.widget.Toast import android.window.WindowContainerTransaction @@ -172,6 +175,10 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() { @Mock private lateinit var mockFreeformTaskTransitionStarter: FreeformTaskTransitionStarter @Mock private lateinit var mockActivityOrientationChangeHandler: DesktopActivityOrientationChangeHandler + @Mock private lateinit var mockInputManager: InputManager + @Mock private lateinit var mockTaskPositionerFactory: + DesktopModeWindowDecorViewModel.TaskPositionerFactory + @Mock private lateinit var mockTaskPositioner: TaskPositioner private lateinit var spyContext: TestableContext private val transactionFactory = Supplier { @@ -201,6 +208,7 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() { doNothing().`when`(spyContext).startActivity(any()) shellInit = ShellInit(mockShellExecutor) windowDecorByTaskIdSpy.clear() + spyContext.addMockSystemService(InputManager::class.java, mockInputManager) desktopModeWindowDecorViewModel = DesktopModeWindowDecorViewModel( spyContext, mockShellExecutor, @@ -226,12 +234,15 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() { windowDecorByTaskIdSpy, mockInteractionJankMonitor, Optional.of(mockTasksLimiter), - Optional.of(mockActivityOrientationChangeHandler) + Optional.of(mockActivityOrientationChangeHandler), + mockTaskPositionerFactory ) desktopModeWindowDecorViewModel.setSplitScreenController(mockSplitScreenController) whenever(mockDisplayController.getDisplayLayout(any())).thenReturn(mockDisplayLayout) whenever(mockDisplayLayout.stableInsets()).thenReturn(STABLE_INSETS) whenever(mockInputMonitorFactory.create(any(), any())).thenReturn(mockInputMonitor) + whenever(mockTaskPositionerFactory.create(any(), any(), any(), any(), any(), any(), any())) + .thenReturn(mockTaskPositioner) doReturn(mockToast).`when` { Toast.makeText(any(), anyInt(), anyInt()) } @@ -1055,6 +1066,55 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() { verify(wct, never()).setBounds(eq(thirdTask.token), any()) } + @Test + fun testCloseButtonInFreeform_closeWindow_ignoreMoveEventsWithoutBoundsChange() { + val onClickListenerCaptor = forClass(View.OnClickListener::class.java) + as ArgumentCaptor + val onTouchListenerCaptor = forClass(View.OnTouchListener::class.java) + as ArgumentCaptor + val decor = createOpenTaskDecoration( + windowingMode = WINDOWING_MODE_FREEFORM, + onCaptionButtonClickListener = onClickListenerCaptor, + onCaptionButtonTouchListener = onTouchListenerCaptor + ) + + whenever(mockTaskPositioner.onDragPositioningStart(any(), any(), any())) + .thenReturn(INITIAL_BOUNDS) + whenever(mockTaskPositioner.onDragPositioningMove(any(), any())) + .thenReturn(INITIAL_BOUNDS) + whenever(mockTaskPositioner.onDragPositioningEnd(any(), any())) + .thenReturn(INITIAL_BOUNDS) + + val view = mock(View::class.java) + whenever(view.id).thenReturn(R.id.close_window) + val viewRootImpl = mock(ViewRootImpl::class.java) + whenever(view.getViewRootImpl()).thenReturn(viewRootImpl) + whenever(viewRootImpl.getInputToken()).thenReturn(null) + + desktopModeWindowDecorViewModel + .setFreeformTaskTransitionStarter(mockFreeformTaskTransitionStarter) + + onTouchListenerCaptor.value.onTouch(view, + MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), + MotionEvent.ACTION_DOWN, /* x= */ 0f, /* y= */ 0f, /* metaState= */ 0)) + onTouchListenerCaptor.value.onTouch(view, + MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), + MotionEvent.ACTION_MOVE, /* x= */ 0f, /* y= */ 0f, /* metaState= */ 0)) + onTouchListenerCaptor.value.onTouch(view, + MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), + MotionEvent.ACTION_UP, /* x= */ 0f, /* y= */ 0f, /* metaState= */ 0)) + onClickListenerCaptor.value.onClick(view) + + val transactionCaptor = argumentCaptor() + verify(mockFreeformTaskTransitionStarter).startRemoveTransition(transactionCaptor.capture()) + val wct = transactionCaptor.firstValue + + assertEquals(1, wct.getHierarchyOps().size) + assertEquals(HierarchyOp.HIERARCHY_OP_TYPE_REMOVE_TASK, + wct.getHierarchyOps().get(0).getType()) + assertEquals(decor.mTaskInfo.token.asBinder(), wct.getHierarchyOps().get(0).getContainer()) + } + private fun createOpenTaskDecoration( @WindowingMode windowingMode: Int, taskSurface: SurfaceControl = SurfaceControl(), @@ -1073,7 +1133,9 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() { onOpenInBrowserClickListener: ArgumentCaptor> = forClass(Consumer::class.java) as ArgumentCaptor>, onCaptionButtonClickListener: ArgumentCaptor = - forClass(View.OnClickListener::class.java) as ArgumentCaptor + forClass(View.OnClickListener::class.java) as ArgumentCaptor, + onCaptionButtonTouchListener: ArgumentCaptor = + forClass(View.OnTouchListener::class.java) as ArgumentCaptor ): DesktopModeWindowDecoration { val decor = setUpMockDecorationForTask(createTask(windowingMode = windowingMode)) onTaskOpening(decor.mTaskInfo, taskSurface) @@ -1085,7 +1147,8 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() { verify(decor).setOnToSplitScreenClickListener(onToSplitScreenClickListenerCaptor.capture()) verify(decor).setOpenInBrowserClickListener(onOpenInBrowserClickListener.capture()) verify(decor).setCaptionListeners( - onCaptionButtonClickListener.capture(), any(), any(), any()) + onCaptionButtonClickListener.capture(), onCaptionButtonTouchListener.capture(), + any(), any()) return decor } @@ -1172,5 +1235,6 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() { companion object { private const val TAG = "DesktopModeWindowDecorViewModelTests" private val STABLE_INSETS = Rect(0, 100, 0, 0) + private val INITIAL_BOUNDS = Rect(0, 0, 100, 100) } } -- GitLab From 67641437837c7b9a973c938b3b88f9b976c9a791 Mon Sep 17 00:00:00 2001 From: zhuning3 Date: Thu, 1 Aug 2024 14:47:47 +0800 Subject: [PATCH 170/492] Fix the application startup failure caused by the abnormal state value of ceDataInode in version V. Test:UAT Bug:356778367 Change-Id: I7b208fab88a77d46c4c75fe1232e1d8ca439bdbd Signed-off-by: zhuning3 --- services/core/java/com/android/server/am/ProcessList.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index b239b6476564..d67c93d77819 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -2333,8 +2333,8 @@ public final class ProcessList { } String volumeUuid = packageState.getVolumeUuid(); long inode = packageState.getUserStateOrDefault(userId).getCeDataInode(); - if (inode == 0) { - Slog.w(TAG, packageName + " inode == 0 (b/152760674)"); + if (inode <= 0) { + Slog.w(TAG, packageName + " inode == 0 or app uninstalled with keep-data"); return null; } result.put(packageName, Pair.create(volumeUuid, inode)); -- GitLab From 0b2c6ef749283f86a1fa5befcaa12f812cc91ac5 Mon Sep 17 00:00:00 2001 From: Matthew Reynolds Date: Thu, 5 Sep 2024 04:51:27 +0000 Subject: [PATCH 171/492] Move tests/systemui/s* to multivalentTests Bug: 361373972 Test: tested manually with atest Flag: TEST_ONLY Change-Id: Ib5b4c27c40dc3c93bd9f26b0934760827733af54 --- .../com/android/systemui/screenrecord/RecordingServiceTest.java | 0 .../screenrecord/ScreenRecordPermissionDialogDelegateTest.kt | 0 .../screenrecord/data/repository/ScreenRecordRepositoryTest.kt | 0 .../com/android/systemui/screenshot/ActionIntentExecutorTest.kt | 0 .../com/android/systemui/screenshot/AnnouncementResolverTest.kt | 0 .../systemui/screenshot/DraggableConstraintLayoutTest.java | 0 .../src/com/android/systemui/screenshot/FakeImageCapture.kt | 0 .../src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt | 0 .../android/systemui/screenshot/MessageContainerControllerTest.kt | 0 .../src/com/android/systemui/screenshot/RecyclerViewActivity.java | 0 .../systemui/screenshot/ScreenshotActionsControllerTest.kt | 0 .../src/com/android/systemui/screenshot/ScreenshotDataTest.kt | 0 .../systemui/screenshot/ScreenshotDetectionControllerTest.kt | 0 .../screenshot/ScreenshotNotificationSmartActionsTest.java | 0 .../android/systemui/screenshot/ScreenshotSoundControllerTest.kt | 0 .../com/android/systemui/screenshot/SmartActionsReceiverTest.java | 0 .../com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt | 0 .../systemui/screenshot/WorkProfileMessageControllerTest.java | 0 .../screenshot/appclips/AppClipsScreenshotHelperServiceTest.java | 0 .../android/systemui/screenshot/appclips/AppClipsServiceTest.java | 0 .../systemui/screenshot/data/model/DisplayContentScenarios.kt | 0 .../screenshot/data/repository/ProfileTypeRepositoryKosmos.kt | 0 .../systemui/screenshot/message/ProfileMessageControllerTest.kt | 0 .../src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt | 0 .../systemui/screenshot/policy/PolicyRequestProcessorTest.kt | 0 .../systemui/screenshot/policy/PrivateProfilePolicyTest.kt | 0 .../src/com/android/systemui/screenshot/policy/TestUserIds.kt | 0 .../android/systemui/screenshot/policy/WorkProfilePolicyTest.kt | 0 .../com/android/systemui/screenshot/scroll/FakeSessionTest.java | 0 .../screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java | 0 .../android/systemui/screenshot/scroll/ScrollViewActivity.java | 0 .../systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt | 0 .../src/com/android/systemui/scrim/ScrimViewTest.java | 0 .../systemui/settings/brightness/BrightnessControllerTest.kt | 0 .../android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt | 0 .../src/com/android/systemui/shade/ConstraintChangeTest.kt | 0 .../src/com/android/systemui/shade/ConstraintChangesTest.kt | 0 .../systemui/shade/LockscreenHostedDreamGestureListenerTest.kt | 0 .../shade/NotificationPanelUnfoldAnimationControllerTest.kt | 0 .../systemui/shade/NotificationPanelViewControllerBaseTest.java | 0 .../systemui/shade/NotificationPanelViewControllerTest.java | 0 .../shade/NotificationPanelViewControllerWithCoroutinesTest.kt | 0 .../com/android/systemui/shade/NotificationShadeWindowViewTest.kt | 0 .../systemui/shade/NotificationsQuickSettingsContainerTest.kt | 0 .../src/com/android/systemui/shade/PulsingGestureListenerTest.kt | 0 .../src/com/android/systemui/shade/QsBatteryModeControllerTest.kt | 0 .../systemui/shade/QuickSettingsControllerImplBaseTest.java | 0 .../shade/QuickSettingsControllerImplWithCoroutinesTest.kt | 0 .../src/com/android/systemui/shade/ShadeControllerImplTest.kt | 0 .../src/com/android/systemui/shade/carrier/CellSignalStateTest.kt | 0 .../src/com/android/systemui/shade/carrier/ShadeCarrierTest.java | 0 .../systemui/shade/data/repository/ShadeRepositoryImplTest.kt | 0 .../shade/transition/LinearLargeScreenShadeInterpolator.kt | 0 .../shade/transition/ScrimShadeTransitionControllerTest.kt | 0 .../shared/animation/DisableSubpixelTextTransitionListenerTest.kt | 0 .../shared/animation/UnfoldConstantTranslateAnimatorTest.kt | 0 .../systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt | 0 .../src/com/android/systemui/shared/clocks/ClockRegistryTest.kt | 0 .../android/systemui/shared/clocks/DefaultClockProviderTest.kt | 0 .../android/systemui/shared/condition/ConditionExtensionsTest.kt | 0 .../android/systemui/shared/condition/ConditionMonitorTest.java | 0 .../src/com/android/systemui/shared/condition/ConditionTest.java | 0 .../src/com/android/systemui/shared/condition/FakeCondition.java | 0 .../com/android/systemui/shared/plugins/PluginManagerTest.java | 0 .../src/com/android/systemui/shared/plugins/VersionInfoTest.java | 0 .../android/systemui/shared/regionsampling/RegionSamplerTest.kt | 0 .../systemui/shared/rotation/RotationButtonControllerTest.kt | 0 .../src/com/android/systemui/statusbar/BlurUtilsTest.kt | 0 .../src/com/android/systemui/statusbar/DragDownHelperTest.kt | 0 .../systemui/statusbar/KeyguardIndicationControllerBaseTest.java | 0 .../com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt | 0 .../statusbar/LockscreenShadeQsTransitionControllerTest.kt | 0 .../com/android/systemui/statusbar/NotificationListenerTest.java | 0 .../systemui/statusbar/NotificationRemoteInputManagerTest.java | 0 .../systemui/statusbar/NotificationShadeDepthControllerTest.kt | 0 .../android/systemui/statusbar/NotificationUiAdjustmentTest.java | 0 .../com/android/systemui/statusbar/PulseExpansionHandlerTest.kt | 0 .../systemui/statusbar/RemoteInputNotificationRebuilderTest.java | 0 .../systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt | 0 .../com/android/systemui/statusbar/SmartReplyControllerTest.java | 0 .../src/com/android/systemui/statusbar/StatusBarStateEventTest.kt | 0 .../src/com/android/systemui/statusbar/VibratorHelperTest.kt | 0 .../statusbar/chips/ui/view/ChipBackgroundContainerTest.kt | 0 .../systemui/statusbar/chips/ui/view/ChipChronometerTest.kt | 0 .../com/android/systemui/statusbar/commandline/ParametersTest.kt | 0 .../systemui/statusbar/commandline/ParseableCommandTest.kt | 0 .../com/android/systemui/statusbar/commandline/ValueParserTest.kt | 0 .../statusbar/connectivity/AccessPointControllerImplTest.kt | 0 .../statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt | 0 .../systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt | 0 .../statusbar/connectivity/ui/MobileContextProviderTest.kt | 0 .../data/repository/KeyguardStatusBarRepositoryImplTest.kt | 0 .../statusbar/data/repository/StatusBarModeRepositoryImplTest.kt | 0 .../systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt | 0 .../systemui/statusbar/disableflags/DisableStateTrackerTest.kt | 0 .../disableflags/data/repository/DisableFlagsRepositoryTest.kt | 0 .../src/com/android/systemui/statusbar/events/FakeStatusEvent.kt | 0 .../statusbar/events/SystemEventChipAnimationControllerTest.kt | 0 .../systemui/statusbar/events/SystemEventCoordinatorTest.kt | 0 .../statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt | 0 .../statusbar/notification/DynamicChildBindControllerTest.java | 0 .../statusbar/notification/DynamicPrivacyControllerTest.java | 0 .../notification/NotificationWakeUpCoordinatorLoggerTest.kt | 0 .../statusbar/notification/NotificationWakeUpCoordinatorTest.kt | 0 .../notification/collection/HighPriorityProviderTest.java | 0 .../statusbar/notification/collection/NoManSimulator.java | 0 .../statusbar/notification/collection/NotifLiveDataImplTest.kt | 0 .../notification/collection/NotifLiveDataStoreImplTest.kt | 0 .../statusbar/notification/collection/NotifLiveDataStoreMocks.kt | 0 .../notification/collection/NotifPipelineChoreographerTest.kt | 0 .../statusbar/notification/collection/SectionStyleProviderTest.kt | 0 .../notification/collection/coalescer/GroupCoalescerTest.java | 0 .../collection/coordinator/ColorizedFgsCoordinatorTest.java | 0 .../collection/coordinator/DeviceProvisionedCoordinatorTest.java | 0 .../collection/coordinator/DismissibilityCoordinatorTest.kt | 0 .../notification/collection/coordinator/DreamCoordinatorTest.kt | 0 .../collection/coordinator/GroupCountCoordinatorTest.kt | 0 .../collection/coordinator/GroupWhenCoordinatorTest.kt | 0 .../notification/collection/coordinator/GutsCoordinatorTest.kt | 0 .../notification/collection/coordinator/HeadsUpCoordinatorTest.kt | 0 .../coordinator/HideNotifsForOtherUsersCoordinatorTest.java | 0 .../collection/coordinator/KeyguardCoordinatorTest.kt | 0 .../notification/collection/coordinator/MediaCoordinatorTest.java | 0 .../coordinator/NotificationStatsLoggerCoordinatorTest.kt | 0 .../collection/coordinator/PreparationCoordinatorTest.java | 0 .../collection/coordinator/RankingCoordinatorTest.java | 0 .../collection/coordinator/RemoteInputCoordinatorTest.kt | 0 .../collection/coordinator/RowAlertTimeCoordinatorTest.kt | 0 .../collection/coordinator/SensitiveContentCoordinatorTest.kt | 0 .../collection/coordinator/SmartspaceDedupingCoordinatorTest.kt | 0 .../collection/inflation/NotifUiAdjustmentProviderTest.kt | 0 .../notification/collection/listbuilder/SemiStableSortTest.kt | 0 .../collection/listbuilder/ShadeListBuilderHelperTest.kt | 0 .../notifcollection/NotifCollectionInconsistencyTrackerTest.kt | 0 .../notifcollection/SelfTrackingLifetimeExtenderTest.kt | 0 .../collection/provider/VisualStabilityProviderTest.kt | 0 .../notification/collection/render/FakeNodeController.kt | 0 .../notification/collection/render/NodeSpecBuilderTest.kt | 0 .../notification/collection/render/RenderStageManagerTest.kt | 0 .../notification/collection/render/ShadeViewDifferTest.kt | 0 .../domain/interactor/NotificationAlertsInteractorTest.kt | 0 .../interactor/NotificationLaunchAnimationInteractorTest.kt | 0 .../domain/interactor/NotificationsKeyguardInteractorTest.kt | 0 .../domain/interactor/RenderNotificationsListInteractorTest.kt | 0 .../icon/domain/interactor/NotificationIconsInteractorTest.kt | 0 .../NotificationIconContainerAlwaysOnDisplayViewModelTest.kt | 0 .../notification/interruption/HeadsUpViewBinderTest.java | 0 .../interruption/KeyguardNotificationVisibilityProviderTest.java | 0 .../interruption/VisualInterruptionDecisionProviderTestBase.kt | 0 .../interruption/VisualInterruptionDecisionProviderTestUtil.kt | 0 .../statusbar/notification/logging/ExpansionStateLoggerTest.java | 0 .../notification/logging/NotificationPanelLoggerFake.java | 0 .../statusbar/notification/row/ActivatableNotificationViewTest.kt | 0 .../notification/row/ExpandableNotificationRowControllerTest.kt | 0 .../systemui/statusbar/notification/row/FeedbackInfoTest.java | 0 .../statusbar/notification/row/HeadsUpStyleProviderImplTest.kt | 0 .../statusbar/notification/row/NotifBindPipelineTest.java | 0 .../statusbar/notification/row/NotifInflationErrorManagerTest.kt | 0 .../statusbar/notification/row/NotifRemoteViewCacheImplTest.java | 0 .../systemui/statusbar/notification/row/NotificationGutsTest.kt | 0 .../systemui/statusbar/notification/row/NotificationInfoTest.java | 0 .../notification/row/NotificationInlineImageResolverTest.java | 0 .../statusbar/notification/row/NotificationMenuRowTest.java | 0 .../statusbar/notification/row/NotificationSnoozeTest.java | 0 .../statusbar/notification/row/PartialConversationInfoTest.java | 0 .../statusbar/notification/row/RowContentBindStageTest.java | 0 .../row/ui/viewmodel/ActivatableNotificationViewModelTest.kt | 0 .../row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt | 0 .../statusbar/notification/shared/TestActiveNotificationModel.kt | 0 .../shelf/domain/interactor/NotificationShelfInteractorTest.kt | 0 .../shelf/ui/viewmodel/NotificationShelfViewModelTest.kt | 0 .../systemui/statusbar/notification/stack/AmbientStateTest.kt | 0 .../stack/DisplaySwitchNotificationsHiderTrackerTest.kt | 0 .../statusbar/notification/stack/MediaContainerViewTest.kt | 0 .../statusbar/notification/stack/NotificationShelfTest.kt | 0 .../notification/stack/NotificationStackSizeCalculatorTest.kt | 0 .../statusbar/notification/stack/NotificationSwipeHelperTest.java | 0 .../statusbar/notification/stack/StackScrollAlgorithmTest.kt | 0 .../statusbar/notification/stack/StackStateAnimatorTest.kt | 0 .../systemui/statusbar/notification/stack/ViewStateTest.kt | 0 .../stack/domain/interactor/HideNotificationsInteractorTest.kt | 0 .../stack/domain/interactor/NotificationStackInteractorTest.kt | 0 .../stack/ui/viewmodel/NotificationLoggerViewModelTest.kt | 0 .../systemui/statusbar/phone/BiometricsUnlockControllerTest.java | 0 .../statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java | 0 .../systemui/statusbar/phone/ConfigurationControllerImplTest.kt | 0 .../com/android/systemui/statusbar/phone/DozeParametersTest.java | 0 .../android/systemui/statusbar/phone/DozeScrimControllerTest.java | 0 .../systemui/statusbar/phone/KeyguardBypassControllerTest.kt | 0 .../android/systemui/statusbar/phone/KeyguardDismissUtilTest.java | 0 .../systemui/statusbar/phone/KeyguardIndicationTextViewTest.java | 0 .../statusbar/phone/KeyguardStatusBarViewControllerTest.java | 0 .../systemui/statusbar/phone/KeyguardStatusBarViewTest.java | 0 .../statusbar/phone/LegacyLightsOutNotifControllerTest.java | 0 .../systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt | 0 .../systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt | 0 .../android/systemui/statusbar/phone/LightBarControllerTest.java | 0 .../statusbar/phone/LightBarTransitionsControllerTest.java | 0 .../systemui/statusbar/phone/ManagedProfileControllerImplTest.kt | 0 .../systemui/statusbar/phone/NotificationGroupTestHelper.java | 0 .../systemui/statusbar/phone/NotificationIconContainerTest.kt | 0 .../systemui/statusbar/phone/NotificationTapHelperTest.java | 0 .../android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt | 0 .../statusbar/phone/StatusBarNotificationPresenterTest.java | 0 .../statusbar/phone/StatusBarRemoteInputCallbackTest.java | 0 .../statusbar/phone/StatusBarTouchableRegionManagerTest.kt | 0 .../systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt | 0 .../systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt | 0 .../statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt | 0 .../statusbar/phone/domain/interactor/LightsOutInteractorTest.kt | 0 .../phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt | 0 .../statusbar/phone/fragment/StatusBarVisibilityModelTest.kt | 0 .../phone/ongoingcall/OngoingCallControllerViaListenerTest.kt | 0 .../phone/ongoingcall/OngoingCallControllerViaRepoTest.kt | 0 .../ongoingcall/data/repository/OngoingCallRepositoryTest.kt | 0 .../com/android/systemui/statusbar/phone/ui/IconManagerTest.kt | 0 .../statusbar/phone/ui/StatusBarIconControllerImplTest.kt | 0 .../systemui/statusbar/phone/ui/StatusBarIconControllerTest.java | 0 .../systemui/statusbar/phone/ui/StatusBarIconListTest.java | 0 .../airplane/data/repository/AirplaneModeRepositoryImplTest.kt | 0 .../statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt | 0 .../mobile/data/repository/prod/MobileTelephonyHelpers.kt | 0 .../systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt | 0 .../pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt | 0 .../satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt | 0 .../satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt | 0 .../satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt | 0 .../satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt | 0 .../pipeline/shared/data/model/DefaultConnectionModelTest.kt | 0 .../statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt | 0 .../shared/ui/view/SingleBindableStatusBarIconViewTest.kt | 0 .../shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt | 0 .../systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt | 0 .../systemui/statusbar/policy/BlockingQueueIntentReceiver.java | 0 .../systemui/statusbar/policy/BluetoothControllerImplTest.java | 0 .../android/systemui/statusbar/policy/CastControllerImplTest.java | 0 .../src/com/android/systemui/statusbar/policy/ClockTest.kt | 0 .../systemui/statusbar/policy/DevicePostureControllerImplTest.kt | 0 .../statusbar/policy/DeviceProvisionedControllerImplTest.kt | 0 .../systemui/statusbar/policy/ExtensionControllerImplTest.java | 0 .../systemui/statusbar/policy/HotspotControllerImplTest.java | 0 .../statusbar/policy/KeyguardQsUserSwitchControllerTest.kt | 0 .../systemui/statusbar/policy/KeyguardStateControllerTest.java | 0 .../systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt | 0 .../statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt | 0 .../com/android/systemui/statusbar/policy/SafetyControllerTest.kt | 0 .../systemui/statusbar/policy/SmartReplyConstantsTest.java | 0 .../systemui/statusbar/policy/ZenModeControllerImplTest.java | 0 .../statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt | 0 .../statusbar/policy/bluetooth/FakeBluetoothRepository.kt | 0 .../data/repository/DeviceProvisioningRepositoryImplTest.kt | 0 .../statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt | 0 .../statusbar/window/StatusBarWindowStateControllerTest.kt | 0 .../src/com/android/systemui/stylus/FixedCapacityBatteryState.kt | 0 .../systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt | 0 .../systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt | 0 .../systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt | 0 .../android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt | 0 .../android/systemui/surfaceeffects/ripple/RippleShaderTest.kt | 0 .../com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt | 0 .../systemui/surfaceeffects/shaders/SolidColorShaderTest.kt | 0 .../android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt | 0 .../turbulencenoise/TurbulenceNoiseControllerTest.kt | 0 .../surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt | 0 .../surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt | 0 .../domain/interactor/HeadsUpNotificationInteractorTest.kt | 0 .../{ => utils}/src/com/android/keyguard/TestScopeProvider.kt | 0 .../com/android/systemui/statusbar/NotificationEntryHelper.java | 0 268 files changed, 0 insertions(+), 0 deletions(-) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenrecord/RecordingServiceTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/FakeImageCapture.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/RecyclerViewActivity.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/ScreenshotDataTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/policy/TestUserIds.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/scrim/ScrimViewTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/ConstraintChangeTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/ConstraintChangesTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/PulsingGestureListenerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/ShadeControllerImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/condition/ConditionMonitorTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/condition/ConditionTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/condition/FakeCondition.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/plugins/PluginManagerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/plugins/VersionInfoTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/BlurUtilsTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/DragDownHelperTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/NotificationListenerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/SmartReplyControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/VibratorHelperTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/commandline/ParametersTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/DozeParametersTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/ClockTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt (100%) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt (100%) rename packages/SystemUI/tests/{ => utils}/src/com/android/keyguard/TestScopeProvider.kt (100%) rename packages/SystemUI/tests/{ => utils}/src/com/android/systemui/statusbar/NotificationEntryHelper.java (100%) diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/RecordingServiceTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/RecordingServiceTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenrecord/RecordingServiceTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/RecordingServiceTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/FakeImageCapture.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/FakeImageCapture.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/FakeImageCapture.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/FakeImageCapture.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/RecyclerViewActivity.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/RecyclerViewActivity.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/RecyclerViewActivity.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/RecyclerViewActivity.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/TestUserIds.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/TestUserIds.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/TestUserIds.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/TestUserIds.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/scrim/ScrimViewTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/scrim/ScrimViewTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/scrim/ScrimViewTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/scrim/ScrimViewTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/ConstraintChangeTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ConstraintChangeTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/ConstraintChangeTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ConstraintChangeTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/ConstraintChangesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ConstraintChangesTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/ConstraintChangesTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ConstraintChangesTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/PulsingGestureListenerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/PulsingGestureListenerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/PulsingGestureListenerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/PulsingGestureListenerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeControllerImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeControllerImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/condition/FakeCondition.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/FakeCondition.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/condition/FakeCondition.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/FakeCondition.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginManagerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/plugins/PluginManagerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginManagerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/plugins/PluginManagerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/VersionInfoTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/plugins/VersionInfoTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/plugins/VersionInfoTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/plugins/VersionInfoTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/BlurUtilsTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/BlurUtilsTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/BlurUtilsTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/BlurUtilsTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/DragDownHelperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/DragDownHelperTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/DragDownHelperTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/DragDownHelperTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationListenerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationListenerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/VibratorHelperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/VibratorHelperTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/VibratorHelperTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/VibratorHelperTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ParametersTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ParametersTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ParametersTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ParametersTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ClockTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ClockTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ClockTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ClockTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt diff --git a/packages/SystemUI/tests/src/com/android/keyguard/TestScopeProvider.kt b/packages/SystemUI/tests/utils/src/com/android/keyguard/TestScopeProvider.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/keyguard/TestScopeProvider.kt rename to packages/SystemUI/tests/utils/src/com/android/keyguard/TestScopeProvider.kt diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryHelper.java b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/NotificationEntryHelper.java similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryHelper.java rename to packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/NotificationEntryHelper.java -- GitLab From fee2fdfde9db29737ed6220d5966ae118c2453ce Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Mon, 9 Sep 2024 20:58:46 +0800 Subject: [PATCH 172/492] Catalyst framework integration Bug: 335132588 Flag: com.android.settingslib.flags.settings_catalyst Test: Presubmit Change-Id: I3bff53074e2de5d88889f7f42848402a38bcda03 --- packages/SettingsLib/Android.bp | 2 ++ packages/SettingsLib/Preference/Android.bp | 1 + .../android/settingslib/preference/PreferenceFragment.kt | 2 +- .../core/lifecycle/ObservablePreferenceFragment.java | 7 ++++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/SettingsLib/Android.bp b/packages/SettingsLib/Android.bp index 0cb85d8638b0..b997c35668d2 100644 --- a/packages/SettingsLib/Android.bp +++ b/packages/SettingsLib/Android.bp @@ -42,6 +42,8 @@ android_library { "SettingsLibIllustrationPreference", "SettingsLibLayoutPreference", "SettingsLibMainSwitchPreference", + "SettingsLibMetadata", + "SettingsLibPreference", "SettingsLibProfileSelector", "SettingsLibProgressBar", "SettingsLibRestrictedLockUtils", diff --git a/packages/SettingsLib/Preference/Android.bp b/packages/SettingsLib/Preference/Android.bp index 9665dbd17e2d..17852e8e7ece 100644 --- a/packages/SettingsLib/Preference/Android.bp +++ b/packages/SettingsLib/Preference/Android.bp @@ -18,6 +18,7 @@ android_library { "SettingsLibMetadata", "androidx.annotation_annotation", "androidx.preference_preference", + "guava", ], kotlincflags: ["-Xjvm-default=all"], } diff --git a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceFragment.kt b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceFragment.kt index 207200998b05..68f640bbb9b4 100644 --- a/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceFragment.kt +++ b/packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceFragment.kt @@ -79,7 +79,7 @@ open class PreferenceFragment : * This is for flagging purpose. If false (e.g. flag is disabled), xml resource is used to build * preference screen. */ - protected open fun usePreferenceScreenMetadata(): Boolean = true + protected open fun usePreferenceScreenMetadata(): Boolean = false /** Returns the xml resource to create preference screen. */ @XmlRes protected open fun getPreferenceScreenResId(context: Context): Int = 0 diff --git a/packages/SettingsLib/src/com/android/settingslib/core/lifecycle/ObservablePreferenceFragment.java b/packages/SettingsLib/src/com/android/settingslib/core/lifecycle/ObservablePreferenceFragment.java index bd1e5a588968..79949248cd8a 100644 --- a/packages/SettingsLib/src/com/android/settingslib/core/lifecycle/ObservablePreferenceFragment.java +++ b/packages/SettingsLib/src/com/android/settingslib/core/lifecycle/ObservablePreferenceFragment.java @@ -31,13 +31,14 @@ import android.view.MenuInflater; import android.view.MenuItem; import androidx.lifecycle.LifecycleOwner; -import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceScreen; +import com.android.settingslib.preference.PreferenceFragment; + /** - * {@link PreferenceFragmentCompat} that has hooks to observe fragment lifecycle events. + * Preference fragment that has hooks to observe fragment lifecycle events. */ -public abstract class ObservablePreferenceFragment extends PreferenceFragmentCompat +public abstract class ObservablePreferenceFragment extends PreferenceFragment implements LifecycleOwner { private final Lifecycle mLifecycle = new Lifecycle(this); -- GitLab From d62230abcf2c78a7ffe69a899694796f7ed78e71 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 10 Sep 2024 15:31:11 +0800 Subject: [PATCH 173/492] Use display of parent window if available In case the app uses attrs.token on display 2 but the context is display 1. E.g. var wm = display1Context.getSystemService(WindowManager) wm.addView(paramForDisplay2) Then attrs.token should have a higher priority to choose the target display. Otherwise the add-window will fail because it tries to find the display2 window from display1. Note that getDisplayContentOrCreate only accepts token that maps to a WindowToken. e.g. from ActivityRecord.Token (Activity#getActivityToken) -> ActivityRecord (extends WindowToken) or IBinder -> WindowToken So if the given attrs.token specifies View#getWindowToken (sub-window), it won't be able to find the corresponding WindowToken from DisplayContent#mTokenMap. The View#getWindowToken is the IWindow of ViewRootImpl. So it can be found from WMS#mWindowMap (IWindow -> WindowState). Then it is enough to know the target display even if the given display id is wrong. Bug: 338376012 Flag: EXEMPT bugfix Test: atest WindowManagerServiceTests# \ testAddWindowWithSubWindowTypeByWindowContext Change-Id: I992389c089d7401cf42a981227b51e92bc7c3436 --- .../server/wm/WindowManagerService.java | 33 ++++++++++--------- .../server/wm/WindowManagerServiceTests.java | 8 +++++ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index fb57a1bb94c1..e16ff4bb8945 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -1545,7 +1545,23 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_APP_EXITING; } - final DisplayContent displayContent = getDisplayContentOrCreate(displayId, attrs.token); + if (type >= FIRST_SUB_WINDOW && type <= LAST_SUB_WINDOW) { + parentWindow = windowForClientLocked(null, attrs.token, false); + if (parentWindow == null) { + ProtoLog.w(WM_ERROR, "Attempted to add window with token that is not a window: " + + "%s. Aborting.", attrs.token); + return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; + } + if (parentWindow.mAttrs.type >= FIRST_SUB_WINDOW + && parentWindow.mAttrs.type <= LAST_SUB_WINDOW) { + ProtoLog.w(WM_ERROR, "Attempted to add window with token that is a sub-window: " + + "%s. Aborting.", attrs.token); + return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; + } + } + final DisplayContent displayContent = parentWindow != null + ? parentWindow.mDisplayContent + : getDisplayContentOrCreate(displayId, attrs.token); if (displayContent == null) { ProtoLog.w(WM_ERROR, "Attempted to add window to a display that does " @@ -1565,21 +1581,6 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_DUPLICATE_ADD; } - if (type >= FIRST_SUB_WINDOW && type <= LAST_SUB_WINDOW) { - parentWindow = windowForClientLocked(null, attrs.token, false); - if (parentWindow == null) { - ProtoLog.w(WM_ERROR, "Attempted to add window with token that is not a window: " - + "%s. Aborting.", attrs.token); - return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; - } - if (parentWindow.mAttrs.type >= FIRST_SUB_WINDOW - && parentWindow.mAttrs.type <= LAST_SUB_WINDOW) { - ProtoLog.w(WM_ERROR, "Attempted to add window with token that is a sub-window: " - + "%s. Aborting.", attrs.token); - return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; - } - } - if (type == TYPE_PRESENTATION || type == TYPE_PRIVATE_PRESENTATION) { mDisplayManagerInternal.onPresentation(displayContent.getDisplay().getDisplayId(), /*isShown=*/ true); diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java index 916c2373ac97..6111a658a048 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java @@ -554,6 +554,14 @@ public class WindowManagerServiceTests extends WindowTestsBase { verify(mWm.mWindowContextListenerController, never()).registerWindowContainerListener(any(), any(), any(), anyInt(), any(), anyBoolean()); + // Even if the given display id is INVALID_DISPLAY, the specified params.token should be + // able to map the corresponding display. + final int result = mWm.addWindow( + session, new TestIWindow(), params, View.VISIBLE, INVALID_DISPLAY, + UserHandle.USER_SYSTEM, WindowInsets.Type.defaultVisible(), null, new InsetsState(), + new InsetsSourceControl.Array(), new Rect(), new float[1]); + assertThat(result).isAtLeast(WindowManagerGlobal.ADD_OKAY); + assertTrue(parentWin.hasChild()); assertTrue(parentWin.isAttached()); session.binderDied(); -- GitLab From 16afc6f456afc8b90b2e4e44c873bad63b083cd6 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 10 Sep 2024 08:44:15 +0000 Subject: [PATCH 174/492] Arrow down navigates from search bar in shortcut helper Fixes: 363257904 Flag: com.android.systemui.keyboard_shortcut_helper_rewrite Test: Manual - open shortcut helper, press down while focus is on the search bar, ensure focus moves to the next focusable element down. Change-Id: I5d4ce4536e5a7f8f2f6b8bcc5f3d21a08b14bece --- .../shortcut/ui/composable/ShortcutHelper.kt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt index 63f3d52b2d2d..dcca12f29287 100644 --- a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt +++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt @@ -82,6 +82,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawWithContent +import androidx.compose.ui.focus.FocusDirection import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.geometry.CornerRadius @@ -92,8 +93,12 @@ import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.Shape import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.input.key.Key +import androidx.compose.ui.input.key.key +import androidx.compose.ui.input.key.onKeyEvent import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.rememberNestedScrollInteropConnection import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource @@ -824,9 +829,18 @@ private fun ShortcutsSearchBar(onQueryChange: (String) -> Unit) { // from the ViewModel. var queryInternal by remember { mutableStateOf("") } val focusRequester = remember { FocusRequester() } + val focusManager = LocalFocusManager.current LaunchedEffect(Unit) { focusRequester.requestFocus() } SearchBar( - modifier = Modifier.fillMaxWidth().focusRequester(focusRequester), + modifier = + Modifier.fillMaxWidth().focusRequester(focusRequester).onKeyEvent { + if (it.key == Key.DirectionDown) { + focusManager.moveFocus(FocusDirection.Down) + return@onKeyEvent true + } else { + return@onKeyEvent false + } + }, colors = SearchBarDefaults.colors(containerColor = MaterialTheme.colorScheme.surfaceBright), query = queryInternal, active = false, -- GitLab From 0d226d69c4a5317931ccf9ecdbcec3c9ce0be4d0 Mon Sep 17 00:00:00 2001 From: burakov Date: Mon, 9 Sep 2024 14:07:37 +0000 Subject: [PATCH 175/492] [bc25] Update references to shade in WindowRootViewVisibilityInteractor. Bug: 356596436 Flag: com.android.systemui.scene_container Flag: com.android.systemui.dual_shade Test: Existing unit tests still pass. Change-Id: I6160c404c34a160a18677cd3a80904e27f58842e --- .../WindowRootViewVisibilityInteractor.kt | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/WindowRootViewVisibilityInteractor.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/WindowRootViewVisibilityInteractor.kt index 738b18495f3f..e477efe0808e 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/WindowRootViewVisibilityInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/WindowRootViewVisibilityInteractor.kt @@ -25,6 +25,7 @@ import com.android.systemui.keyguard.shared.model.StatusBarState import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.scene.data.repository.WindowRootViewVisibilityRepository import com.android.systemui.scene.shared.flag.SceneContainerFlag +import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.NotificationPresenter import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor @@ -34,6 +35,7 @@ import com.android.systemui.statusbar.policy.HeadsUpManager import javax.inject.Inject import javax.inject.Provider import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine @@ -45,6 +47,7 @@ import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch /** Business logic about the visibility of various parts of the window root view. */ +@OptIn(ExperimentalCoroutinesApi::class) @SysUISingleton class WindowRootViewVisibilityInteractor @Inject @@ -80,9 +83,9 @@ constructor( is ObservableTransitionState.Idle -> flowOf( state.currentScene == Scenes.Shade || - state.currentScene == Scenes.NotificationsShade || - state.currentScene == Scenes.QuickSettingsShade || - state.currentScene == Scenes.Lockscreen + state.currentScene == Scenes.Lockscreen || + Overlays.NotificationsShade in state.currentOverlays || + Overlays.QuickSettingsShade in state.currentOverlays ) is ObservableTransitionState.Transition -> if ( @@ -94,12 +97,12 @@ constructor( } else { flowOf( state.toContent == Scenes.Shade || - state.toContent == Scenes.NotificationsShade || - state.toContent == Scenes.QuickSettingsShade || + state.toContent == Overlays.NotificationsShade || + state.toContent == Overlays.QuickSettingsShade || state.toContent == Scenes.Lockscreen || state.fromContent == Scenes.Shade || - state.fromContent == Scenes.NotificationsShade || - state.fromContent == Scenes.QuickSettingsShade || + state.fromContent == Overlays.NotificationsShade || + state.fromContent == Overlays.QuickSettingsShade || state.fromContent == Scenes.Lockscreen ) } @@ -115,10 +118,9 @@ constructor( * false if the device is asleep. */ val isLockscreenOrShadeVisibleAndInteractive: StateFlow = - combine( - isLockscreenOrShadeVisible, - powerInteractor.isAwake, - ) { isKeyguardAodOrShadeVisible, isAwake -> + combine(isLockscreenOrShadeVisible, powerInteractor.isAwake) { + isKeyguardAodOrShadeVisible, + isAwake -> isKeyguardAodOrShadeVisible && isAwake } .stateIn(scope, SharingStarted.Eagerly, initialValue = false) -- GitLab From aa185919f72b8d33749954d27c3ccb645c2ecd7d Mon Sep 17 00:00:00 2001 From: burakov Date: Mon, 9 Sep 2024 14:03:43 +0000 Subject: [PATCH 176/492] [bc25] Replace references to deprecated shade scenes in ScrimStartable. Bug: 356596436 Flag: com.android.systemui.scene_container Flag: com.android.systemui.dual_shade Test: Existing unit tests still pass. Change-Id: I1918ed6f2d9b757ac5019847cd5f4ebe9664c875 --- .../scene/domain/startable/ScrimStartable.kt | 70 +++++++++++-------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/ScrimStartable.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/ScrimStartable.kt index d1629c799732..e352bfe938f6 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/ScrimStartable.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/ScrimStartable.kt @@ -19,7 +19,9 @@ package com.android.systemui.scene.domain.startable import androidx.annotation.VisibleForTesting +import com.android.compose.animation.scene.ContentKey import com.android.compose.animation.scene.ObservableTransitionState +import com.android.compose.animation.scene.OverlayKey import com.android.compose.animation.scene.SceneKey import com.android.systemui.CoreStartable import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor @@ -33,6 +35,7 @@ import com.android.systemui.keyguard.shared.model.BiometricUnlockModel import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag +import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.settings.brightness.domain.interactor.BrightnessMirrorShowingInteractor import com.android.systemui.statusbar.phone.DozeServiceHost @@ -74,6 +77,7 @@ constructor( deviceEntryInteractor.isDeviceEntered, occlusionInteractor.invisibleDueToOcclusion, sceneInteractor.currentScene, + sceneInteractor.currentOverlays, sceneInteractor.transitionState, keyguardInteractor.isDozing, keyguardInteractor.isDreaming, @@ -95,34 +99,29 @@ constructor( val isDeviceEntered = flowValues[0] as Boolean val isOccluded = flowValues[1] as Boolean val currentScene = flowValues[2] as SceneKey - val transitionState = flowValues[3] as ObservableTransitionState - val isDozing = flowValues[4] as Boolean - val isDreaming = flowValues[5] as Boolean - val biometricUnlockState = flowValues[6] as BiometricUnlockModel - val isBrightnessMirrorVisible = flowValues[7] as Boolean - val isPulsing = flowValues[8] as Boolean - val hasPendingScreenOffCallback = flowValues[9] as Boolean + val currentOverlays = flowValues[3] as Set + val transitionState = flowValues[4] as ObservableTransitionState + val isDozing = flowValues[5] as Boolean + val isDreaming = flowValues[6] as Boolean + val biometricUnlockState = flowValues[7] as BiometricUnlockModel + val isBrightnessMirrorVisible = flowValues[8] as Boolean + val isPulsing = flowValues[9] as Boolean + val hasPendingScreenOffCallback = flowValues[10] as Boolean // This is true when the lockscreen scene is either the current scene or somewhere - // in the - // navigation back stack of scenes. + // in the navigation back stack of scenes. val isOnKeyguard = !isDeviceEntered val isCurrentSceneBouncer = currentScene == Scenes.Bouncer // This is true when moving away from one of the keyguard scenes to the gone scene. - // It - // happens only when unlocking or when dismissing a dismissible lockscreen. + // It happens only when unlocking or when dismissing a dismissible lockscreen. val isTransitioningAwayFromKeyguard = transitionState is ObservableTransitionState.Transition.ChangeScene && transitionState.fromScene.isKeyguard() && transitionState.toScene == Scenes.Gone - // This is true when any of the shade scenes is the current scene. - val isCurrentSceneShade = currentScene.isShade() - // This is true when moving into one of the shade scenes when a non-shade scene. - val isTransitioningToShade = - transitionState is ObservableTransitionState.Transition.ChangeScene && - !transitionState.fromScene.isShade() && - transitionState.toScene.isShade() + // This is true when any of the shade scenes or overlays is the current content. + val isCurrentContentShade = + currentScene.isShade() || currentOverlays.any { it.isShade() } // This is true after completing a transition to communal. val isIdleOnCommunal = transitionState.isIdle(Scenes.Communal) @@ -137,10 +136,10 @@ constructor( if (alternateBouncerInteractor.isVisibleState()) { // This will cancel the keyguardFadingAway animation if it is running. We need - // to do - // this as otherwise it can remain pending and leave keyguard in a weird state. + // to do this as otherwise it can remain pending and leave keyguard in a weird + // state. onKeyguardFadedAway(isTransitioningAwayFromKeyguard) - if (!isTransitioningToShade) { + if (!transitionState.isTransitioningToShade()) { // Safeguard which prevents the scrim from being stuck in the wrong // state Model(scrimState = ScrimState.KEYGUARD, unlocking = unlocking) @@ -163,7 +162,7 @@ constructor( ) } else if (isBrightnessMirrorVisible) { Model(scrimState = ScrimState.BRIGHTNESS_MIRROR, unlocking = unlocking) - } else if (isCurrentSceneShade && !isDeviceEntered) { + } else if (isCurrentContentShade && !isDeviceEntered) { Model(scrimState = ScrimState.SHADE_LOCKED, unlocking = unlocking) } else if (isPulsing) { Model(scrimState = ScrimState.PULSING, unlocking = unlocking) @@ -171,8 +170,8 @@ constructor( Model(scrimState = ScrimState.OFF, unlocking = unlocking) } else if (isDozing && !unlocking) { // This will cancel the keyguardFadingAway animation if it is running. We need - // to do - // this as otherwise it can remain pending and leave keyguard in a weird state. + // to do this as otherwise it can remain pending and leave keyguard in a weird + // state. onKeyguardFadedAway(isTransitioningAwayFromKeyguard) Model(scrimState = ScrimState.AOD, unlocking = false) } else if (isIdleOnCommunal) { @@ -222,15 +221,24 @@ constructor( return this == Scenes.Lockscreen || this == Scenes.Bouncer } - private fun SceneKey.isShade(): Boolean { + private fun ContentKey.isShade(): Boolean { return this == Scenes.Shade || this == Scenes.QuickSettings || - this == Scenes.NotificationsShade || - this == Scenes.QuickSettingsShade + this == Overlays.NotificationsShade || + this == Overlays.QuickSettingsShade + } + + private fun ObservableTransitionState.isTransitioningToShade(): Boolean { + return when (this) { + is ObservableTransitionState.Idle -> false + is ObservableTransitionState.Transition.ChangeScene -> + !fromScene.isShade() && toScene.isShade() + is ObservableTransitionState.Transition.ReplaceOverlay -> + !fromOverlay.isShade() && toOverlay.isShade() + is ObservableTransitionState.Transition.ShowOrHideOverlay -> + !fromContent.isShade() && toContent.isShade() + } } - private data class Model( - val scrimState: ScrimState, - val unlocking: Boolean, - ) + private data class Model(val scrimState: ScrimState, val unlocking: Boolean) } -- GitLab From be8b7c49a241b6c42930ab4cea892c5fe57844fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20M=C3=BCtschard?= Date: Tue, 10 Sep 2024 09:16:03 +0000 Subject: [PATCH 177/492] Fix namespace for the jank flags. Flag: com.android.internal.jank.use_sf_frame_duration Change-Id: I68ecedb8da7d485ae1001b3fd6db1cd0b599a753 --- core/java/com/android/internal/jank/flags.aconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/com/android/internal/jank/flags.aconfig b/core/java/com/android/internal/jank/flags.aconfig index b6b8bc5ac44c..82f50ae848b3 100644 --- a/core/java/com/android/internal/jank/flags.aconfig +++ b/core/java/com/android/internal/jank/flags.aconfig @@ -3,7 +3,7 @@ container: "system" flag { name: "use_sf_frame_duration" - namespace: "android_platform_window_surfaces" + namespace: "window_surfaces" description: "Whether to get the frame duration from SurfaceFlinger, or HWUI" bug: "354763298" is_fixed_read_only: true -- GitLab From dee1fb24a829d2e2c9bb75946ebf8befade4fad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Hern=C3=A1ndez?= Date: Tue, 10 Sep 2024 12:11:37 +0200 Subject: [PATCH 178/492] Fix "copy constructor" in TestModeBuilder The AZR instance was shared between the original ZenMode and the new one. Since it's not immutable, any further changes would affect both modes. Bug: 361592187 Test: atest AutoDarkThemeTest Flag: EXEMPT Fixing test utility Change-Id: I03f4bbb8129da04f136d2ae791ba30d136bb13a7 --- .../android/settingslib/notification/modes/TestModeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/notification/modes/TestModeBuilder.java b/packages/SettingsLib/src/com/android/settingslib/notification/modes/TestModeBuilder.java index 8e0cdf8109de..712ddc8aea4b 100644 --- a/packages/SettingsLib/src/com/android/settingslib/notification/modes/TestModeBuilder.java +++ b/packages/SettingsLib/src/com/android/settingslib/notification/modes/TestModeBuilder.java @@ -85,7 +85,7 @@ public class TestModeBuilder { public TestModeBuilder(ZenMode previous) { mId = previous.getId(); - mRule = previous.getRule(); + mRule = new AutomaticZenRule.Builder(previous.getRule()).build(); mConfigZenRule = new ZenModeConfig.ZenRule(); mConfigZenRule.enabled = previous.getRule().isEnabled(); -- GitLab From ee8ce38e1a07c8cbd220a514fde1adebad5ca9fa Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Tue, 13 Aug 2024 16:26:07 +0100 Subject: [PATCH 179/492] Export art-aconfig-flags Needed to use the always_enable_profile_code in the frameworks Bug: 352518093 Test: treehugger Change-Id: Id5a6017a8dac9f327b80fd4c1c0da5a6b9e20ba1 --- AconfigFlags.bp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AconfigFlags.bp b/AconfigFlags.bp index 96d6f32fc1df..b8eda85617f4 100644 --- a/AconfigFlags.bp +++ b/AconfigFlags.bp @@ -74,6 +74,7 @@ aconfig_declarations_group { "android.view.inputmethod.flags-aconfig-java", "android.webkit.flags-aconfig-java", "android.widget.flags-aconfig-java", + "art_exported_aconfig_flags_lib", "backstage_power_flags_lib", "backup_flags_lib", "camera_platform_flags_core_java_lib", @@ -133,6 +134,14 @@ java_defaults { libs: ["fake_device_config"], } +// ART +java_aconfig_library { + name: "art_exported_aconfig_flags_lib", + aconfig_declarations: "art-aconfig-flags", + mode: "exported", + defaults: ["framework-minus-apex-aconfig-java-defaults"], +} + // Camera java_aconfig_library { name: "camera_platform_flags_core_java_lib", -- GitLab From e2cc267a14a4eccd54b9fe1f7d3c8d860ac80a4f Mon Sep 17 00:00:00 2001 From: "ELIYAZ MOMIN (xWF)" Date: Tue, 10 Sep 2024 10:30:57 +0000 Subject: [PATCH 180/492] Revert "[res] Better modification time resolution in Idmap" This reverts commit fff1d48f432741160019a9266728097f10bd2189. Reason for revert: Change-Id: I6b0a0bd67a14e4738a8cd64be2214840d02eee3f --- libs/androidfw/AssetManager.cpp | 32 +++++------ .../include/androidfw/AssetManager.h | 22 ++++---- libs/androidfw/include/androidfw/Idmap.h | 5 +- libs/androidfw/include/androidfw/misc.h | 35 +++--------- libs/androidfw/misc.cpp | 55 ++++++++----------- libs/androidfw/tests/Idmap_test.cpp | 11 +--- tools/aapt/Package.cpp | 11 ++-- 7 files changed, 66 insertions(+), 105 deletions(-) diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 5955915c9fcd..e6182454ad8a 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -1420,20 +1420,18 @@ void AssetManager::mergeInfoLocked(SortedVector* pMergedInfo Mutex AssetManager::SharedZip::gLock; DefaultKeyedVector > AssetManager::SharedZip::gOpen; -AssetManager::SharedZip::SharedZip(const String8& path, ModDate modWhen) - : mPath(path), - mZipFile(NULL), - mModWhen(modWhen), - mResourceTableAsset(NULL), - mResourceTable(NULL) { - if (kIsDebug) { - ALOGI("Creating SharedZip %p %s\n", this, mPath.c_str()); - } - ALOGV("+++ opening zip '%s'\n", mPath.c_str()); - mZipFile = ZipFileRO::open(mPath.c_str()); - if (mZipFile == NULL) { - ALOGD("failed to open Zip archive '%s'\n", mPath.c_str()); - } +AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen) + : mPath(path), mZipFile(NULL), mModWhen(modWhen), + mResourceTableAsset(NULL), mResourceTable(NULL) +{ + if (kIsDebug) { + ALOGI("Creating SharedZip %p %s\n", this, mPath.c_str()); + } + ALOGV("+++ opening zip '%s'\n", mPath.c_str()); + mZipFile = ZipFileRO::open(mPath.c_str()); + if (mZipFile == NULL) { + ALOGD("failed to open Zip archive '%s'\n", mPath.c_str()); + } } AssetManager::SharedZip::SharedZip(int fd, const String8& path) @@ -1455,7 +1453,7 @@ sp AssetManager::SharedZip::get(const String8& path, bool createIfNotPresent) { AutoMutex _l(gLock); - auto modWhen = getFileModDate(path.c_str()); + time_t modWhen = getFileModDate(path.c_str()); sp zip = gOpen.valueFor(path).promote(); if (zip != NULL && zip->mModWhen == modWhen) { return zip; @@ -1522,8 +1520,8 @@ ResTable* AssetManager::SharedZip::setResourceTable(ResTable* res) bool AssetManager::SharedZip::isUpToDate() { - auto modWhen = getFileModDate(mPath.c_str()); - return mModWhen == modWhen; + time_t modWhen = getFileModDate(mPath.c_str()); + return mModWhen == modWhen; } void AssetManager::SharedZip::addOverlay(const asset_path& ap) diff --git a/libs/androidfw/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h index 376c881ea376..ce0985b38986 100644 --- a/libs/androidfw/include/androidfw/AssetManager.h +++ b/libs/androidfw/include/androidfw/AssetManager.h @@ -280,21 +280,21 @@ private: ~SharedZip(); private: - SharedZip(const String8& path, ModDate modWhen); - SharedZip(int fd, const String8& path); - SharedZip(); // <-- not implemented + SharedZip(const String8& path, time_t modWhen); + SharedZip(int fd, const String8& path); + SharedZip(); // <-- not implemented - String8 mPath; - ZipFileRO* mZipFile; - ModDate mModWhen; + String8 mPath; + ZipFileRO* mZipFile; + time_t mModWhen; - Asset* mResourceTableAsset; - ResTable* mResourceTable; + Asset* mResourceTableAsset; + ResTable* mResourceTable; - Vector mOverlays; + Vector mOverlays; - static Mutex gLock; - static DefaultKeyedVector > gOpen; + static Mutex gLock; + static DefaultKeyedVector > gOpen; }; /* diff --git a/libs/androidfw/include/androidfw/Idmap.h b/libs/androidfw/include/androidfw/Idmap.h index 98f1aa86f2db..64b1f0c6ed03 100644 --- a/libs/androidfw/include/androidfw/Idmap.h +++ b/libs/androidfw/include/androidfw/Idmap.h @@ -25,9 +25,8 @@ #include "android-base/macros.h" #include "android-base/unique_fd.h" #include "androidfw/ConfigDescription.h" -#include "androidfw/ResourceTypes.h" #include "androidfw/StringPiece.h" -#include "androidfw/misc.h" +#include "androidfw/ResourceTypes.h" #include "utils/ByteOrder.h" namespace android { @@ -203,7 +202,7 @@ class LoadedIdmap { android::base::unique_fd idmap_fd_; std::string_view overlay_apk_path_; std::string_view target_apk_path_; - ModDate idmap_last_mod_time_; + time_t idmap_last_mod_time_; private: DISALLOW_COPY_AND_ASSIGN(LoadedIdmap); diff --git a/libs/androidfw/include/androidfw/misc.h b/libs/androidfw/include/androidfw/misc.h index 09ae40c35369..077609d20d55 100644 --- a/libs/androidfw/include/androidfw/misc.h +++ b/libs/androidfw/include/androidfw/misc.h @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#pragma once -#include +#include // // Handy utility functions and portability code. // +#ifndef _LIBS_ANDROID_FW_MISC_H +#define _LIBS_ANDROID_FW_MISC_H namespace android { @@ -40,35 +41,15 @@ typedef enum FileType { } FileType; /* get the file's type; follows symlinks */ FileType getFileType(const char* fileName); - -// MinGW doesn't support nanosecond resolution in stat() modification time, and given -// that it only matters on the device it's ok to keep it at the second level there. -#ifdef _WIN32 -using ModDate = time_t; -inline constexpr ModDate kInvalidModDate = ModDate(-1); -inline constexpr unsigned long long kModDateResolutionNs = 1ull * 1000 * 1000 * 1000; -inline time_t toTimeT(ModDate m) { - return m; -} -#else -using ModDate = timespec; -inline constexpr ModDate kInvalidModDate = {-1, -1}; -inline constexpr unsigned long long kModDateResolutionNs = 1; -inline time_t toTimeT(ModDate m) { - return m.tv_sec; -} -#endif - -/* get the file's modification date; returns kInvalidModDate w/errno set on failure */ -ModDate getFileModDate(const char* fileName); +/* get the file's modification date; returns -1 w/errno set on failure */ +time_t getFileModDate(const char* fileName); /* same, but also returns -1 if the file has already been deleted */ -ModDate getFileModDate(int fd); +time_t getFileModDate(int fd); // Check if |path| or |fd| resides on a readonly filesystem. bool isReadonlyFilesystem(const char* path); bool isReadonlyFilesystem(int fd); -} // namespace android +}; // namespace android -// Whoever uses getFileModDate() will need this as well -bool operator==(const timespec& l, const timespec& r); +#endif // _LIBS_ANDROID_FW_MISC_H diff --git a/libs/androidfw/misc.cpp b/libs/androidfw/misc.cpp index 9bdaf18a116a..93dcaf549a90 100644 --- a/libs/androidfw/misc.cpp +++ b/libs/androidfw/misc.cpp @@ -28,13 +28,11 @@ #include #endif // __linux__ +#include +#include #include #include -#include -#include -#include - namespace android { /* @@ -75,32 +73,27 @@ FileType getFileType(const char* fileName) } } -static ModDate getModDate(const struct stat& st) { -#ifdef _WIN32 - return st.st_mtime; -#else - return st.st_mtim; -#endif -} - -ModDate getFileModDate(const char* fileName) { - struct stat sb; - if (stat(fileName, &sb) < 0) { - return kInvalidModDate; - } - return getModDate(sb); +/* + * Get a file's modification date. + */ +time_t getFileModDate(const char* fileName) { + struct stat sb; + if (stat(fileName, &sb) < 0) { + return (time_t)-1; + } + return sb.st_mtime; } -ModDate getFileModDate(int fd) { - struct stat sb; - if (fstat(fd, &sb) < 0) { - return kInvalidModDate; - } - if (sb.st_nlink <= 0) { - errno = ENOENT; - return kInvalidModDate; - } - return getModDate(sb); +time_t getFileModDate(int fd) { + struct stat sb; + if (fstat(fd, &sb) < 0) { + return (time_t)-1; + } + if (sb.st_nlink <= 0) { + errno = ENOENT; + return (time_t)-1; + } + return sb.st_mtime; } #ifndef __linux__ @@ -131,8 +124,4 @@ bool isReadonlyFilesystem(int fd) { } #endif // __linux__ -} // namespace android - -bool operator==(const timespec& l, const timespec& r) { - return std::tie(l.tv_sec, l.tv_nsec) == std::tie(r.tv_sec, l.tv_nsec); -} +}; // namespace android diff --git a/libs/androidfw/tests/Idmap_test.cpp b/libs/androidfw/tests/Idmap_test.cpp index cb2e56f5f5e4..60aa7d88925d 100644 --- a/libs/androidfw/tests/Idmap_test.cpp +++ b/libs/androidfw/tests/Idmap_test.cpp @@ -14,9 +14,6 @@ * limitations under the License. */ -#include -#include - #include "android-base/file.h" #include "androidfw/ApkAssets.h" #include "androidfw/AssetManager2.h" @@ -30,7 +27,6 @@ #include "data/overlayable/R.h" #include "data/system/R.h" -using namespace std::chrono_literals; using ::testing::NotNull; namespace overlay = com::android::overlay; @@ -222,13 +218,10 @@ TEST_F(IdmapTest, OverlayAssetsIsUpToDate) { unlink(temp_file.path); ASSERT_FALSE(apk_assets->IsUpToDate()); - - const auto sleep_duration = - std::chrono::nanoseconds(std::max(kModDateResolutionNs, 1'000'000ull)); - std::this_thread::sleep_for(sleep_duration); + sleep(2); base::WriteStringToFile("hello", temp_file.path); - std::this_thread::sleep_for(sleep_duration); + sleep(2); ASSERT_FALSE(apk_assets->IsUpToDate()); } diff --git a/tools/aapt/Package.cpp b/tools/aapt/Package.cpp index 60c4bf5c4131..5e0f87f0dcaf 100644 --- a/tools/aapt/Package.cpp +++ b/tools/aapt/Package.cpp @@ -292,12 +292,13 @@ bool processFile(Bundle* bundle, ZipFile* zip, } if (!hasData) { const String8& srcName = file->getSourceFile(); - auto fileModWhen = getFileModDate(srcName.c_str()); - if (fileModWhen == kInvalidModDate) { // file existence tested earlier, - return false; // not expecting an error here + time_t fileModWhen; + fileModWhen = getFileModDate(srcName.c_str()); + if (fileModWhen == (time_t) -1) { // file existence tested earlier, + return false; // not expecting an error here } - - if (toTimeT(fileModWhen) > entry->getModWhen()) { + + if (fileModWhen > entry->getModWhen()) { // mark as deleted so add() will succeed if (bundle->getVerbose()) { printf(" (removing old '%s')\n", storageName.c_str()); -- GitLab From ec350061a322e3a5a6612372df36bcde7b89621f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Tue, 25 Jun 2024 11:04:15 +0200 Subject: [PATCH 181/492] Add SDK_MINOR_INT Introduce Build.VERSION.SDK_MINOR_INT. This functions like SDK_INT, but represents the minor version of the Android API level; SDK_INT corresponds to the major version. Yearly dessert releases will increment SDK_INT and set SDK_MINOR_INT to zero. In-between desserts there may be additional, minor, releases where SDK_INT is kept the same and SDK_MINOR_INT is incremented. A minor release may include new APIs and resources, but must not introduce any back compat changes. Specifically, this means that minor releases are optional and guaranteed to not require developers to rebuild their apps. Bug: 350458259 Test: m Flag: android.sdk.major_minor_versioning_scheme Change-Id: I10d39f33ecfbd463753585224d674ceaefe83b22 --- core/api/current.txt | 1 + core/java/android/os/Build.java | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index 5e8febebee0e..9875c0276bf0 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -32771,6 +32771,7 @@ package android.os { field @NonNull public static final String RELEASE_OR_PREVIEW_DISPLAY; field @Deprecated public static final String SDK; field public static final int SDK_INT; + field @FlaggedApi("android.sdk.major_minor_versioning_scheme") public static final int SDK_MINOR_INT; field public static final String SECURITY_PATCH; } diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 30d2dec8b4c4..a8267d1c9d8c 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -17,6 +17,7 @@ package android.os; import android.Manifest; +import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -28,6 +29,7 @@ import android.app.Application; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.ravenwood.annotation.RavenwoodKeepWholeClass; +import android.sdk.Flags; import android.sysprop.DeviceProperties; import android.sysprop.SocProperties; import android.sysprop.TelephonyProperties; @@ -399,11 +401,34 @@ public class Build { * device. This value never changes while a device is booted, but it may * increase when the hardware manufacturer provides an OTA update. *

+ * Together with {@link SDK_MINOR_INT}, this constant defines the + *

major.minor
version of Android.
SDK_INT
is + * increased and
SDK_MINOR_INT
is set to 0 on new Android + * dessert releases. Between these, Android may also release so called + * minor releases where
SDK_INT
remains unchanged and + *
SDK_MINOR_INT
is increased. Minor releases can add new + * APIs, and have stricter guarantees around backwards compatibility + * (e.g. no changes gated by
targetSdkVersion
) compared to + * major releases. + *

* Possible values are defined in {@link Build.VERSION_CODES}. */ public static final int SDK_INT = SystemProperties.getInt( "ro.build.version.sdk", 0); + /** + * The minor SDK version of the software currently running on this hardware + * device. This value never changes while a device is booted, but it may + * increase when the hardware manufacturer provides an OTA update. + *

+ * Together with {@link SDK_INT}, this constant defines the + *

major.minor
version of Android. See {@link SDK_INT} for + * more information. + */ + @FlaggedApi(Flags.FLAG_MAJOR_MINOR_VERSIONING_SCHEME) + public static final int SDK_MINOR_INT = SystemProperties.getInt( + "ro.build.version.sdk_minor", 0); + /** * The SDK version of the software that initially shipped on * this hardware device. It never changes during the lifetime -- GitLab From 9e80080cd6a4a0e31efa9ea2b52bf00f97ba3d01 Mon Sep 17 00:00:00 2001 From: Marvin Ramin Date: Tue, 10 Sep 2024 10:47:25 +0000 Subject: [PATCH 182/492] Fix typos in WindowManager type constant documentation Change-Id: Icf59e31b4fe9e7e71a6cf63e7c775c48a7e67ff8 Flag: DOCS_ONLY Test: n/a --- core/java/android/view/WindowManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 67a207e34a1a..890ff099fd5a 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -2371,7 +2371,7 @@ public interface WindowManager extends ViewManager { public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15; /** - * Window type: the drag-and-drop pseudowindow. There is only one + * Window type: the drag-and-drop pseudowindow. There is only one * drag layer (at most), and it is placed on top of all other windows. * In multiuser systems shows only on the owning user's window. * @hide @@ -2381,7 +2381,7 @@ public interface WindowManager extends ViewManager { /** * Window type: panel that slides out from over the status bar * In multiuser systems shows on all users' windows. These windows - * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL} + * are displayed on top of the status bar and any {@link #TYPE_STATUS_BAR_PANEL} * windows. * @hide */ -- GitLab From ce15a76c64813796f128f85fa1360eab025175b3 Mon Sep 17 00:00:00 2001 From: Omar Abdelmonem Date: Tue, 3 Sep 2024 20:24:30 +0000 Subject: [PATCH 183/492] Added new custom View to TouchpadDebugView Added custom View that will contain the representation of the fingers. Fetched the touchpad name inside the TouchpadDebugView Bug: 364547682 Test: presubmit flag: com.android.hardware.input.touchpad_visualizer Change-Id: I24047ff0ba4167c1a16b361d853a90a28d207070 --- .../server/input/debug/TouchpadDebugView.java | 66 ++++++++++--------- .../debug/TouchpadVisualisationView.java | 26 ++++++++ .../input/debug/TouchpadDebugViewTest.java | 17 ++--- 3 files changed, 64 insertions(+), 45 deletions(-) create mode 100644 services/core/java/com/android/server/input/debug/TouchpadVisualisationView.java diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java index ba56ad073e6a..c6092f4dc3c8 100644 --- a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java +++ b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java @@ -22,6 +22,7 @@ import android.content.res.Configuration; import android.graphics.Color; import android.graphics.PixelFormat; import android.graphics.Rect; +import android.hardware.input.InputManager; import android.util.Slog; import android.view.Gravity; import android.view.MotionEvent; @@ -65,7 +66,7 @@ public class TouchpadDebugView extends LinearLayout { mTouchpadId = touchpadId; mWindowManager = Objects.requireNonNull(getContext().getSystemService(WindowManager.class)); - init(context); + init(context, touchpadId); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); // TODO(b/360137366): Use the hardware properties to initialise layout parameters. @@ -88,32 +89,40 @@ public class TouchpadDebugView extends LinearLayout { mWindowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT; } - private void init(Context context) { + private void init(Context context, int touchpadId) { setOrientation(VERTICAL); setLayoutParams(new LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); - setBackgroundColor(Color.RED); - - // TODO(b/286551975): Replace this content with the touchpad debug view. - TextView textView1 = new TextView(context); - textView1.setBackgroundColor(Color.TRANSPARENT); - textView1.setTextSize(20); - textView1.setText("Touchpad Debug View 1"); - textView1.setGravity(Gravity.CENTER); - textView1.setTextColor(Color.WHITE); - textView1.setLayoutParams(new LayoutParams(1000, 200)); - - TextView textView2 = new TextView(context); - textView2.setBackgroundColor(Color.TRANSPARENT); - textView2.setTextSize(20); - textView2.setText("Touchpad Debug View 2"); - textView2.setGravity(Gravity.CENTER); - textView2.setTextColor(Color.WHITE); - textView2.setLayoutParams(new LayoutParams(1000, 200)); - - addView(textView1); - addView(textView2); + setBackgroundColor(Color.TRANSPARENT); + + TextView nameView = new TextView(context); + nameView.setBackgroundColor(Color.RED); + nameView.setTextSize(20); + nameView.setText(Objects.requireNonNull(Objects.requireNonNull( + mContext.getSystemService(InputManager.class)) + .getInputDevice(touchpadId)).getName()); + nameView.setGravity(Gravity.CENTER); + nameView.setTextColor(Color.WHITE); + nameView.setLayoutParams(new LayoutParams(1000, 200)); + + TouchpadVisualisationView touchpadVisualisationView = + new TouchpadVisualisationView(context); + touchpadVisualisationView.setBackgroundColor(Color.WHITE); + touchpadVisualisationView.setLayoutParams(new LayoutParams(1000, 200)); + + //TODO(b/365562952): Add a display for recognized gesture info here + TextView gestureInfoView = new TextView(context); + gestureInfoView.setBackgroundColor(Color.GRAY); + gestureInfoView.setTextSize(20); + gestureInfoView.setText("Touchpad Debug View 3"); + gestureInfoView.setGravity(Gravity.CENTER); + gestureInfoView.setTextColor(Color.BLACK); + gestureInfoView.setLayoutParams(new LayoutParams(1000, 200)); + + addView(nameView); + addView(touchpadVisualisationView); + addView(gestureInfoView); updateScreenDimensions(); } @@ -219,18 +228,11 @@ public class TouchpadDebugView extends LinearLayout { private void onTouchpadButtonPress() { Slog.d("TouchpadDebugView", "You clicked me!"); - - // Iterate through all child views - // Temporary demonstration for testing - for (int i = 0; i < getChildCount(); i++) { - getChildAt(i).setBackgroundColor(Color.BLUE); - } + getChildAt(0).setBackgroundColor(Color.BLUE); } private void onTouchpadButtonRelease() { Slog.d("TouchpadDebugView", "You released the click"); - for (int i = 0; i < getChildCount(); i++) { - getChildAt(i).setBackgroundColor(Color.RED); - } + getChildAt(0).setBackgroundColor(Color.RED); } } diff --git a/services/core/java/com/android/server/input/debug/TouchpadVisualisationView.java b/services/core/java/com/android/server/input/debug/TouchpadVisualisationView.java new file mode 100644 index 000000000000..38442bcc0292 --- /dev/null +++ b/services/core/java/com/android/server/input/debug/TouchpadVisualisationView.java @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.input.debug; + +import android.content.Context; +import android.view.View; + +public class TouchpadVisualisationView extends View { + public TouchpadVisualisationView(Context context) { + super(context); + } +} diff --git a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java index 0f08be215033..4a2ad3af115a 100644 --- a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java +++ b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java @@ -296,33 +296,24 @@ public class TouchpadDebugViewTest { @Test public void testTouchpadClick() { - View child; + View child = mTouchpadDebugView.getChildAt(0); mTouchpadDebugView.updateHardwareState( new TouchpadHardwareState(0, 1 /* buttonsDown */, 0, 0, new TouchpadFingerState[0])); - for (int i = 0; i < mTouchpadDebugView.getChildCount(); i++) { - child = mTouchpadDebugView.getChildAt(i); - assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); - } + assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); mTouchpadDebugView.updateHardwareState( new TouchpadHardwareState(0, 0 /* buttonsDown */, 0, 0, new TouchpadFingerState[0])); - for (int i = 0; i < mTouchpadDebugView.getChildCount(); i++) { - child = mTouchpadDebugView.getChildAt(i); - assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.RED); - } + assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.RED); mTouchpadDebugView.updateHardwareState( new TouchpadHardwareState(0, 1 /* buttonsDown */, 0, 0, new TouchpadFingerState[0])); - for (int i = 0; i < mTouchpadDebugView.getChildCount(); i++) { - child = mTouchpadDebugView.getChildAt(i); - assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); - } + assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); } } -- GitLab From a7583fccf1bafa6ea53e5da1b2f18833e791bc2d Mon Sep 17 00:00:00 2001 From: Desh Date: Tue, 10 Sep 2024 00:42:11 +0000 Subject: [PATCH 184/492] Make SearchSpec Internal when fetching metadata properties. Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: I69774ec52a642c8c421266a40d091d29961f9712 --- .../AppFunctionStaticMetadataHelper.java | 2 + .../appfunctions/MetadataSyncAdapter.java | 45 +++++++++++++++---- .../appfunctions/MetadataSyncAdapterTest.kt | 34 +++----------- 3 files changed, 44 insertions(+), 37 deletions(-) diff --git a/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java b/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java index 926cc9a3642c..085e0a47d356 100644 --- a/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java +++ b/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java @@ -39,6 +39,8 @@ public class AppFunctionStaticMetadataHelper { public static final String STATIC_PROPERTY_ENABLED_BY_DEFAULT = "enabledByDefault"; public static final String APP_FUNCTION_STATIC_NAMESPACE = "app_functions"; + public static final String PROPERTY_FUNCTION_ID = "functionId"; + public static final String PROPERTY_PACKAGE_NAME = "packageName"; // These are constants that has to be kept the same with {@code // com.android.server.appsearch.appsindexer.appsearchtypes.AppSearchHelper}. diff --git a/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java b/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java index be5770b280dc..35fa47aedd51 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java +++ b/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java @@ -18,6 +18,7 @@ package com.android.server.appfunctions; import android.annotation.NonNull; import android.annotation.WorkerThread; +import android.app.appsearch.PropertyPath; import android.app.appsearch.SearchResult; import android.app.appsearch.SearchSpec; import android.util.ArrayMap; @@ -110,26 +111,29 @@ public class MetadataSyncAdapter { } /** - * This method returns a map of package names to a set of function ids. + * This method returns a map of package names to a set of function ids from the AppFunction + * metadata. * - * @param queryExpression The query expression to use when searching for AppFunction metadata. - * @param metadataSearchSpec The search spec to use when searching for AppFunction metadata. - * @return A map of package names to a set of function ids. - * @throws ExecutionException If the future search results fail to execute. - * @throws InterruptedException If the future search results are interrupted. + * @param schemaType The name space of the AppFunction metadata. + * @return A map of package names to a set of function ids from the AppFunction metadata. */ @NonNull @VisibleForTesting @WorkerThread ArrayMap> getPackageToFunctionIdMap( - @NonNull String queryExpression, - @NonNull SearchSpec metadataSearchSpec, + @NonNull String schemaType, @NonNull String propertyFunctionId, @NonNull String propertyPackageName) throws ExecutionException, InterruptedException { ArrayMap> packageToFunctionIds = new ArrayMap<>(); + FutureSearchResults futureSearchResults = - mFutureAppSearchSession.search(queryExpression, metadataSearchSpec).get(); + mFutureAppSearchSession + .search( + "", + buildMetadataSearchSpec( + schemaType, propertyFunctionId, propertyPackageName)) + .get(); List searchResultsList = futureSearchResults.getNextPage().get(); // TODO(b/357551503): This could be expensive if we have more functions while (!searchResultsList.isEmpty()) { @@ -146,4 +150,27 @@ public class MetadataSyncAdapter { } return packageToFunctionIds; } + + /** + * This method returns a {@link SearchSpec} for searching the AppFunction metadata. + * + * @param schemaType The schema type of the AppFunction metadata. + * @param propertyFunctionId The property name of the function id in the AppFunction metadata. + * @param propertyPackageName The property name of the package name in the AppFunction metadata. + * @return A {@link SearchSpec} for searching the AppFunction metadata. + */ + @NonNull + private static SearchSpec buildMetadataSearchSpec( + @NonNull String schemaType, + @NonNull String propertyFunctionId, + @NonNull String propertyPackageName) { + return new SearchSpec.Builder() + .addFilterSchemas(schemaType) + .addProjectionPaths( + schemaType, + List.of( + new PropertyPath(propertyFunctionId), + new PropertyPath(propertyPackageName))) + .build(); + } } diff --git a/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt b/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt index 1061da28f799..5769e07ee58d 100644 --- a/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt +++ b/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt @@ -16,12 +16,9 @@ package com.android.server.appfunctions import android.app.appfunctions.AppFunctionRuntimeMetadata -import android.app.appfunctions.AppFunctionRuntimeMetadata.PROPERTY_FUNCTION_ID -import android.app.appfunctions.AppFunctionRuntimeMetadata.PROPERTY_PACKAGE_NAME import android.app.appsearch.AppSearchManager import android.app.appsearch.AppSearchManager.SearchContext import android.app.appsearch.PutDocumentsRequest -import android.app.appsearch.SearchSpec import android.app.appsearch.SetSchemaRequest import android.util.ArrayMap import android.util.ArraySet @@ -76,20 +73,11 @@ class MetadataSyncAdapterTest { testExecutor, FutureAppSearchSession(appSearchManager, testExecutor, searchContext), ) - val searchSpec: SearchSpec = - SearchSpec.Builder() - .addFilterSchemas( - AppFunctionRuntimeMetadata.RUNTIME_SCHEMA_TYPE, - AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(TEST_TARGET_PKG_NAME) - .schemaType, - ) - .build() val packageToFunctionIdMap = metadataSyncAdapter.getPackageToFunctionIdMap( - "", - searchSpec, - PROPERTY_FUNCTION_ID, - PROPERTY_PACKAGE_NAME, + AppFunctionRuntimeMetadata.RUNTIME_SCHEMA_TYPE, + AppFunctionRuntimeMetadata.PROPERTY_FUNCTION_ID, + AppFunctionRuntimeMetadata.PROPERTY_PACKAGE_NAME, ) assertThat(packageToFunctionIdMap).isNotNull() @@ -135,21 +123,11 @@ class MetadataSyncAdapterTest { testExecutor, FutureAppSearchSession(appSearchManager, testExecutor, searchContext), ) - val searchSpec: SearchSpec = - SearchSpec.Builder() - .setResultCountPerPage(1) - .addFilterSchemas( - AppFunctionRuntimeMetadata.RUNTIME_SCHEMA_TYPE, - AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(TEST_TARGET_PKG_NAME) - .schemaType, - ) - .build() val packageToFunctionIdMap = metadataSyncAdapter.getPackageToFunctionIdMap( - "", - searchSpec, - PROPERTY_FUNCTION_ID, - PROPERTY_PACKAGE_NAME, + AppFunctionRuntimeMetadata.RUNTIME_SCHEMA_TYPE, + AppFunctionRuntimeMetadata.PROPERTY_FUNCTION_ID, + AppFunctionRuntimeMetadata.PROPERTY_PACKAGE_NAME, ) assertThat(packageToFunctionIdMap).isNotNull() -- GitLab From 0b97ba755faa62cd79bbc92d6ee89b1c5a154542 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Tue, 10 Sep 2024 16:49:14 +0900 Subject: [PATCH 185/492] Move new_fonts_fallback_xml to released aconfig Bug: 281769620 Bug: 364533012 Flag: EXEMPT removing new_fonts_fallback_xml Test: N/A Change-Id: I9762b7add64a5d378080cc20b9cb500e894fc8bd --- core/java/android/text/flags/24Q3.aconfig | 10 ++++++++++ core/java/android/text/flags/flags.aconfig | 10 ---------- .../java/android/graphics/fonts/SystemFonts.java | 16 ++-------------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/core/java/android/text/flags/24Q3.aconfig b/core/java/android/text/flags/24Q3.aconfig index 6524ed32acf4..a4c117d375f7 100644 --- a/core/java/android/text/flags/24Q3.aconfig +++ b/core/java/android/text/flags/24Q3.aconfig @@ -34,3 +34,13 @@ flag { description: "Feature flag that preserve the line height of the TextView and EditText even if the the locale is different from Latin" bug: "303326708" } + +flag { + name: "new_fonts_fallback_xml" + is_exported: true + namespace: "text" + description: "Feature flag for deprecating fonts.xml. By setting true for this feature flag, the new font configuration XML, /system/etc/font_fallback.xml is used. The new XML has a new syntax and flexibility of variable font declarations, but it is not compatible with the apps that reads fonts.xml. So, fonts.xml is maintained as a subset of the font_fallback.xml" + # Make read only, as it could be used before the Settings provider is initialized. + is_fixed_read_only: true + bug: "281769620" +} diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index f8a98da4d36f..ede832cedeac 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -1,16 +1,6 @@ package: "com.android.text.flags" container: "system" -flag { - name: "new_fonts_fallback_xml" - is_exported: true - namespace: "text" - description: "Feature flag for deprecating fonts.xml. By setting true for this feature flag, the new font configuration XML, /system/etc/font_fallback.xml is used. The new XML has a new syntax and flexibility of variable font declarations, but it is not compatible with the apps that reads fonts.xml. So, fonts.xml is maintained as a subset of the font_fallback.xml" - # Make read only, as it could be used before the Settings provider is initialized. - is_fixed_read_only: true - bug: "281769620" -} - flag { name: "no_break_no_hyphenation_span" is_exported: true diff --git a/graphics/java/android/graphics/fonts/SystemFonts.java b/graphics/java/android/graphics/fonts/SystemFonts.java index f727f5b076a1..0e25c346064c 100644 --- a/graphics/java/android/graphics/fonts/SystemFonts.java +++ b/graphics/java/android/graphics/fonts/SystemFonts.java @@ -306,13 +306,7 @@ public final class SystemFonts { long lastModifiedDate, int configVersion ) { - final String fontsXml; - if (com.android.text.flags.Flags.newFontsFallbackXml()) { - fontsXml = FONTS_XML; - } else { - fontsXml = LEGACY_FONTS_XML; - } - return getSystemFontConfigInternal(fontsXml, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, + return getSystemFontConfigInternal(FONTS_XML, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, updatableFontMap, lastModifiedDate, configVersion); } @@ -337,13 +331,7 @@ public final class SystemFonts { * @hide */ public static @NonNull FontConfig getSystemPreinstalledFontConfig() { - final String fontsXml; - if (com.android.text.flags.Flags.newFontsFallbackXml()) { - fontsXml = FONTS_XML; - } else { - fontsXml = LEGACY_FONTS_XML; - } - return getSystemFontConfigInternal(fontsXml, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, null, + return getSystemFontConfigInternal(FONTS_XML, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, null, 0, 0); } -- GitLab From 25fefa8cc90c91325f3e7556915f19b08d087693 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Tue, 10 Sep 2024 17:06:46 +0900 Subject: [PATCH 186/492] Move no_break_no_hyphenation to released flags Bug: 283193586 Bug: 364533012 Flag: EXEMPT removing no_break_no_hyphenation Test: N/A Change-Id: I8332468a49530ebe778ae09bb86493a8d094a72f --- core/java/android/text/ClientFlags.java | 7 ------- core/java/android/text/TextFlags.java | 2 -- core/java/android/text/flags/24Q3.aconfig | 8 ++++++++ core/java/android/text/flags/flags.aconfig | 8 -------- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/core/java/android/text/ClientFlags.java b/core/java/android/text/ClientFlags.java index 901bf562f194..c2ad508c2b44 100644 --- a/core/java/android/text/ClientFlags.java +++ b/core/java/android/text/ClientFlags.java @@ -27,13 +27,6 @@ import com.android.text.flags.Flags; * @hide */ public class ClientFlags { - /** - * @see Flags#noBreakNoHyphenationSpan() - */ - public static boolean noBreakNoHyphenationSpan() { - return TextFlags.isFeatureEnabled(Flags.FLAG_NO_BREAK_NO_HYPHENATION_SPAN); - } - /** * @see Flags#fixMisalignedContextMenu() */ diff --git a/core/java/android/text/TextFlags.java b/core/java/android/text/TextFlags.java index a78aa7e0312a..076721f629ed 100644 --- a/core/java/android/text/TextFlags.java +++ b/core/java/android/text/TextFlags.java @@ -55,7 +55,6 @@ public final class TextFlags { * List of text flags to be transferred to the application process. */ public static final String[] TEXT_ACONFIGS_FLAGS = { - Flags.FLAG_NO_BREAK_NO_HYPHENATION_SPAN, Flags.FLAG_FIX_MISALIGNED_CONTEXT_MENU, }; @@ -65,7 +64,6 @@ public final class TextFlags { * The order must be the same to the TEXT_ACONFIG_FLAGS. */ public static final boolean[] TEXT_ACONFIG_DEFAULT_VALUE = { - Flags.noBreakNoHyphenationSpan(), Flags.fixMisalignedContextMenu(), }; diff --git a/core/java/android/text/flags/24Q3.aconfig b/core/java/android/text/flags/24Q3.aconfig index a4c117d375f7..7035fc842a48 100644 --- a/core/java/android/text/flags/24Q3.aconfig +++ b/core/java/android/text/flags/24Q3.aconfig @@ -44,3 +44,11 @@ flag { is_fixed_read_only: true bug: "281769620" } + +flag { + name: "no_break_no_hyphenation_span" + is_exported: true + namespace: "text" + description: "A feature flag that adding new spans that prevents line breaking and hyphenation." + bug: "283193586" +} diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index ede832cedeac..3c61f4f5a33c 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -1,14 +1,6 @@ package: "com.android.text.flags" container: "system" -flag { - name: "no_break_no_hyphenation_span" - is_exported: true - namespace: "text" - description: "A feature flag that adding new spans that prevents line breaking and hyphenation." - bug: "283193586" -} - flag { name: "use_optimized_boottime_font_loading" namespace: "text" -- GitLab From 9810a187240b484c35d77a110d6e615d9d3eb87c Mon Sep 17 00:00:00 2001 From: omarmt Date: Tue, 10 Sep 2024 11:55:50 +0000 Subject: [PATCH 187/492] Ktfmt on MultiPointerDraggable MultiPointerDraggableTest Test: No test. Ktfmt refactor Bug: 365564010 Flag: com.android.systemui.scene_container Change-Id: Iff4d6116fc8aa0b2df8528b6bbcb2a55d0fd0df0 --- .../animation/scene/MultiPointerDraggable.kt | 22 +++++++------------ .../scene/MultiPointerDraggableTest.kt | 6 ++--- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MultiPointerDraggable.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MultiPointerDraggable.kt index 0d05f4e8c613..b99b7f9f4fe4 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MultiPointerDraggable.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MultiPointerDraggable.kt @@ -200,7 +200,7 @@ internal class MultiPointerDraggableNode( override fun onPointerEvent( pointerEvent: PointerEvent, pass: PointerEventPass, - bounds: IntSize + bounds: IntSize, ) { // The order is important here: the tracker is always called first. pointerTracker.onPointerEvent(pointerEvent, pass, bounds) @@ -312,13 +312,13 @@ internal class MultiPointerDraggableNode( velocityTracker.calculateVelocity(maxVelocity) } .toFloat(), - onFling = { controller.onStop(it, canChangeContent = true) } + onFling = { controller.onStop(it, canChangeContent = true) }, ) }, onDragCancel = { controller -> startFlingGesture( initialVelocity = 0f, - onFling = { controller.onStop(it, canChangeContent = true) } + onFling = { controller.onStop(it, canChangeContent = true) }, ) }, swipeDetector = swipeDetector, @@ -369,10 +369,7 @@ internal class MultiPointerDraggableNode( // PreScroll phase val consumedByPreScroll = dispatcher - .dispatchPreScroll( - available = availableOnPreScroll.toOffset(), - source = source, - ) + .dispatchPreScroll(available = availableOnPreScroll.toOffset(), source = source) .toFloat() // Scroll phase @@ -484,12 +481,12 @@ internal class MultiPointerDraggableNode( Orientation.Horizontal -> awaitHorizontalTouchSlopOrCancellation( consumablePointer.id, - onSlopReached + onSlopReached, ) Orientation.Vertical -> awaitVerticalTouchSlopOrCancellation( consumablePointer.id, - onSlopReached + onSlopReached, ) } @@ -553,7 +550,7 @@ internal class MultiPointerDraggableNode( } private suspend fun AwaitPointerEventScope.awaitConsumableEvent( - pass: () -> PointerEventPass, + pass: () -> PointerEventPass ): PointerEvent { fun canBeConsumed(changes: List): Boolean { // At least one pointer down AND @@ -661,7 +658,4 @@ internal fun interface PointersInfoOwner { fun pointersInfo(): PointersInfo } -internal data class PointersInfo( - val startedPosition: Offset?, - val pointersDown: Int, -) +internal data class PointersInfo(val startedPosition: Offset?, val pointersDown: Int) diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MultiPointerDraggableTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MultiPointerDraggableTest.kt index bf192e7708d0..942cb2303dc5 100644 --- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MultiPointerDraggableTest.kt +++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MultiPointerDraggableTest.kt @@ -259,7 +259,7 @@ class MultiPointerDraggableTest { it } ), - Orientation.Vertical + Orientation.Vertical, ) .fillMaxSize() ) @@ -640,7 +640,7 @@ class MultiPointerDraggableTest { override fun onPostScroll( consumed: Offset, available: Offset, - source: NestedScrollSource + source: NestedScrollSource, ): Offset { availableOnPostScroll = available.y return Offset.Zero @@ -653,7 +653,7 @@ class MultiPointerDraggableTest { override suspend fun onPostFling( consumed: Velocity, - available: Velocity + available: Velocity, ): Velocity { availableOnPostFling = available.y return Velocity.Zero -- GitLab From a13d287378d064eb5c7e174a22bdea12c4e81eff Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Tue, 10 Sep 2024 11:57:39 +0000 Subject: [PATCH 188/492] Add remove to FutureAppSearchSession Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: Ib3ec4eae9e1055ddb93ad34653a903555389ca83 --- .../appfunctions/FutureAppSearchSession.java | 21 ++++++- .../FutureAppSearchSessionTest.kt | 57 +++++++++++++++---- 2 files changed, 65 insertions(+), 13 deletions(-) diff --git a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java index 094723814e17..39aa27ae794e 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java +++ b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java @@ -27,6 +27,7 @@ import android.app.appsearch.GenericDocument; import android.app.appsearch.GetByDocumentIdRequest; import android.app.appsearch.GetSchemaResponse; import android.app.appsearch.PutDocumentsRequest; +import android.app.appsearch.RemoveByDocumentIdRequest; import android.app.appsearch.SearchResult; import android.app.appsearch.SearchResults; import android.app.appsearch.SearchSpec; @@ -146,6 +147,22 @@ public class FutureAppSearchSession implements Closeable { }); } + /** Removes documents from the AppSearchSession database. */ + public AndroidFuture> remove( + @NonNull RemoveByDocumentIdRequest removeRequest) { + return getSessionAsync() + .thenCompose( + session -> { + AndroidFuture> + settableBatchResultFuture = new AndroidFuture<>(); + session.remove( + removeRequest, + mExecutor, + new BatchResultCallbackAdapter<>(settableBatchResultFuture)); + return settableBatchResultFuture; + }); + } + /** * Retrieves documents from the open AppSearchSession that match a given query string and type * of search provided. @@ -200,9 +217,7 @@ public class FutureAppSearchSession implements Closeable { Objects.requireNonNull(namespace); GetByDocumentIdRequest request = - new GetByDocumentIdRequest.Builder(namespace) - .addIds(documentId) - .build(); + new GetByDocumentIdRequest.Builder(namespace).addIds(documentId).build(); return getSessionAsync() .thenCompose( session -> { diff --git a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt index a0f1a559bb52..3bc44111ba08 100644 --- a/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt +++ b/services/tests/appfunctions/src/com/android/server/appfunctions/FutureAppSearchSessionTest.kt @@ -19,8 +19,10 @@ import android.app.appfunctions.AppFunctionRuntimeMetadata import android.app.appfunctions.AppFunctionRuntimeMetadata.APP_FUNCTION_RUNTIME_NAMESPACE import android.app.appfunctions.AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema import android.app.appfunctions.AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema +import android.app.appsearch.AppSearchBatchResult import android.app.appsearch.AppSearchManager import android.app.appsearch.PutDocumentsRequest +import android.app.appsearch.RemoveByDocumentIdRequest import android.app.appsearch.SearchSpec import android.app.appsearch.SetSchemaRequest import androidx.test.platform.app.InstrumentationRegistry @@ -56,7 +58,7 @@ class FutureAppSearchSessionTest { SetSchemaRequest.Builder() .addSchemas( createParentAppFunctionRuntimeSchema(), - createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME) + createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME), ) .build() @@ -74,7 +76,7 @@ class FutureAppSearchSessionTest { SetSchemaRequest.Builder() .addSchemas( createParentAppFunctionRuntimeSchema(), - createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME) + createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME), ) .build() val schema = session.setSchema(setSchemaRequest) @@ -92,6 +94,40 @@ class FutureAppSearchSessionTest { } } + @Test + fun remove() { + val searchContext = AppSearchManager.SearchContext.Builder(TEST_DB).build() + FutureAppSearchSession(appSearchManager, testExecutor, searchContext).use { session -> + val setSchemaRequest = + SetSchemaRequest.Builder() + .addSchemas( + createParentAppFunctionRuntimeSchema(), + createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME), + ) + .build() + val schema = session.setSchema(setSchemaRequest) + assertThat(schema.get()).isNotNull() + val appFunctionRuntimeMetadata = + AppFunctionRuntimeMetadata.Builder(TEST_PACKAGE_NAME, TEST_FUNCTION_ID, "").build() + val putDocumentsRequest: PutDocumentsRequest = + PutDocumentsRequest.Builder() + .addGenericDocuments(appFunctionRuntimeMetadata) + .build() + val putResult = session.put(putDocumentsRequest) + assertThat(putResult.get().isSuccess).isTrue() + val removeDocumentRequest = + RemoveByDocumentIdRequest.Builder(APP_FUNCTION_RUNTIME_NAMESPACE) + .addIds(appFunctionRuntimeMetadata.id) + .build() + + val removeResult: AppSearchBatchResult = + session.remove(removeDocumentRequest).get() + + assertThat(removeResult).isNotNull() + assertThat(removeResult.isSuccess).isTrue() + } + } + @Test fun search() { val searchContext = AppSearchManager.SearchContext.Builder(TEST_DB).build() @@ -100,7 +136,7 @@ class FutureAppSearchSessionTest { SetSchemaRequest.Builder() .addSchemas( createParentAppFunctionRuntimeSchema(), - createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME) + createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME), ) .build() val schema = session.setSchema(setSchemaRequest) @@ -132,7 +168,7 @@ class FutureAppSearchSessionTest { SetSchemaRequest.Builder() .addSchemas( createParentAppFunctionRuntimeSchema(), - createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME) + createAppFunctionRuntimeSchema(TEST_PACKAGE_NAME), ) .build() val schema = session.setSchema(setSchemaRequest) @@ -144,12 +180,13 @@ class FutureAppSearchSessionTest { .build() val putResult = session.put(putDocumentsRequest) - val genricDocument = session - .getByDocumentId( - /* documentId= */ "${TEST_PACKAGE_NAME}/${TEST_FUNCTION_ID}", - APP_FUNCTION_RUNTIME_NAMESPACE - ) - .get() + val genricDocument = + session + .getByDocumentId( + /* documentId= */ "${TEST_PACKAGE_NAME}/${TEST_FUNCTION_ID}", + APP_FUNCTION_RUNTIME_NAMESPACE, + ) + .get() val foundAppFunctionRuntimeMetadata = AppFunctionRuntimeMetadata(genricDocument) assertThat(foundAppFunctionRuntimeMetadata.functionId).isEqualTo(TEST_FUNCTION_ID) -- GitLab From 4f7d725c17ce029ebd68ae674728dd8a43c8f00e Mon Sep 17 00:00:00 2001 From: Michael Mikhail Date: Mon, 9 Sep 2024 14:14:29 +0000 Subject: [PATCH 189/492] Send binder calls in MediaResumeListener to background thread Flag: EXEMPT bugfix Bug: 364610391 Test: atest MediaResumeListenerTest Change-Id: Ifc1f4af56d04fbd4d3c4e5ab2894dfe281b337ee --- .../domain/resume/MediaResumeListener.kt | 19 +++--- .../domain/resume/MediaResumeListenerTest.kt | 59 +++++++++++-------- 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/resume/MediaResumeListener.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/resume/MediaResumeListener.kt index e4047e5f96c5..9ee59d1875a6 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/resume/MediaResumeListener.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/resume/MediaResumeListener.kt @@ -80,6 +80,7 @@ constructor( field?.disconnect() field = value } + private var currentUserId: Int = context.userId @VisibleForTesting @@ -89,7 +90,7 @@ constructor( if (Intent.ACTION_USER_UNLOCKED == intent.action) { val userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1) if (userId == currentUserId) { - loadMediaResumptionControls() + backgroundExecutor.execute { loadMediaResumptionControls() } } } } @@ -254,15 +255,15 @@ constructor( if (data.resumeAction == null && !data.hasCheckedForResume && isEligibleForResume) { // TODO also check for a media button receiver intended for restarting (b/154127084) // Set null action to prevent additional attempts to connect - mediaDataManager.setResumeAction(key, null) - Log.d(TAG, "Checking for service component for " + data.packageName) - val pm = context.packageManager - val serviceIntent = Intent(MediaBrowserService.SERVICE_INTERFACE) - val resumeInfo = pm.queryIntentServicesAsUser(serviceIntent, 0, currentUserId) + backgroundExecutor.execute { + mediaDataManager.setResumeAction(key, null) + Log.d(TAG, "Checking for service component for " + data.packageName) + val pm = context.packageManager + val serviceIntent = Intent(MediaBrowserService.SERVICE_INTERFACE) + val resumeInfo = pm.queryIntentServicesAsUser(serviceIntent, 0, currentUserId) - val inf = resumeInfo?.filter { it.serviceInfo.packageName == data.packageName } - if (inf != null && inf.size > 0) { - backgroundExecutor.execute { + val inf = resumeInfo?.filter { it.serviceInfo.packageName == data.packageName } + if (inf != null && inf.size > 0) { tryUpdateResumptionList(key, inf!!.get(0).componentInfo.componentName) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/resume/MediaResumeListenerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/resume/MediaResumeListenerTest.kt index 02d741385cf9..bc29d2a8ba0d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/resume/MediaResumeListenerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/resume/MediaResumeListenerTest.kt @@ -138,6 +138,7 @@ class MediaResumeListenerTest : SysuiTestCase() { whenever(mockContext.packageManager).thenReturn(context.packageManager) whenever(mockContext.contentResolver).thenReturn(context.contentResolver) whenever(mockContext.userId).thenReturn(context.userId) + whenever(mockContext.resources).thenReturn(context.resources) whenever(mediaFlags.isRemoteResumeAllowed()).thenReturn(false) executor = FakeExecutor(clock) @@ -210,7 +211,7 @@ class MediaResumeListenerTest : SysuiTestCase() { @Test fun testOnLoad_checksForResume_noService() { // When media data is loaded that has not been checked yet, and does not have a MBS - resumeListener.onMediaDataLoaded(KEY, null, data) + onMediaDataLoaded(KEY, null, data) // Then we report back to the manager verify(mediaDataManager).setResumeAction(KEY, null) @@ -223,8 +224,7 @@ class MediaResumeListenerTest : SysuiTestCase() { whenever(resumeBrowser.testConnection()).thenAnswer { callbackCaptor.value.onError() } // When media data is loaded that has not been checked yet, and does not have a MBS - resumeListener.onMediaDataLoaded(KEY, null, data) - executor.runAllReady() + onMediaDataLoaded(KEY, null, data) // Then we report back to the manager verify(mediaDataManager).setResumeAction(eq(KEY), eq(null)) @@ -234,7 +234,7 @@ class MediaResumeListenerTest : SysuiTestCase() { fun testOnLoad_localCast_doesNotCheck() { // When media data is loaded that has not been checked yet, and is a local cast val dataCast = data.copy(playbackLocation = MediaData.PLAYBACK_CAST_LOCAL) - resumeListener.onMediaDataLoaded(KEY, null, dataCast) + onMediaDataLoaded(KEY, null, dataCast, false) // Then we do not take action verify(mediaDataManager, never()).setResumeAction(any(), any()) @@ -244,7 +244,7 @@ class MediaResumeListenerTest : SysuiTestCase() { fun testOnload_remoteCast_doesNotCheck() { // When media data is loaded that has not been checked yet, and is a remote cast val dataRcn = data.copy(playbackLocation = MediaData.PLAYBACK_CAST_REMOTE) - resumeListener.onMediaDataLoaded(KEY, null, dataRcn) + onMediaDataLoaded(KEY, null, dataRcn, resume = false) // Then we do not take action verify(mediaDataManager, never()).setResumeAction(any(), any()) @@ -257,7 +257,7 @@ class MediaResumeListenerTest : SysuiTestCase() { // When media data is loaded that has not been checked yet, and is a local cast val dataCast = data.copy(playbackLocation = MediaData.PLAYBACK_CAST_LOCAL) - resumeListener.onMediaDataLoaded(KEY, null, dataCast) + onMediaDataLoaded(KEY, null, dataCast) // Then we report back to the manager verify(mediaDataManager).setResumeAction(KEY, null) @@ -270,7 +270,7 @@ class MediaResumeListenerTest : SysuiTestCase() { // When media data is loaded that has not been checked yet, and is a remote cast val dataRcn = data.copy(playbackLocation = MediaData.PLAYBACK_CAST_REMOTE) - resumeListener.onMediaDataLoaded(KEY, null, dataRcn) + onMediaDataLoaded(KEY, null, dataRcn, false) // Then we do not take action verify(mediaDataManager, never()).setResumeAction(any(), any()) @@ -288,10 +288,9 @@ class MediaResumeListenerTest : SysuiTestCase() { // When media data is loaded that has not been checked yet, and does have a MBS val dataCopy = data.copy(resumeAction = null, hasCheckedForResume = false) - resumeListener.onMediaDataLoaded(KEY, null, dataCopy) + onMediaDataLoaded(KEY, null, dataCopy) // Then we test whether the service is valid - executor.runAllReady() verify(mediaDataManager).setResumeAction(eq(KEY), eq(null)) verify(resumeBrowser).testConnection() @@ -307,7 +306,7 @@ class MediaResumeListenerTest : SysuiTestCase() { fun testOnLoad_doesNotCheckAgain() { // When a media data is loaded that has been checked already var dataCopy = data.copy(hasCheckedForResume = true) - resumeListener.onMediaDataLoaded(KEY, null, dataCopy) + onMediaDataLoaded(KEY, null, dataCopy, resume = false) // Then we should not check it again verify(resumeBrowser, never()).testConnection() @@ -320,17 +319,15 @@ class MediaResumeListenerTest : SysuiTestCase() { setUpMbsWithValidResolveInfo() resumeListener.onMediaDataLoaded(KEY, null, data) - // We notify the manager to set a null action - verify(mediaDataManager).setResumeAction(KEY, null) - // If we then get another update from the app before the first check completes assertThat(executor.numPending()).isEqualTo(1) var dataWithCheck = data.copy(hasCheckedForResume = true) resumeListener.onMediaDataLoaded(KEY, null, dataWithCheck) // We do not try to start another check - assertThat(executor.numPending()).isEqualTo(1) + executor.runAllReady() verify(mediaDataManager).setResumeAction(KEY, null) + verify(resumeBrowserFactory, times(1)).create(any(), any(), anyInt()) } @Test @@ -363,6 +360,7 @@ class MediaResumeListenerTest : SysuiTestCase() { resumeListener.userUnlockReceiver.onReceive(context, intent) // Then we should attempt to find recent media for each saved component + executor.runAllReady() verify(resumeBrowser, times(3)).findRecentMedia() // Then since the mock service found media, the manager should be informed @@ -382,10 +380,9 @@ class MediaResumeListenerTest : SysuiTestCase() { // When media data is loaded that has not been checked yet, and does have a MBS val dataCopy = data.copy(resumeAction = null, hasCheckedForResume = false) - resumeListener.onMediaDataLoaded(KEY, null, dataCopy) + onMediaDataLoaded(KEY, null, dataCopy) // Then we test whether the service is valid and set the resume action - executor.runAllReady() verify(mediaDataManager).setResumeAction(eq(KEY), eq(null)) verify(resumeBrowser).testConnection() verify(mediaDataManager, times(2)).setResumeAction(eq(KEY), capture(actionCaptor)) @@ -455,6 +452,7 @@ class MediaResumeListenerTest : SysuiTestCase() { resumeListener.userUnlockReceiver.onReceive(mockContext, intent) // We add its resume controls + executor.runAllReady() verify(resumeBrowser).findRecentMedia() verify(mediaDataManager) .addResumptionControls(anyInt(), any(), any(), any(), any(), any(), eq(PACKAGE_NAME)) @@ -527,7 +525,7 @@ class MediaResumeListenerTest : SysuiTestCase() { // When media data is loaded that has not been checked yet, and does have a MBS val dataCopy = data.copy(resumeAction = null, hasCheckedForResume = false) - resumeListener.onMediaDataLoaded(KEY, null, dataCopy) + onMediaDataLoaded(KEY, null, dataCopy) // Then we store the new lastPlayed time verify(sharedPrefsEditor).putString(any(), (capture(componentCaptor))) @@ -546,10 +544,9 @@ class MediaResumeListenerTest : SysuiTestCase() { fun testOnMediaDataLoaded_newKeyDifferent_oldMediaBrowserDisconnected() { setUpMbsWithValidResolveInfo() - resumeListener.onMediaDataLoaded(key = KEY, oldKey = null, data) - executor.runAllReady() + onMediaDataLoaded(key = KEY, oldKey = null, data) - resumeListener.onMediaDataLoaded(key = "newKey", oldKey = KEY, data) + onMediaDataLoaded(key = "newKey", oldKey = KEY, data) verify(resumeBrowser).disconnect() } @@ -561,8 +558,7 @@ class MediaResumeListenerTest : SysuiTestCase() { // Set up mocks to return with an error whenever(resumeBrowser.testConnection()).thenAnswer { callbackCaptor.value.onError() } - resumeListener.onMediaDataLoaded(key = KEY, oldKey = null, data) - executor.runAllReady() + onMediaDataLoaded(key = KEY, oldKey = null, data) // Ensure we disconnect the browser verify(resumeBrowser).disconnect() @@ -579,8 +575,7 @@ class MediaResumeListenerTest : SysuiTestCase() { callbackCaptor.value.addTrack(description, component, resumeBrowser) } - resumeListener.onMediaDataLoaded(key = KEY, oldKey = null, data) - executor.runAllReady() + onMediaDataLoaded(key = KEY, oldKey = null, data) // Ensure we disconnect the browser verify(resumeBrowser).disconnect() @@ -598,8 +593,7 @@ class MediaResumeListenerTest : SysuiTestCase() { // Load media data that will require us to get the resume action val dataCopy = data.copy(resumeAction = null, hasCheckedForResume = false) - resumeListener.onMediaDataLoaded(KEY, null, dataCopy) - executor.runAllReady() + onMediaDataLoaded(KEY, null, dataCopy) verify(mediaDataManager, times(2)).setResumeAction(eq(KEY), capture(actionCaptor)) // Set up our factory to return a new browser so we can verify we disconnected the old one @@ -634,6 +628,7 @@ class MediaResumeListenerTest : SysuiTestCase() { // When the first user unlocks and we query their recent media userCallbackCaptor.value.onUserChanged(firstUserId, context) resumeListener.userUnlockReceiver.onReceive(context, unlockIntent) + executor.runAllReady() whenever(resumeBrowser.userId).thenReturn(userIdCaptor.value) verify(resumeBrowser, times(3)).findRecentMedia() @@ -688,4 +683,16 @@ class MediaResumeListenerTest : SysuiTestCase() { whenever(pm.resolveServiceAsUser(any(), anyInt(), anyInt())).thenReturn(resolveInfo) whenever(pm.getApplicationLabel(any())).thenReturn(PACKAGE_NAME) } + + private fun onMediaDataLoaded( + key: String, + oldKey: String?, + data: MediaData, + resume: Boolean = true + ) { + resumeListener.onMediaDataLoaded(key, oldKey, data) + if (resume) { + assertThat(executor.runAllReady()).isEqualTo(1) + } + } } -- GitLab From c984c3b842c2b458db2f1a29574af1d137f28143 Mon Sep 17 00:00:00 2001 From: Dipankar Bhardwaj Date: Wed, 21 Aug 2024 14:26:50 +0000 Subject: [PATCH 190/492] Restrict access to directories Restricted access to Android/data, Android/obb and Android/sandbox directories and its sub-directories. Replacing path's pattern match check with file equality check. Test: atest DocumentsClientTest Bug: 341680936 Flag: EXEMPT bug fix Change-Id: I8879900e57e1702d11797b81e86d0cc3f55bac22 Merged-In: I8879900e57e1702d11797b81e86d0cc3f55bac22 --- .../ExternalStorageProvider.java | 79 ++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java index 3409c29d3c2c..defbc1142adb 100644 --- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java @@ -16,8 +16,6 @@ package com.android.externalstorage; -import static java.util.regex.Pattern.CASE_INSENSITIVE; - import android.annotation.NonNull; import android.annotation.Nullable; import android.app.usage.StorageStatsManager; @@ -61,12 +59,15 @@ import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.UUID; -import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * Presents content of the shared (a.k.a. "external") storage. @@ -89,12 +90,9 @@ public class ExternalStorageProvider extends FileSystemProvider { private static final Uri BASE_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY).build(); - /** - * Regex for detecting {@code /Android/data/}, {@code /Android/obb/} and - * {@code /Android/sandbox/} along with all their subdirectories and content. - */ - private static final Pattern PATTERN_RESTRICTED_ANDROID_SUBTREES = - Pattern.compile("^Android/(?:data|obb|sandbox)(?:/.+)?", CASE_INSENSITIVE); + private static final String PRIMARY_EMULATED_STORAGE_PATH = "/storage/emulated/"; + + private static final String STORAGE_PATH = "/storage/"; private static final String[] DEFAULT_ROOT_PROJECTION = new String[] { Root.COLUMN_ROOT_ID, Root.COLUMN_FLAGS, Root.COLUMN_ICON, Root.COLUMN_TITLE, @@ -309,10 +307,69 @@ public class ExternalStorageProvider extends FileSystemProvider { return false; } - final String path = getPathFromDocId(documentId); - return PATTERN_RESTRICTED_ANDROID_SUBTREES.matcher(path).matches(); + try { + final RootInfo root = getRootFromDocId(documentId); + final String canonicalPath = getPathFromDocId(documentId); + return isRestrictedPath(root.rootId, canonicalPath); + } catch (Exception e) { + return true; + } } + /** + * Based on the given root id and path, we restrict path access if file is Android/data or + * Android/obb or Android/sandbox or one of their subdirectories. + * + * @param canonicalPath of the file + * @return true if path is restricted + */ + private boolean isRestrictedPath(String rootId, String canonicalPath) { + if (rootId == null || canonicalPath == null) { + return true; + } + + final String rootPath; + if (rootId.equalsIgnoreCase(ROOT_ID_PRIMARY_EMULATED)) { + // Creates "/storage/emulated/" + rootPath = PRIMARY_EMULATED_STORAGE_PATH + UserHandle.myUserId(); + } else { + // Creates "/storage/" + rootPath = STORAGE_PATH + rootId; + } + List restrictedPathList = Arrays.asList( + Paths.get(rootPath, "Android", "data"), + Paths.get(rootPath, "Android", "obb"), + Paths.get(rootPath, "Android", "sandbox")); + // We need to identify restricted parent paths which actually exist on the device + List validRestrictedPathsToCheck = restrictedPathList.stream().filter( + Files::exists).collect(Collectors.toList()); + + boolean isRestricted = false; + java.nio.file.Path filePathToCheck = Paths.get(rootPath, canonicalPath); + try { + while (filePathToCheck != null) { + for (java.nio.file.Path restrictedPath : validRestrictedPathsToCheck) { + if (Files.isSameFile(restrictedPath, filePathToCheck)) { + isRestricted = true; + Log.v(TAG, "Restricting access for path: " + filePathToCheck); + break; + } + } + if (isRestricted) { + break; + } + + filePathToCheck = filePathToCheck.getParent(); + } + } catch (Exception e) { + Log.w(TAG, "Error in checking file equality check.", e); + isRestricted = true; + } + + return isRestricted; + } + + /** * Check that the directory is the root of storage or blocked file from tree. *

-- GitLab From 7f1bc271379d97bed56e33f8470992d38bce5531 Mon Sep 17 00:00:00 2001 From: Dipankar Bhardwaj Date: Wed, 21 Aug 2024 14:26:50 +0000 Subject: [PATCH 191/492] Restrict access to directories Restricted access to Android/data, Android/obb and Android/sandbox directories and its sub-directories. Replacing path's pattern match check with file equality check. Test: atest DocumentsClientTest Bug: 341680936 Flag: EXEMPT bug fix Change-Id: I8879900e57e1702d11797b81e86d0cc3f55bac22 Merged-In: I8879900e57e1702d11797b81e86d0cc3f55bac22 --- .../ExternalStorageProvider.java | 79 ++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java index 3409c29d3c2c..defbc1142adb 100644 --- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java @@ -16,8 +16,6 @@ package com.android.externalstorage; -import static java.util.regex.Pattern.CASE_INSENSITIVE; - import android.annotation.NonNull; import android.annotation.Nullable; import android.app.usage.StorageStatsManager; @@ -61,12 +59,15 @@ import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.UUID; -import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * Presents content of the shared (a.k.a. "external") storage. @@ -89,12 +90,9 @@ public class ExternalStorageProvider extends FileSystemProvider { private static final Uri BASE_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY).build(); - /** - * Regex for detecting {@code /Android/data/}, {@code /Android/obb/} and - * {@code /Android/sandbox/} along with all their subdirectories and content. - */ - private static final Pattern PATTERN_RESTRICTED_ANDROID_SUBTREES = - Pattern.compile("^Android/(?:data|obb|sandbox)(?:/.+)?", CASE_INSENSITIVE); + private static final String PRIMARY_EMULATED_STORAGE_PATH = "/storage/emulated/"; + + private static final String STORAGE_PATH = "/storage/"; private static final String[] DEFAULT_ROOT_PROJECTION = new String[] { Root.COLUMN_ROOT_ID, Root.COLUMN_FLAGS, Root.COLUMN_ICON, Root.COLUMN_TITLE, @@ -309,10 +307,69 @@ public class ExternalStorageProvider extends FileSystemProvider { return false; } - final String path = getPathFromDocId(documentId); - return PATTERN_RESTRICTED_ANDROID_SUBTREES.matcher(path).matches(); + try { + final RootInfo root = getRootFromDocId(documentId); + final String canonicalPath = getPathFromDocId(documentId); + return isRestrictedPath(root.rootId, canonicalPath); + } catch (Exception e) { + return true; + } } + /** + * Based on the given root id and path, we restrict path access if file is Android/data or + * Android/obb or Android/sandbox or one of their subdirectories. + * + * @param canonicalPath of the file + * @return true if path is restricted + */ + private boolean isRestrictedPath(String rootId, String canonicalPath) { + if (rootId == null || canonicalPath == null) { + return true; + } + + final String rootPath; + if (rootId.equalsIgnoreCase(ROOT_ID_PRIMARY_EMULATED)) { + // Creates "/storage/emulated/" + rootPath = PRIMARY_EMULATED_STORAGE_PATH + UserHandle.myUserId(); + } else { + // Creates "/storage/" + rootPath = STORAGE_PATH + rootId; + } + List restrictedPathList = Arrays.asList( + Paths.get(rootPath, "Android", "data"), + Paths.get(rootPath, "Android", "obb"), + Paths.get(rootPath, "Android", "sandbox")); + // We need to identify restricted parent paths which actually exist on the device + List validRestrictedPathsToCheck = restrictedPathList.stream().filter( + Files::exists).collect(Collectors.toList()); + + boolean isRestricted = false; + java.nio.file.Path filePathToCheck = Paths.get(rootPath, canonicalPath); + try { + while (filePathToCheck != null) { + for (java.nio.file.Path restrictedPath : validRestrictedPathsToCheck) { + if (Files.isSameFile(restrictedPath, filePathToCheck)) { + isRestricted = true; + Log.v(TAG, "Restricting access for path: " + filePathToCheck); + break; + } + } + if (isRestricted) { + break; + } + + filePathToCheck = filePathToCheck.getParent(); + } + } catch (Exception e) { + Log.w(TAG, "Error in checking file equality check.", e); + isRestricted = true; + } + + return isRestricted; + } + + /** * Check that the directory is the root of storage or blocked file from tree. *

-- GitLab From 6853df6f934cda97512f09d4ee24035b0cb6bda3 Mon Sep 17 00:00:00 2001 From: Dipankar Bhardwaj Date: Wed, 21 Aug 2024 14:26:50 +0000 Subject: [PATCH 192/492] Restrict access to directories Restricted access to Android/data, Android/obb and Android/sandbox directories and its sub-directories. Replacing path's pattern match check with file equality check. Test: atest DocumentsClientTest Bug: 341680936 Flag: EXEMPT bug fix Change-Id: I8879900e57e1702d11797b81e86d0cc3f55bac22 Merged-In: I8879900e57e1702d11797b81e86d0cc3f55bac22 --- .../ExternalStorageProvider.java | 79 ++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java index 3409c29d3c2c..defbc1142adb 100644 --- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java @@ -16,8 +16,6 @@ package com.android.externalstorage; -import static java.util.regex.Pattern.CASE_INSENSITIVE; - import android.annotation.NonNull; import android.annotation.Nullable; import android.app.usage.StorageStatsManager; @@ -61,12 +59,15 @@ import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.UUID; -import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * Presents content of the shared (a.k.a. "external") storage. @@ -89,12 +90,9 @@ public class ExternalStorageProvider extends FileSystemProvider { private static final Uri BASE_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY).build(); - /** - * Regex for detecting {@code /Android/data/}, {@code /Android/obb/} and - * {@code /Android/sandbox/} along with all their subdirectories and content. - */ - private static final Pattern PATTERN_RESTRICTED_ANDROID_SUBTREES = - Pattern.compile("^Android/(?:data|obb|sandbox)(?:/.+)?", CASE_INSENSITIVE); + private static final String PRIMARY_EMULATED_STORAGE_PATH = "/storage/emulated/"; + + private static final String STORAGE_PATH = "/storage/"; private static final String[] DEFAULT_ROOT_PROJECTION = new String[] { Root.COLUMN_ROOT_ID, Root.COLUMN_FLAGS, Root.COLUMN_ICON, Root.COLUMN_TITLE, @@ -309,10 +307,69 @@ public class ExternalStorageProvider extends FileSystemProvider { return false; } - final String path = getPathFromDocId(documentId); - return PATTERN_RESTRICTED_ANDROID_SUBTREES.matcher(path).matches(); + try { + final RootInfo root = getRootFromDocId(documentId); + final String canonicalPath = getPathFromDocId(documentId); + return isRestrictedPath(root.rootId, canonicalPath); + } catch (Exception e) { + return true; + } } + /** + * Based on the given root id and path, we restrict path access if file is Android/data or + * Android/obb or Android/sandbox or one of their subdirectories. + * + * @param canonicalPath of the file + * @return true if path is restricted + */ + private boolean isRestrictedPath(String rootId, String canonicalPath) { + if (rootId == null || canonicalPath == null) { + return true; + } + + final String rootPath; + if (rootId.equalsIgnoreCase(ROOT_ID_PRIMARY_EMULATED)) { + // Creates "/storage/emulated/" + rootPath = PRIMARY_EMULATED_STORAGE_PATH + UserHandle.myUserId(); + } else { + // Creates "/storage/" + rootPath = STORAGE_PATH + rootId; + } + List restrictedPathList = Arrays.asList( + Paths.get(rootPath, "Android", "data"), + Paths.get(rootPath, "Android", "obb"), + Paths.get(rootPath, "Android", "sandbox")); + // We need to identify restricted parent paths which actually exist on the device + List validRestrictedPathsToCheck = restrictedPathList.stream().filter( + Files::exists).collect(Collectors.toList()); + + boolean isRestricted = false; + java.nio.file.Path filePathToCheck = Paths.get(rootPath, canonicalPath); + try { + while (filePathToCheck != null) { + for (java.nio.file.Path restrictedPath : validRestrictedPathsToCheck) { + if (Files.isSameFile(restrictedPath, filePathToCheck)) { + isRestricted = true; + Log.v(TAG, "Restricting access for path: " + filePathToCheck); + break; + } + } + if (isRestricted) { + break; + } + + filePathToCheck = filePathToCheck.getParent(); + } + } catch (Exception e) { + Log.w(TAG, "Error in checking file equality check.", e); + isRestricted = true; + } + + return isRestricted; + } + + /** * Check that the directory is the root of storage or blocked file from tree. *

-- GitLab From fc29b1480d2f5a366dbd0428afeaaff20f304e04 Mon Sep 17 00:00:00 2001 From: Dipankar Bhardwaj Date: Wed, 21 Aug 2024 14:26:50 +0000 Subject: [PATCH 193/492] Restrict access to directories Restricted access to Android/data, Android/obb and Android/sandbox directories and its sub-directories. Replacing path's pattern match check with file equality check. Test: atest DocumentsClientTest Bug: 341680936 Flag: EXEMPT bug fix Change-Id: I8879900e57e1702d11797b81e86d0cc3f55bac22 Merged-In: I8879900e57e1702d11797b81e86d0cc3f55bac22 --- .../ExternalStorageProvider.java | 79 ++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java index 3409c29d3c2c..defbc1142adb 100644 --- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java @@ -16,8 +16,6 @@ package com.android.externalstorage; -import static java.util.regex.Pattern.CASE_INSENSITIVE; - import android.annotation.NonNull; import android.annotation.Nullable; import android.app.usage.StorageStatsManager; @@ -61,12 +59,15 @@ import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.UUID; -import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * Presents content of the shared (a.k.a. "external") storage. @@ -89,12 +90,9 @@ public class ExternalStorageProvider extends FileSystemProvider { private static final Uri BASE_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY).build(); - /** - * Regex for detecting {@code /Android/data/}, {@code /Android/obb/} and - * {@code /Android/sandbox/} along with all their subdirectories and content. - */ - private static final Pattern PATTERN_RESTRICTED_ANDROID_SUBTREES = - Pattern.compile("^Android/(?:data|obb|sandbox)(?:/.+)?", CASE_INSENSITIVE); + private static final String PRIMARY_EMULATED_STORAGE_PATH = "/storage/emulated/"; + + private static final String STORAGE_PATH = "/storage/"; private static final String[] DEFAULT_ROOT_PROJECTION = new String[] { Root.COLUMN_ROOT_ID, Root.COLUMN_FLAGS, Root.COLUMN_ICON, Root.COLUMN_TITLE, @@ -309,10 +307,69 @@ public class ExternalStorageProvider extends FileSystemProvider { return false; } - final String path = getPathFromDocId(documentId); - return PATTERN_RESTRICTED_ANDROID_SUBTREES.matcher(path).matches(); + try { + final RootInfo root = getRootFromDocId(documentId); + final String canonicalPath = getPathFromDocId(documentId); + return isRestrictedPath(root.rootId, canonicalPath); + } catch (Exception e) { + return true; + } } + /** + * Based on the given root id and path, we restrict path access if file is Android/data or + * Android/obb or Android/sandbox or one of their subdirectories. + * + * @param canonicalPath of the file + * @return true if path is restricted + */ + private boolean isRestrictedPath(String rootId, String canonicalPath) { + if (rootId == null || canonicalPath == null) { + return true; + } + + final String rootPath; + if (rootId.equalsIgnoreCase(ROOT_ID_PRIMARY_EMULATED)) { + // Creates "/storage/emulated/" + rootPath = PRIMARY_EMULATED_STORAGE_PATH + UserHandle.myUserId(); + } else { + // Creates "/storage/" + rootPath = STORAGE_PATH + rootId; + } + List restrictedPathList = Arrays.asList( + Paths.get(rootPath, "Android", "data"), + Paths.get(rootPath, "Android", "obb"), + Paths.get(rootPath, "Android", "sandbox")); + // We need to identify restricted parent paths which actually exist on the device + List validRestrictedPathsToCheck = restrictedPathList.stream().filter( + Files::exists).collect(Collectors.toList()); + + boolean isRestricted = false; + java.nio.file.Path filePathToCheck = Paths.get(rootPath, canonicalPath); + try { + while (filePathToCheck != null) { + for (java.nio.file.Path restrictedPath : validRestrictedPathsToCheck) { + if (Files.isSameFile(restrictedPath, filePathToCheck)) { + isRestricted = true; + Log.v(TAG, "Restricting access for path: " + filePathToCheck); + break; + } + } + if (isRestricted) { + break; + } + + filePathToCheck = filePathToCheck.getParent(); + } + } catch (Exception e) { + Log.w(TAG, "Error in checking file equality check.", e); + isRestricted = true; + } + + return isRestricted; + } + + /** * Check that the directory is the root of storage or blocked file from tree. *

-- GitLab From 126dca0b33c3bc9057d0e5f9ceb85162b6fd75bf Mon Sep 17 00:00:00 2001 From: Vladimir Komsiyski Date: Tue, 10 Sep 2024 14:00:09 +0000 Subject: [PATCH 194/492] Remove wrongly added is_exported=true The display_power_manager_apis flag doesn't actually guard any APIs and doesn't need to be exported Bug: n/a Test: presubmit Flag: EXEMPT flag only change Change-Id: I31e4c9de17e538e911749beb03d074e4a8a61c23 --- core/java/android/companion/virtual/flags/flags.aconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/core/java/android/companion/virtual/flags/flags.aconfig b/core/java/android/companion/virtual/flags/flags.aconfig index 6f1327caf33d..4a5b09b229cb 100644 --- a/core/java/android/companion/virtual/flags/flags.aconfig +++ b/core/java/android/companion/virtual/flags/flags.aconfig @@ -121,7 +121,6 @@ flag { description: "Make relevant PowerManager APIs display aware by default" bug: "365042486" is_fixed_read_only: true - is_exported: true } flag { -- GitLab From 38a90aefe2bdef2b10cc8cb4300a6d412d5706e8 Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Tue, 10 Sep 2024 13:47:39 +0000 Subject: [PATCH 195/492] Add util to get package name from runtime metadata schema Context: This will be used to obtain the corresponding package that owns the schema from a getSchemaResponse. Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: I80200320c228e621bdff969e7be2e28f9b63d0c7 --- .../AppFunctionRuntimeMetadata.java | 14 +++ .../AppFunctionRuntimeMetadataTest.kt | 104 ++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 services/tests/appfunctions/src/android/app/appfunctions/AppFunctionRuntimeMetadataTest.kt diff --git a/core/java/android/app/appfunctions/AppFunctionRuntimeMetadata.java b/core/java/android/app/appfunctions/AppFunctionRuntimeMetadata.java index c4bfae98e33d..f5c5a11f45fb 100644 --- a/core/java/android/app/appfunctions/AppFunctionRuntimeMetadata.java +++ b/core/java/android/app/appfunctions/AppFunctionRuntimeMetadata.java @@ -61,6 +61,20 @@ public class AppFunctionRuntimeMetadata extends GenericDocument { return RUNTIME_SCHEMA_TYPE + RUNTIME_SCHEMA_TYPE_SEPARATOR + Objects.requireNonNull(pkg); } + /** Returns the package name from the runtime metadata schema name. */ + @NonNull + public static String getPackageNameFromSchema(String metadataSchemaType) { + String[] split = metadataSchemaType.split(RUNTIME_SCHEMA_TYPE_SEPARATOR); + if (split.length > 2) { + throw new IllegalArgumentException( + "Invalid schema type: " + metadataSchemaType + " for app function runtime"); + } + if (split.length < 2) { + return APP_FUNCTION_INDEXER_PACKAGE; + } + return split[1]; + } + /** Returns the document id for an app function's runtime metadata. */ public static String getDocumentIdForAppFunction( @NonNull String pkg, @NonNull String functionId) { diff --git a/services/tests/appfunctions/src/android/app/appfunctions/AppFunctionRuntimeMetadataTest.kt b/services/tests/appfunctions/src/android/app/appfunctions/AppFunctionRuntimeMetadataTest.kt new file mode 100644 index 000000000000..650e520ebb7d --- /dev/null +++ b/services/tests/appfunctions/src/android/app/appfunctions/AppFunctionRuntimeMetadataTest.kt @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.app.appfunctions + +import android.app.appsearch.AppSearchSchema +import com.google.common.truth.Truth.assertThat +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(JUnit4::class) +class AppFunctionRuntimeMetadataTest { + + @Test + fun getRuntimeSchemaNameForPackage() { + val actualSchemaName = + AppFunctionRuntimeMetadata.getRuntimeSchemaNameForPackage("com.example.app") + + assertThat(actualSchemaName).isEqualTo("AppFunctionRuntimeMetadata-com.example.app") + } + + @Test + fun testCreateChildRuntimeSchema() { + val runtimeSchema: AppSearchSchema = + AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema("com.example.app") + + assertThat(runtimeSchema.schemaType).isEqualTo("AppFunctionRuntimeMetadata-com.example.app") + val propertyNameSet = runtimeSchema.properties.map { it.name }.toSet() + assertThat(propertyNameSet.contains(AppFunctionRuntimeMetadata.PROPERTY_FUNCTION_ID)) + .isTrue() + assertThat(propertyNameSet.contains(AppFunctionRuntimeMetadata.PROPERTY_PACKAGE_NAME)) + .isTrue() + assertThat(propertyNameSet.contains(AppFunctionRuntimeMetadata.PROPERTY_ENABLED)).isTrue() + assertThat( + propertyNameSet.contains( + AppFunctionRuntimeMetadata.PROPERTY_APP_FUNCTION_STATIC_METADATA_QUALIFIED_ID + ) + ) + .isTrue() + } + + @Test + fun testCreateParentRuntimeSchema() { + val runtimeSchema: AppSearchSchema = + AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema() + + assertThat(runtimeSchema.schemaType).isEqualTo("AppFunctionRuntimeMetadata") + val propertyNameSet = runtimeSchema.properties.map { it.name }.toSet() + assertThat(propertyNameSet.contains(AppFunctionRuntimeMetadata.PROPERTY_FUNCTION_ID)) + .isTrue() + assertThat(propertyNameSet.contains(AppFunctionRuntimeMetadata.PROPERTY_PACKAGE_NAME)) + .isTrue() + assertThat(propertyNameSet.contains(AppFunctionRuntimeMetadata.PROPERTY_ENABLED)).isTrue() + assertThat( + propertyNameSet.contains( + AppFunctionRuntimeMetadata.PROPERTY_APP_FUNCTION_STATIC_METADATA_QUALIFIED_ID + ) + ) + .isTrue() + } + + @Test + fun testGetPackageNameFromSchema() { + val expectedPackageName = "com.foo.test" + val expectedPackageName2 = "com.bar.test" + val testSchemaType = + AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(expectedPackageName) + .schemaType + val testSchemaType2 = + AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(expectedPackageName2) + .schemaType + + val actualPackageName = AppFunctionRuntimeMetadata.getPackageNameFromSchema(testSchemaType) + val actualPackageName2 = + AppFunctionRuntimeMetadata.getPackageNameFromSchema(testSchemaType2) + + assertThat(actualPackageName).isEqualTo(expectedPackageName) + assertThat(actualPackageName2).isEqualTo(expectedPackageName2) + } + + @Test + fun testGetPackageNameFromParentSchema() { + val expectedPackageName = AppFunctionRuntimeMetadata.APP_FUNCTION_INDEXER_PACKAGE + val testSchemaType = + AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema().schemaType + + val actualPackageName = AppFunctionRuntimeMetadata.getPackageNameFromSchema(testSchemaType) + + assertThat(actualPackageName).isEqualTo(expectedPackageName) + } +} -- GitLab From ebe0507b36391126b20e673556fac73ddb2189db Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Tue, 10 Sep 2024 14:00:21 +0000 Subject: [PATCH 196/492] [MetadataSyncAdapter cleanUp] - require nonnull for non nullables Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest FrameworksAppFunctionsTests -c Bug: 357551503 Change-Id: Icd59f53eddab9b53a53a7863ff6e413d3df2d094 --- .../appfunctions/MetadataSyncAdapter.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java b/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java index 35fa47aedd51..01e10086a03a 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java +++ b/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java @@ -61,8 +61,11 @@ public class MetadataSyncAdapter { @NonNull @VisibleForTesting static ArrayMap> getAddedFunctionsDiffMap( - ArrayMap> staticPackageToFunctionMap, - ArrayMap> runtimePackageToFunctionMap) { + @NonNull ArrayMap> staticPackageToFunctionMap, + @NonNull ArrayMap> runtimePackageToFunctionMap) { + Objects.requireNonNull(staticPackageToFunctionMap); + Objects.requireNonNull(runtimePackageToFunctionMap); + return getFunctionsDiffMap(staticPackageToFunctionMap, runtimePackageToFunctionMap); } @@ -80,15 +83,21 @@ public class MetadataSyncAdapter { @NonNull @VisibleForTesting static ArrayMap> getRemovedFunctionsDiffMap( - ArrayMap> staticPackageToFunctionMap, - ArrayMap> runtimePackageToFunctionMap) { + @NonNull ArrayMap> staticPackageToFunctionMap, + @NonNull ArrayMap> runtimePackageToFunctionMap) { + Objects.requireNonNull(staticPackageToFunctionMap); + Objects.requireNonNull(runtimePackageToFunctionMap); + return getFunctionsDiffMap(runtimePackageToFunctionMap, staticPackageToFunctionMap); } @NonNull private static ArrayMap> getFunctionsDiffMap( - ArrayMap> packageToFunctionMapA, - ArrayMap> packageToFunctionMapB) { + @NonNull ArrayMap> packageToFunctionMapA, + @NonNull ArrayMap> packageToFunctionMapB) { + Objects.requireNonNull(packageToFunctionMapA); + Objects.requireNonNull(packageToFunctionMapB); + ArrayMap> diffMap = new ArrayMap<>(); for (String packageName : packageToFunctionMapA.keySet()) { if (!packageToFunctionMapB.containsKey(packageName)) { @@ -125,6 +134,9 @@ public class MetadataSyncAdapter { @NonNull String propertyFunctionId, @NonNull String propertyPackageName) throws ExecutionException, InterruptedException { + Objects.requireNonNull(schemaType); + Objects.requireNonNull(propertyFunctionId); + Objects.requireNonNull(propertyPackageName); ArrayMap> packageToFunctionIds = new ArrayMap<>(); FutureSearchResults futureSearchResults = @@ -164,6 +176,9 @@ public class MetadataSyncAdapter { @NonNull String schemaType, @NonNull String propertyFunctionId, @NonNull String propertyPackageName) { + Objects.requireNonNull(schemaType); + Objects.requireNonNull(propertyFunctionId); + Objects.requireNonNull(propertyPackageName); return new SearchSpec.Builder() .addFilterSchemas(schemaType) .addProjectionPaths( -- GitLab From 9d3544d2bb0a03daa7a90ac23ed08e5d73755a85 Mon Sep 17 00:00:00 2001 From: Michael Mikhail Date: Mon, 9 Sep 2024 19:48:27 +0000 Subject: [PATCH 197/492] Apply media notification comparison technique on legacy code This CL has a minor fix, to ensure that the duration for added media notification is updated. Flag: com.android.systemui.media_controls_posts_optimization Bug: 358645640 Test: atest LegacyMediaDataManagerImplTest Test: checked ui and simple perf. Change-Id: I2980cb9251636105098d604cf8cc4a617e16eb71 --- .../pipeline/LegacyMediaDataManagerImpl.kt | 166 ++++++++++-------- .../controls/ui/viewmodel/SeekBarViewModel.kt | 34 ++-- .../LegacyMediaDataManagerImplTest.kt | 49 +++++- 3 files changed, 161 insertions(+), 88 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt index 4ad437c50d61..84aae652795e 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt @@ -70,6 +70,7 @@ import com.android.systemui.dump.DumpManager import com.android.systemui.media.controls.domain.pipeline.MediaDataManager.Companion.isMediaNotification import com.android.systemui.media.controls.domain.resume.MediaResumeListener import com.android.systemui.media.controls.domain.resume.ResumeMediaBrowser +import com.android.systemui.media.controls.shared.MediaLogger import com.android.systemui.media.controls.shared.model.EXTRA_KEY_TRIGGER_SOURCE import com.android.systemui.media.controls.shared.model.EXTRA_VALUE_TRIGGER_PERIODIC import com.android.systemui.media.controls.shared.model.MediaAction @@ -84,7 +85,7 @@ import com.android.systemui.media.controls.util.MediaControllerFactory import com.android.systemui.media.controls.util.MediaDataUtils import com.android.systemui.media.controls.util.MediaFlags import com.android.systemui.media.controls.util.MediaUiEventLogger -import com.android.systemui.plugins.ActivityStarter +import com.android.systemui.media.controls.util.SmallHash import com.android.systemui.plugins.BcSmartspaceDataPlugin import com.android.systemui.res.R import com.android.systemui.statusbar.NotificationMediaManager.isPlayingState @@ -186,7 +187,6 @@ class LegacyMediaDataManagerImpl( private val mediaDeviceManager: MediaDeviceManager, mediaDataCombineLatest: MediaDataCombineLatest, private val mediaDataFilter: LegacyMediaDataFilterImpl, - private val activityStarter: ActivityStarter, private val smartspaceMediaDataProvider: SmartspaceMediaDataProvider, private var useMediaResumption: Boolean, private val useQsMediaPlayer: Boolean, @@ -197,6 +197,7 @@ class LegacyMediaDataManagerImpl( private val smartspaceManager: SmartspaceManager?, private val keyguardUpdateMonitor: KeyguardUpdateMonitor, private val mediaDataLoader: dagger.Lazy, + private val mediaLogger: MediaLogger, ) : Dumpable, BcSmartspaceDataPlugin.SmartspaceTargetListener, MediaDataManager { companion object { @@ -273,7 +274,6 @@ class LegacyMediaDataManagerImpl( mediaDeviceManager: MediaDeviceManager, mediaDataCombineLatest: MediaDataCombineLatest, mediaDataFilter: LegacyMediaDataFilterImpl, - activityStarter: ActivityStarter, smartspaceMediaDataProvider: SmartspaceMediaDataProvider, clock: SystemClock, tunerService: TunerService, @@ -282,6 +282,7 @@ class LegacyMediaDataManagerImpl( smartspaceManager: SmartspaceManager?, keyguardUpdateMonitor: KeyguardUpdateMonitor, mediaDataLoader: dagger.Lazy, + mediaLogger: MediaLogger, ) : this( context, // Loading bitmap for UMO background can take longer time, so it cannot run on the default @@ -301,7 +302,6 @@ class LegacyMediaDataManagerImpl( mediaDeviceManager, mediaDataCombineLatest, mediaDataFilter, - activityStarter, smartspaceMediaDataProvider, Utils.useMediaResumption(context), Utils.useQsMediaPlayer(context), @@ -312,6 +312,7 @@ class LegacyMediaDataManagerImpl( smartspaceManager, keyguardUpdateMonitor, mediaDataLoader, + mediaLogger, ) private val appChangeReceiver = @@ -564,6 +565,42 @@ class LegacyMediaDataManagerImpl( val resumeAction: Runnable? = currentEntry?.resumeAction val hasCheckedForResume = currentEntry?.hasCheckedForResume == true val active = currentEntry?.active ?: true + val mediaController = mediaControllerFactory.create(result.token!!) + + val mediaData = + MediaData( + userId = sbn.normalizedUserId, + initialized = true, + app = result.appName, + appIcon = result.appIcon, + artist = result.artist, + song = result.song, + artwork = result.artworkIcon, + actions = result.actionIcons, + actionsToShowInCompact = result.actionsToShowInCompact, + semanticActions = result.semanticActions, + packageName = sbn.packageName, + token = result.token, + clickIntent = result.clickIntent, + device = result.device, + active = active, + resumeAction = resumeAction, + playbackLocation = result.playbackLocation, + notificationKey = key, + hasCheckedForResume = hasCheckedForResume, + isPlaying = result.isPlaying, + isClearable = !sbn.isOngoing, + lastActive = lastActive, + createdTimestampMillis = createdTimestampMillis, + instanceId = instanceId, + appUid = result.appUid, + isExplicit = result.isExplicit, + ) + + if (isSameMediaData(context, mediaController, mediaData, currentEntry)) { + mediaLogger.logDuplicateMediaNotification(key) + return@withContext + } // We need to log the correct media added. if (isNewlyActiveEntry) { @@ -583,40 +620,7 @@ class LegacyMediaDataManagerImpl( ) } - withContext(mainDispatcher) { - onMediaDataLoaded( - key, - oldKey, - MediaData( - userId = sbn.normalizedUserId, - initialized = true, - app = result.appName, - appIcon = result.appIcon, - artist = result.artist, - song = result.song, - artwork = result.artworkIcon, - actions = result.actionIcons, - actionsToShowInCompact = result.actionsToShowInCompact, - semanticActions = result.semanticActions, - packageName = sbn.packageName, - token = result.token, - clickIntent = result.clickIntent, - device = result.device, - active = active, - resumeAction = resumeAction, - playbackLocation = result.playbackLocation, - notificationKey = key, - hasCheckedForResume = hasCheckedForResume, - isPlaying = result.isPlaying, - isClearable = !sbn.isOngoing, - lastActive = lastActive, - createdTimestampMillis = createdTimestampMillis, - instanceId = instanceId, - appUid = result.appUid, - isExplicit = result.isExplicit, - ) - ) - } + withContext(mainDispatcher) { onMediaDataLoaded(key, oldKey, mediaData) } } /** Add a listener for changes in this class */ @@ -1100,6 +1104,47 @@ class LegacyMediaDataManagerImpl( val instanceId = currentEntry?.instanceId ?: logger.getNewInstanceId() val appUid = appInfo?.uid ?: Process.INVALID_UID + val lastActive = systemClock.elapsedRealtime() + val createdTimestampMillis = currentEntry?.createdTimestampMillis ?: 0L + val resumeAction: Runnable? = mediaEntries[key]?.resumeAction + val hasCheckedForResume = mediaEntries[key]?.hasCheckedForResume == true + val active = mediaEntries[key]?.active ?: true + var mediaData = + MediaData( + sbn.normalizedUserId, + true, + appName, + smallIcon, + artist, + song, + artWorkIcon, + actionIcons, + actionsToShowCollapsed, + semanticActions, + sbn.packageName, + token, + notif.contentIntent, + device, + active, + resumeAction = resumeAction, + playbackLocation = playbackLocation, + notificationKey = key, + hasCheckedForResume = hasCheckedForResume, + isPlaying = isPlaying, + isClearable = !sbn.isOngoing, + lastActive = lastActive, + createdTimestampMillis = createdTimestampMillis, + instanceId = instanceId, + appUid = appUid, + isExplicit = isExplicit, + smartspaceId = SmallHash.hash(appUid + systemClock.currentTimeMillis().toInt()), + ) + + if (isSameMediaData(context, mediaController, mediaData, currentEntry)) { + mediaLogger.logDuplicateMediaNotification(key) + return + } + if (isNewlyActiveEntry) { logSingleVsMultipleMediaAdded(appUid, sbn.packageName, instanceId) logger.logActiveMediaAdded(appUid, sbn.packageName, instanceId, playbackLocation) @@ -1107,44 +1152,17 @@ class LegacyMediaDataManagerImpl( logger.logPlaybackLocationChange(appUid, sbn.packageName, instanceId, playbackLocation) } - val lastActive = systemClock.elapsedRealtime() - val createdTimestampMillis = currentEntry?.createdTimestampMillis ?: 0L foregroundExecutor.execute { - val resumeAction: Runnable? = mediaEntries[key]?.resumeAction - val hasCheckedForResume = mediaEntries[key]?.hasCheckedForResume == true - val active = mediaEntries[key]?.active ?: true - onMediaDataLoaded( - key, - oldKey, - MediaData( - sbn.normalizedUserId, - true, - appName, - smallIcon, - artist, - song, - artWorkIcon, - actionIcons, - actionsToShowCollapsed, - semanticActions, - sbn.packageName, - token, - notif.contentIntent, - device, - active, - resumeAction = resumeAction, - playbackLocation = playbackLocation, - notificationKey = key, - hasCheckedForResume = hasCheckedForResume, - isPlaying = isPlaying, - isClearable = !sbn.isOngoing, - lastActive = lastActive, - createdTimestampMillis = createdTimestampMillis, - instanceId = instanceId, - appUid = appUid, - isExplicit = isExplicit, + val oldResumeAction: Runnable? = mediaEntries[key]?.resumeAction + val oldHasCheckedForResume = mediaEntries[key]?.hasCheckedForResume == true + val oldActive = mediaEntries[key]?.active ?: true + mediaData = + mediaData.copy( + resumeAction = oldResumeAction, + hasCheckedForResume = oldHasCheckedForResume, + active = oldActive ) - ) + onMediaDataLoaded(key, oldKey, mediaData) } } diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/viewmodel/SeekBarViewModel.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/viewmodel/SeekBarViewModel.kt index cef1e69e7b6a..2a9fe8314349 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/viewmodel/SeekBarViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/viewmodel/SeekBarViewModel.kt @@ -32,6 +32,7 @@ import androidx.annotation.WorkerThread import androidx.core.view.GestureDetectorCompat import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData +import com.android.systemui.Flags import com.android.systemui.classifier.Classifier.MEDIA_SEEKBAR import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.plugins.FalsingManager @@ -102,9 +103,11 @@ constructor( } _progress.postValue(value) } + private val _progress = MutableLiveData().apply { postValue(_data) } val progress: LiveData get() = _progress + private var controller: MediaController? = null set(value) { if (field?.sessionToken != value?.sessionToken) { @@ -113,6 +116,7 @@ constructor( field = value } } + private var playbackState: PlaybackState? = null private var callback = object : MediaController.Callback() { @@ -128,6 +132,15 @@ constructor( override fun onSessionDestroyed() { clearController() } + + override fun onMetadataChanged(metadata: MediaMetadata?) { + if (!Flags.mediaControlsPostsOptimization()) return + + val (enabled, duration) = getEnabledStateAndDuration(metadata) + if (_data.duration != duration) { + _data = _data.copy(enabled = enabled, duration = duration) + } + } } private var cancel: Runnable? = null @@ -233,22 +246,13 @@ constructor( fun updateController(mediaController: MediaController?) { controller = mediaController playbackState = controller?.playbackState - val mediaMetadata = controller?.metadata + val (enabled, duration) = getEnabledStateAndDuration(controller?.metadata) val seekAvailable = ((playbackState?.actions ?: 0L) and PlaybackState.ACTION_SEEK_TO) != 0L val position = playbackState?.position?.toInt() - val duration = mediaMetadata?.getLong(MediaMetadata.METADATA_KEY_DURATION)?.toInt() ?: 0 val playing = NotificationMediaManager.isPlayingState( playbackState?.state ?: PlaybackState.STATE_NONE ) - val enabled = - if ( - playbackState == null || - playbackState?.getState() == PlaybackState.STATE_NONE || - (duration <= 0) - ) - false - else true _data = Progress(enabled, seekAvailable, playing, scrubbing, position, duration, listening) checkIfPollingNeeded() } @@ -368,6 +372,16 @@ constructor( } } + /** returns a pair of whether seekbar is enabled and the duration of media. */ + private fun getEnabledStateAndDuration(metadata: MediaMetadata?): Pair { + val duration = metadata?.getLong(MediaMetadata.METADATA_KEY_DURATION)?.toInt() ?: 0 + val enabled = + !(playbackState == null || + playbackState?.state == PlaybackState.STATE_NONE || + (duration <= 0)) + return Pair(enabled, duration) + } + /** * This method specifies if user made a bad seekbar grab or not. If the vertical distance from * first touch on seekbar is more than the horizontal distance, this means that the seekbar grab diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImplTest.kt index 3c743744dd58..823a23dec4ea 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImplTest.kt @@ -38,6 +38,8 @@ import android.media.session.MediaSession import android.media.session.PlaybackState import android.net.Uri import android.os.Bundle +import android.platform.test.annotations.DisableFlags +import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import android.provider.Settings import android.service.notification.StatusBarNotification @@ -61,6 +63,8 @@ import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.media.controls.domain.resume.MediaResumeListener import com.android.systemui.media.controls.domain.resume.ResumeMediaBrowser +import com.android.systemui.media.controls.shared.mediaLogger +import com.android.systemui.media.controls.shared.mockMediaLogger import com.android.systemui.media.controls.shared.model.EXTRA_KEY_TRIGGER_SOURCE import com.android.systemui.media.controls.shared.model.EXTRA_VALUE_TRIGGER_PERIODIC import com.android.systemui.media.controls.shared.model.MediaData @@ -69,7 +73,6 @@ import com.android.systemui.media.controls.shared.model.SmartspaceMediaDataProvi import com.android.systemui.media.controls.util.MediaUiEventLogger import com.android.systemui.media.controls.util.fakeMediaControllerFactory import com.android.systemui.media.controls.util.mediaFlags -import com.android.systemui.plugins.activityStarter import com.android.systemui.res.R import com.android.systemui.statusbar.SbnBuilder import com.android.systemui.testKosmos @@ -186,11 +189,10 @@ class LegacyMediaDataManagerImplTest(flags: FlagsParameterization) : SysuiTestCa mSetFlagsRule.setFlagsParameterization(flags) } - private val kosmos = testKosmos() + private val kosmos = testKosmos().apply { mediaLogger = mockMediaLogger } private val testDispatcher = kosmos.testDispatcher private val testScope = kosmos.testScope private val fakeFeatureFlags = kosmos.fakeFeatureFlagsClassic - private val activityStarter = kosmos.activityStarter private val mediaControllerFactory = kosmos.fakeMediaControllerFactory private val instanceIdSequence = InstanceIdSequenceFake(1 shl 20) @@ -240,7 +242,6 @@ class LegacyMediaDataManagerImplTest(flags: FlagsParameterization) : SysuiTestCa mediaDeviceManager = mediaDeviceManager, mediaDataCombineLatest = mediaDataCombineLatest, mediaDataFilter = mediaDataFilter, - activityStarter = activityStarter, smartspaceMediaDataProvider = smartspaceMediaDataProvider, useMediaResumption = true, useQsMediaPlayer = true, @@ -251,6 +252,7 @@ class LegacyMediaDataManagerImplTest(flags: FlagsParameterization) : SysuiTestCa smartspaceManager = smartspaceManager, keyguardUpdateMonitor = keyguardUpdateMonitor, mediaDataLoader = { kosmos.mediaDataLoader }, + mediaLogger = kosmos.mediaLogger, ) verify(tunerService) .addTunable(capture(tunableCaptor), eq(Settings.Secure.MEDIA_CONTROLS_RECOMMENDATION)) @@ -2404,6 +2406,45 @@ class LegacyMediaDataManagerImplTest(flags: FlagsParameterization) : SysuiTestCa assertThat(mediaDataCaptor.value.artwork).isNull() } + @Test + @EnableFlags(Flags.FLAG_MEDIA_CONTROLS_POSTS_OPTIMIZATION) + fun postDuplicateNotification_doesNotCallListeners() { + addNotificationAndLoad() + reset(listener) + mediaDataManager.onNotificationAdded(KEY, mediaNotification) + + testScope.assertRunAllReady(foreground = 0, background = 1) + verify(listener, never()) + .onMediaDataLoaded( + eq(KEY), + eq(KEY), + capture(mediaDataCaptor), + eq(true), + eq(0), + eq(false) + ) + verify(kosmos.mediaLogger).logDuplicateMediaNotification(eq(KEY)) + } + + @Test + @DisableFlags(Flags.FLAG_MEDIA_CONTROLS_POSTS_OPTIMIZATION) + fun postDuplicateNotification_callsListeners() { + addNotificationAndLoad() + reset(listener) + mediaDataManager.onNotificationAdded(KEY, mediaNotification) + testScope.assertRunAllReady(foreground = 1, background = 1) + verify(listener) + .onMediaDataLoaded( + eq(KEY), + eq(KEY), + capture(mediaDataCaptor), + eq(true), + eq(0), + eq(false) + ) + verify(kosmos.mediaLogger, never()).logDuplicateMediaNotification(eq(KEY)) + } + private fun TestScope.assertRunAllReady(foreground: Int = 0, background: Int = 0) { runCurrent() if (Flags.mediaLoadMetadataViaMediaDataLoader()) { -- GitLab From 4addccb46f5aa6710da305c86eb1f0ed0fd73cb4 Mon Sep 17 00:00:00 2001 From: Omar Abdelmonem Date: Mon, 9 Sep 2024 14:01:54 +0000 Subject: [PATCH 198/492] Handle multiple touchpads in TouchpadDebugViewController Add logic to the TouchpadDebugViewController to be able to handle, multiple touchpad connection/disconnection, to avoid a state of having a touchpad connected but no View after original touchpad disconnection. Made sure that the View's colour only changes when a HardwareProperty of the same ID is received. Bug: 363979581 Test: Updated unit tests to test sending HardwareProperties with different deviceIds to the view and verify that only the one with the same deviceId affected the View. Manual testing by connecting multiple touchpads and verifying the result of disconnecting the first or second touchpad and making sure we get the desired behaviour. Flag: com.android.hardware.input.touchpad_visualizer Change-Id: I9dc8c53ed48e53002d9f13bed250d1a65ddbf20a --- .../android/server/input/InputManagerService.java | 8 +------- .../server/input/debug/TouchpadDebugView.java | 10 +++++++++- .../input/debug/TouchpadDebugViewController.java | 15 +++++++++++++-- .../server/input/debug/TouchpadDebugViewTest.java | 13 ++++++++++--- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 1285a61d08f2..dfcea9f8e46f 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -2269,14 +2269,8 @@ public class InputManagerService extends IInputManager.Stub // Native callback. @SuppressWarnings("unused") private void notifyTouchpadHardwareState(TouchpadHardwareState hardwareStates, int deviceId) { - Slog.d(TAG, "notifyTouchpadHardwareState: Time: " - + hardwareStates.getTimestamp() + ", No. Buttons: " - + hardwareStates.getButtonsDown() + ", No. Fingers: " - + hardwareStates.getFingerCount() + ", No. Touch: " - + hardwareStates.getTouchCount() + ", Id: " - + deviceId); if (mTouchpadDebugViewController != null) { - mTouchpadDebugViewController.updateTouchpadHardwareState(hardwareStates); + mTouchpadDebugViewController.updateTouchpadHardwareState(hardwareStates, deviceId); } } diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java index c6092f4dc3c8..7d8ce5fdb918 100644 --- a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java +++ b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java @@ -213,7 +213,15 @@ public class TouchpadDebugView extends LinearLayout { return mWindowLayoutParams; } - public void updateHardwareState(TouchpadHardwareState touchpadHardwareState) { + /** + * Notify the view of a change in TouchpadHardwareState and changing the + * color of the view based on the status of the button click. + */ + public void updateHardwareState(TouchpadHardwareState touchpadHardwareState, int deviceId) { + if (deviceId != mTouchpadId) { + return; + } + if (mLastTouchpadState.getButtonsDown() == 0) { if (touchpadHardwareState.getButtonsDown() > 0) { onTouchpadButtonPress(); diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java b/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java index bc53c4947a71..4d527bdff0d3 100644 --- a/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java +++ b/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java @@ -68,6 +68,13 @@ public class TouchpadDebugViewController implements InputManager.InputDeviceList @Override public void onInputDeviceRemoved(int deviceId) { hideDebugView(deviceId); + if (mTouchpadDebugView == null) { + final InputManager inputManager = Objects.requireNonNull( + mContext.getSystemService(InputManager.class)); + for (int id : inputManager.getInputDeviceIds()) { + onInputDeviceAdded(id); + } + } } @Override @@ -134,9 +141,13 @@ public class TouchpadDebugViewController implements InputManager.InputDeviceList Slog.d(TAG, "Touchpad debug view removed."); } - public void updateTouchpadHardwareState(TouchpadHardwareState touchpadHardwareState) { + /** + * Notify the TouchpadDebugView with the new TouchpadHardwareState. + */ + public void updateTouchpadHardwareState(TouchpadHardwareState touchpadHardwareState, + int deviceId) { if (mTouchpadDebugView != null) { - mTouchpadDebugView.updateHardwareState(touchpadHardwareState); + mTouchpadDebugView.updateHardwareState(touchpadHardwareState, deviceId); } } } diff --git a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java index 4a2ad3af115a..2a49eb12c3ff 100644 --- a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java +++ b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java @@ -300,19 +300,26 @@ public class TouchpadDebugViewTest { mTouchpadDebugView.updateHardwareState( new TouchpadHardwareState(0, 1 /* buttonsDown */, 0, 0, - new TouchpadFingerState[0])); + new TouchpadFingerState[0]), TOUCHPAD_DEVICE_ID); assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); mTouchpadDebugView.updateHardwareState( new TouchpadHardwareState(0, 0 /* buttonsDown */, 0, 0, - new TouchpadFingerState[0])); + new TouchpadFingerState[0]), TOUCHPAD_DEVICE_ID); assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.RED); mTouchpadDebugView.updateHardwareState( new TouchpadHardwareState(0, 1 /* buttonsDown */, 0, 0, - new TouchpadFingerState[0])); + new TouchpadFingerState[0]), TOUCHPAD_DEVICE_ID); + + assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); + + // Color should not change because hardware state of a different touchpad + mTouchpadDebugView.updateHardwareState( + new TouchpadHardwareState(0, 0 /* buttonsDown */, 0, 0, + new TouchpadFingerState[0]), TOUCHPAD_DEVICE_ID + 1); assertEquals(((ColorDrawable) child.getBackground()).getColor(), Color.BLUE); } -- GitLab From 931f02d95d53fa18bcf1f602a6e53aa2cc3c7c31 Mon Sep 17 00:00:00 2001 From: helencheuk Date: Mon, 9 Sep 2024 13:28:27 +0100 Subject: [PATCH 199/492] [Contextual Edu] Check if initial delay is elapsed before updating signal count Get OOBE launch time and check if initial delay is elapsed before updating signal count Bug: 362495235 Test: KeyboardTouchpadStatsInteractorTest Flag: com.android.systemui.keyboard_touchpad_contextual_education Change-Id: I07db49d32535094709130b216dc690bbc163f180 --- .../KeyboardTouchpadStatsInteractorTest.kt | 70 +++++++++++++++++++ .../KeyboardTouchpadEduStatsInteractor.kt | 37 ++++++++-- .../KeyboardTouchpadEduInteractorKosmos.kt | 5 +- .../tutorial/InputDeviceTutorialKosmos.kt | 12 ++++ 4 files changed, 117 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt index c4fc13227eef..98e09474d5f2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt @@ -24,12 +24,17 @@ import com.android.systemui.contextualeducation.GestureType.BACK import com.android.systemui.coroutines.collectLastValue import com.android.systemui.education.data.repository.contextualEducationRepository import com.android.systemui.education.data.repository.fakeEduClock +import com.android.systemui.inputdevice.tutorial.data.repository.DeviceType +import com.android.systemui.inputdevice.tutorial.tutorialSchedulerRepository import com.android.systemui.keyboard.data.repository.keyboardRepository import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.touchpad.data.repository.touchpadRepository import com.google.common.truth.Truth.assertThat +import kotlin.time.Duration.Companion.seconds +import kotlinx.coroutines.launch import kotlinx.coroutines.test.runTest +import org.junit.After import org.junit.Test import org.junit.runner.RunWith @@ -42,10 +47,15 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { private val keyboardRepository = kosmos.keyboardRepository private val touchpadRepository = kosmos.touchpadRepository private val repository = kosmos.contextualEducationRepository + private val fakeClock = kosmos.fakeEduClock + private val tutorialSchedulerRepository = kosmos.tutorialSchedulerRepository + private val initialDelayElapsedDuration = + KeyboardTouchpadEduStatsInteractorImpl.initialDelayDuration + 1.seconds @Test fun dataUpdatedOnIncrementSignalCountWhenTouchpadConnected() = testScope.runTest { + setUpForInitialDelayElapse() touchpadRepository.setIsAnyTouchpadConnected(true) val model by collectLastValue(repository.readGestureEduModelFlow(BACK)) @@ -58,6 +68,7 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { @Test fun dataUnchangedOnIncrementSignalCountWhenTouchpadDisconnected() = testScope.runTest { + setUpForInitialDelayElapse() touchpadRepository.setIsAnyTouchpadConnected(false) val model by collectLastValue(repository.readGestureEduModelFlow(BACK)) @@ -70,6 +81,7 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { @Test fun dataUpdatedOnIncrementSignalCountWhenKeyboardConnected() = testScope.runTest { + setUpForInitialDelayElapse() keyboardRepository.setIsAnyKeyboardConnected(true) val model by collectLastValue(repository.readGestureEduModelFlow(ALL_APPS)) @@ -82,6 +94,7 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { @Test fun dataUnchangedOnIncrementSignalCountWhenKeyboardDisconnected() = testScope.runTest { + setUpForInitialDelayElapse() keyboardRepository.setIsAnyKeyboardConnected(false) val model by collectLastValue(repository.readGestureEduModelFlow(ALL_APPS)) @@ -99,4 +112,61 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { underTest.updateShortcutTriggerTime(BACK) assertThat(model?.lastShortcutTriggeredTime).isEqualTo(kosmos.fakeEduClock.instant()) } + + @Test + fun dataUpdatedOnIncrementSignalCountAfterInitialDelay() = + testScope.runTest { + setUpForDeviceConnection() + tutorialSchedulerRepository.updateLaunchTime(DeviceType.TOUCHPAD, fakeClock.instant()) + + fakeClock.offset(initialDelayElapsedDuration) + val model by collectLastValue(repository.readGestureEduModelFlow(BACK)) + val originalValue = model!!.signalCount + underTest.incrementSignalCount(BACK) + + assertThat(model?.signalCount).isEqualTo(originalValue + 1) + } + + @Test + fun dataUnchangedOnIncrementSignalCountBeforeInitialDelay() = + testScope.runTest { + setUpForDeviceConnection() + tutorialSchedulerRepository.updateLaunchTime(DeviceType.TOUCHPAD, fakeClock.instant()) + + // No offset to the clock to simulate update before initial delay + val model by collectLastValue(repository.readGestureEduModelFlow(BACK)) + val originalValue = model!!.signalCount + underTest.incrementSignalCount(BACK) + + assertThat(model?.signalCount).isEqualTo(originalValue) + } + + @Test + fun dataUnchangedOnIncrementSignalCountWithoutOobeLaunchTime() = + testScope.runTest { + // No update to OOBE launch time to simulate no OOBE is launched yet + setUpForDeviceConnection() + + val model by collectLastValue(repository.readGestureEduModelFlow(BACK)) + val originalValue = model!!.signalCount + underTest.incrementSignalCount(BACK) + + assertThat(model?.signalCount).isEqualTo(originalValue) + } + + private suspend fun setUpForInitialDelayElapse() { + tutorialSchedulerRepository.updateLaunchTime(DeviceType.TOUCHPAD, fakeClock.instant()) + tutorialSchedulerRepository.updateLaunchTime(DeviceType.KEYBOARD, fakeClock.instant()) + fakeClock.offset(initialDelayElapsedDuration) + } + + private fun setUpForDeviceConnection() { + touchpadRepository.setIsAnyTouchpadConnected(true) + keyboardRepository.setIsAnyKeyboardConnected(true) + } + + @After + fun clear() { + testScope.launch { tutorialSchedulerRepository.clearDataStore() } + } } diff --git a/packages/SystemUI/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduStatsInteractor.kt b/packages/SystemUI/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduStatsInteractor.kt index eb4eee204834..0e2d9b6a3ae0 100644 --- a/packages/SystemUI/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduStatsInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduStatsInteractor.kt @@ -16,15 +16,23 @@ package com.android.systemui.education.domain.interactor +import android.os.SystemProperties import com.android.systemui.contextualeducation.GestureType import com.android.systemui.contextualeducation.GestureType.ALL_APPS import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background +import com.android.systemui.education.dagger.ContextualEducationModule.EduClock import com.android.systemui.inputdevice.data.repository.UserInputDeviceRepository import com.android.systemui.inputdevice.tutorial.data.repository.DeviceType import com.android.systemui.inputdevice.tutorial.data.repository.DeviceType.KEYBOARD import com.android.systemui.inputdevice.tutorial.data.repository.DeviceType.TOUCHPAD +import com.android.systemui.inputdevice.tutorial.data.repository.TutorialSchedulerRepository +import java.time.Clock import javax.inject.Inject +import kotlin.time.Duration +import kotlin.time.Duration.Companion.hours +import kotlin.time.DurationUnit +import kotlin.time.toDuration import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch @@ -47,12 +55,24 @@ constructor( @Background private val backgroundScope: CoroutineScope, private val contextualEducationInteractor: ContextualEducationInteractor, private val inputDeviceRepository: UserInputDeviceRepository, + private val tutorialRepository: TutorialSchedulerRepository, + @EduClock private val clock: Clock, ) : KeyboardTouchpadEduStatsInteractor { + companion object { + val initialDelayDuration: Duration + get() = + SystemProperties.getLong( + "persist.contextual_edu.initial_delay_sec", + /* defaultValue= */ 72.hours.inWholeSeconds + ) + .toDuration(DurationUnit.SECONDS) + } + override fun incrementSignalCount(gestureType: GestureType) { backgroundScope.launch { val targetDevice = getTargetDevice(gestureType) - if (isTargetDeviceConnected(targetDevice)) { + if (isTargetDeviceConnected(targetDevice) && hasInitialDelayElapsed(targetDevice)) { contextualEducationInteractor.incrementSignalCount(gestureType) } } @@ -65,12 +85,10 @@ constructor( } private suspend fun isTargetDeviceConnected(deviceType: DeviceType): Boolean { - if (deviceType == KEYBOARD) { - return inputDeviceRepository.isAnyKeyboardConnectedForUser.first().isConnected - } else if (deviceType == TOUCHPAD) { - return inputDeviceRepository.isAnyTouchpadConnectedForUser.first().isConnected + return when (deviceType) { + KEYBOARD -> inputDeviceRepository.isAnyKeyboardConnectedForUser.first().isConnected + TOUCHPAD -> inputDeviceRepository.isAnyTouchpadConnectedForUser.first().isConnected } - return false } /** @@ -83,4 +101,11 @@ constructor( ALL_APPS -> KEYBOARD else -> TOUCHPAD } + + private suspend fun hasInitialDelayElapsed(deviceType: DeviceType): Boolean { + val oobeLaunchTime = tutorialRepository.launchTime(deviceType) ?: return false + return clock + .instant() + .isAfter(oobeLaunchTime.plusSeconds(initialDelayDuration.inWholeSeconds)) + } } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorKosmos.kt index 251a6b10a0da..80f6fc24ef2c 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorKosmos.kt @@ -19,6 +19,7 @@ package com.android.systemui.education.domain.interactor import android.hardware.input.InputManager import com.android.systemui.education.data.repository.fakeEduClock import com.android.systemui.inputdevice.data.repository.UserInputDeviceRepository +import com.android.systemui.inputdevice.tutorial.tutorialSchedulerRepository import com.android.systemui.keyboard.data.repository.keyboardRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testDispatcher @@ -57,6 +58,8 @@ var Kosmos.keyboardTouchpadEduStatsInteractor by keyboardRepository, touchpadRepository, userRepository - ) + ), + tutorialSchedulerRepository, + fakeEduClock ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/inputdevice/tutorial/InputDeviceTutorialKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/inputdevice/tutorial/InputDeviceTutorialKosmos.kt index 827f0d277d11..a83baffd78b2 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/inputdevice/tutorial/InputDeviceTutorialKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/inputdevice/tutorial/InputDeviceTutorialKosmos.kt @@ -16,8 +16,20 @@ package com.android.systemui.inputdevice.tutorial +import android.content.applicationContext +import com.android.systemui.inputdevice.tutorial.data.repository.TutorialSchedulerRepository import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.testScope import org.mockito.kotlin.mock var Kosmos.inputDeviceTutorialLogger: InputDeviceTutorialLogger by Kosmos.Fixture { mock() } + +var Kosmos.tutorialSchedulerRepository by + Kosmos.Fixture { + TutorialSchedulerRepository( + applicationContext = applicationContext, + testScope.backgroundScope, + "KosmosTutorialSchedulerRepository" + ) + } -- GitLab From 98460172ff8f0281c7c365ded2ba3d053997b75e Mon Sep 17 00:00:00 2001 From: Mina Granic Date: Wed, 17 Jul 2024 17:16:53 +0000 Subject: [PATCH 200/492] Remove Overrides-to-Policy dependency for CameraCompat in `isCameraActive`. Test: atest WmTests:DesktopAppCompatAspectRatioPolicyTests Test: atest WmTests:AppCompatCameraOverridesTest Test: atest WmTests:AppCompatCameraPolicyTest Test: atest WmTests:DisplayRotationCompatPolicyTests Bug: 347864073 Flag: EXEMPT small refactoring Change-Id: Icbd9ceed332d1809309f4822b5ba019a5cba2dd6 --- .../server/wm/AppCompatAspectRatioPolicy.java | 7 +- .../server/wm/AppCompatCameraOverrides.java | 30 ++----- .../server/wm/AppCompatCameraPolicy.java | 12 +++ .../server/wm/AppCompatOrientationPolicy.java | 7 +- .../wm/DesktopAppCompatAspectRatioPolicy.java | 6 +- .../wm/DisplayRotationCompatPolicy.java | 21 ++++- .../server/wm/AppCompatActivityRobot.java | 5 -- .../wm/AppCompatCameraOverridesTest.java | 52 ++---------- .../server/wm/AppCompatCameraPolicyTest.java | 79 ++++++++++++++++--- 9 files changed, 128 insertions(+), 91 deletions(-) diff --git a/services/core/java/com/android/server/wm/AppCompatAspectRatioPolicy.java b/services/core/java/com/android/server/wm/AppCompatAspectRatioPolicy.java index b23e75a0fbc2..51ef87dcab1b 100644 --- a/services/core/java/com/android/server/wm/AppCompatAspectRatioPolicy.java +++ b/services/core/java/com/android/server/wm/AppCompatAspectRatioPolicy.java @@ -122,9 +122,12 @@ class AppCompatAspectRatioPolicy { if (aspectRatioOverrides.shouldApplyUserMinAspectRatioOverride()) { return aspectRatioOverrides.getUserMinAspectRatio(); } + final DisplayContent displayContent = mActivityRecord.getDisplayContent(); + final boolean shouldOverrideMinAspectRatioForCamera = displayContent != null + && displayContent.mAppCompatCameraPolicy.shouldOverrideMinAspectRatioForCamera( + mActivityRecord); if (!aspectRatioOverrides.shouldOverrideMinAspectRatio() - && !mAppCompatOverrides.getAppCompatCameraOverrides() - .shouldOverrideMinAspectRatioForCamera()) { + && !shouldOverrideMinAspectRatioForCamera) { return info.getMinAspectRatio(); } diff --git a/services/core/java/com/android/server/wm/AppCompatCameraOverrides.java b/services/core/java/com/android/server/wm/AppCompatCameraOverrides.java index d8abf69b65af..241390c12818 100644 --- a/services/core/java/com/android/server/wm/AppCompatCameraOverrides.java +++ b/services/core/java/com/android/server/wm/AppCompatCameraOverrides.java @@ -85,9 +85,10 @@ class AppCompatCameraOverrides { } /** - * Whether we should apply the min aspect ratio per-app override only when an app is connected - * to the camera. - * When this override is applied the min aspect ratio given in the app's manifest will be + * Whether applying the min aspect ratio per-app override only when an app is connected + * to the camera is allowed. + * + *

When this override is applied the min aspect ratio given in the app's manifest will be * overridden to the largest enabled aspect ratio treatment unless the app's manifest value * is higher. The treatment will also apply if no value is provided in the manifest. * @@ -97,9 +98,8 @@ class AppCompatCameraOverrides { *

  • Per-app override is enabled * */ - boolean shouldOverrideMinAspectRatioForCamera() { - return isCameraActive() && mAllowMinAspectRatioOverrideOptProp - .shouldEnableWithOptInOverrideAndOptOutProperty( + boolean isOverrideMinAspectRatioForCameraEnabled() { + return mAllowMinAspectRatioOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty( isChangeEnabled(mActivityRecord, OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA)); } @@ -174,24 +174,6 @@ class AppCompatCameraOverrides { OVERRIDE_CAMERA_COMPAT_DISABLE_FREEFORM_WINDOWING_TREATMENT); } - /** - * @return {@code true} if the Camera is active for the current activity - */ - boolean isCameraActive() { - return mActivityRecord.mDisplayContent != null - && mActivityRecord.mDisplayContent.mAppCompatCameraPolicy - .isCameraActive(mActivityRecord, /* mustBeFullscreen */ true); - } - - /** - * @return {@code true} if the configuration needs to be recomputed after a camera state update. - */ - boolean shouldRecomputeConfigurationForCameraCompat() { - return isOverrideOrientationOnlyForCameraEnabled() - || isCameraCompatSplitScreenAspectRatioAllowed() - || shouldOverrideMinAspectRatioForCamera(); - } - boolean isOverrideOrientationOnlyForCameraEnabled() { return isChangeEnabled(mActivityRecord, OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA); } diff --git a/services/core/java/com/android/server/wm/AppCompatCameraPolicy.java b/services/core/java/com/android/server/wm/AppCompatCameraPolicy.java index a42b8794b43d..67bfd7605128 100644 --- a/services/core/java/com/android/server/wm/AppCompatCameraPolicy.java +++ b/services/core/java/com/android/server/wm/AppCompatCameraPolicy.java @@ -166,6 +166,9 @@ class AppCompatCameraPolicy { : SCREEN_ORIENTATION_UNSPECIFIED; } + /** + * @return {@code true} if the Camera is active for the provided {@link ActivityRecord}. + */ boolean isCameraActive(@NonNull ActivityRecord activity, boolean mustBeFullscreen) { return mDisplayRotationCompatPolicy != null && mDisplayRotationCompatPolicy.isCameraActive(activity, mustBeFullscreen); @@ -179,4 +182,13 @@ class AppCompatCameraPolicy { return null; } + /** + * Whether we should apply the min aspect ratio per-app override only when an app is connected + * to the camera. + */ + boolean shouldOverrideMinAspectRatioForCamera(@NonNull ActivityRecord activityRecord) { + return isCameraActive(activityRecord, /* mustBeFullscreen= */ true) + && activityRecord.mAppCompatController.getAppCompatCameraOverrides() + .isOverrideMinAspectRatioForCameraEnabled(); + } } diff --git a/services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java b/services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java index c5506de419d0..7477c6272d89 100644 --- a/services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java +++ b/services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java @@ -58,13 +58,16 @@ class AppCompatOrientationPolicy { && displayContent.getIgnoreOrientationRequest(); final boolean shouldApplyUserFullscreenOverride = mAppCompatOverrides .getAppCompatAspectRatioOverrides().shouldApplyUserFullscreenOverride(); + final boolean isCameraActive = displayContent != null + && displayContent.mAppCompatCameraPolicy.isCameraActive(mActivityRecord, + /* mustBeFullscreen */ true); if (shouldApplyUserFullscreenOverride && isIgnoreOrientationRequestEnabled // Do not override orientation to fullscreen for camera activities. // Fixed-orientation activities are rarely tested in other orientations, and it // often results in sideways or stretched previews. As the camera compat treatment // targets fixed-orientation activities, overriding the orientation disables the // treatment. - && !mAppCompatOverrides.getAppCompatCameraOverrides().isCameraActive()) { + && !isCameraActive) { Slog.v(TAG, "Requested orientation " + screenOrientationToString(candidate) + " for " + mActivityRecord + " is overridden to " + screenOrientationToString(SCREEN_ORIENTATION_USER) @@ -110,7 +113,7 @@ class AppCompatOrientationPolicy { // often results in sideways or stretched previews. As the camera compat treatment // targets fixed-orientation activities, overriding the orientation disables the // treatment. - && !mAppCompatOverrides.getAppCompatCameraOverrides().isCameraActive()) { + && !isCameraActive) { Slog.v(TAG, "Requested orientation " + screenOrientationToString(candidate) + " for " + mActivityRecord + " is overridden to " + screenOrientationToString(SCREEN_ORIENTATION_USER)); diff --git a/services/core/java/com/android/server/wm/DesktopAppCompatAspectRatioPolicy.java b/services/core/java/com/android/server/wm/DesktopAppCompatAspectRatioPolicy.java index ff1742b70edc..192469183a54 100644 --- a/services/core/java/com/android/server/wm/DesktopAppCompatAspectRatioPolicy.java +++ b/services/core/java/com/android/server/wm/DesktopAppCompatAspectRatioPolicy.java @@ -198,9 +198,11 @@ public class DesktopAppCompatAspectRatioPolicy { return aspectRatioOverrides.getUserMinAspectRatio(); } + final DisplayContent dc = task.mDisplayContent; + final boolean shouldOverrideMinAspectRatioForCamera = dc != null + && dc.mAppCompatCameraPolicy.shouldOverrideMinAspectRatioForCamera(mActivityRecord); if (!aspectRatioOverrides.shouldOverrideMinAspectRatio() - && !mAppCompatOverrides.getAppCompatCameraOverrides() - .shouldOverrideMinAspectRatioForCamera()) { + && !shouldOverrideMinAspectRatioForCamera) { return info.getMinAspectRatio(); } diff --git a/services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java b/services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java index 27d97677bb13..efc38439bfcf 100644 --- a/services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java @@ -408,9 +408,26 @@ final class DisplayRotationCompatPolicy implements CameraStateMonitor.CameraComp private void recomputeConfigurationForCameraCompatIfNeeded( @NonNull ActivityRecord activityRecord) { - if (activityRecord.mAppCompatController.getAppCompatCameraOverrides() - .shouldRecomputeConfigurationForCameraCompat()) { + if (shouldRecomputeConfigurationForCameraCompat(activityRecord)) { activityRecord.recomputeConfiguration(); } } + + /** + * @return {@code true} if the configuration needs to be recomputed after a camera state update. + */ + private boolean shouldRecomputeConfigurationForCameraCompat( + @NonNull ActivityRecord activityRecord) { + final AppCompatCameraOverrides overrides = activityRecord.mAppCompatController + .getAppCompatCameraOverrides(); + return overrides.isOverrideOrientationOnlyForCameraEnabled() + || overrides.isCameraCompatSplitScreenAspectRatioAllowed() + || shouldOverrideMinAspectRatio(activityRecord); + } + + private boolean shouldOverrideMinAspectRatio(@NonNull ActivityRecord activityRecord) { + return activityRecord.mAppCompatController.getAppCompatCameraOverrides() + .isOverrideMinAspectRatioForCameraEnabled() + && isCameraActive(activityRecord, /* mustBeFullscreen= */ true); + } } diff --git a/services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java b/services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java index a7a08b25fba2..8227ed915c8e 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java @@ -139,11 +139,6 @@ class AppCompatActivityRobot { /* isUnresizable */ true); } - void activateCameraInPolicy(boolean isCameraActive) { - doReturn(isCameraActive).when(mDisplayContent.mAppCompatCameraPolicy) - .isCameraActive(any(ActivityRecord.class), anyBoolean()); - } - void setDisplayNaturalOrientation(@Configuration.Orientation int naturalOrientation) { doReturn(naturalOrientation).when(mDisplayContent).getNaturalOrientation(); } diff --git a/services/tests/wmtests/src/com/android/server/wm/AppCompatCameraOverridesTest.java b/services/tests/wmtests/src/com/android/server/wm/AppCompatCameraOverridesTest.java index ba2a7335824c..d66c21a77fcd 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppCompatCameraOverridesTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppCompatCameraOverridesTest.java @@ -267,7 +267,6 @@ public class AppCompatCameraOverridesTest extends WindowTestsBase { robot.conf().enableCameraCompatSplitScreenAspectRatio(true); robot.applyOnActivity((a) -> { a.createActivityWithComponentInNewTask(); - a.activateCameraInPolicy(true); a.setShouldCreateCompatDisplayInsets(false); }); @@ -275,28 +274,13 @@ public class AppCompatCameraOverridesTest extends WindowTestsBase { }); } - @Test - public void testIsCameraActive() { - runTestScenario((robot) -> { - robot.applyOnActivity((a) -> { - a.createActivityWithComponent(); - a.activateCameraInPolicy(/* isCameraActive */ false); - robot.checkIsCameraActive(/* active */ false); - a.activateCameraInPolicy(/* isCameraActive */ true); - robot.checkIsCameraActive(/* active */ true); - }); - }); - } - - @Test @EnableCompatChanges({OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA}) public void shouldOverrideMinAspectRatioForCamera_overrideEnabled_returnsTrue() { runTestScenario((robot) -> { robot.activity().createActivityWithComponent(); - robot.activity().activateCameraInPolicy(/* isCameraActive */ true); - robot.checkShouldOverrideMinAspectRatioForCamera(/* expected */ true); + robot.checkIsOverrideMinAspectRatioForCameraEnabled(/* expected */ true); }); } @@ -306,21 +290,8 @@ public class AppCompatCameraOverridesTest extends WindowTestsBase { runTestScenario((robot) -> { robot.prop().enable(PROPERTY_COMPAT_ALLOW_MIN_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); - robot.activity().activateCameraInPolicy(/* isCameraActive */ true); - robot.checkShouldOverrideMinAspectRatioForCamera(/* expected */ true); - }); - } - - @Test - @EnableCompatChanges({OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA}) - public void shouldOverrideMinAspectRatioForCamera_propertyTrue_overrideEnabled_returnsFalse() { - runTestScenario((robot) -> { - robot.prop().enable(PROPERTY_COMPAT_ALLOW_MIN_ASPECT_RATIO_OVERRIDE); - robot.activity().createActivityWithComponent(); - robot.activity().activateCameraInPolicy(/* isCameraActive */ false); - - robot.checkShouldOverrideMinAspectRatioForCamera(/* expected */ false); + robot.checkIsOverrideMinAspectRatioForCameraEnabled(/* expected */ true); }); } @@ -330,9 +301,8 @@ public class AppCompatCameraOverridesTest extends WindowTestsBase { runTestScenario((robot) -> { robot.prop().enable(PROPERTY_COMPAT_ALLOW_MIN_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); - robot.activity().activateCameraInPolicy(/* isCameraActive */ true); - robot.checkShouldOverrideMinAspectRatioForCamera(/* expected */ false); + robot.checkIsOverrideMinAspectRatioForCameraEnabled(/* expected */ false); }); } @@ -341,9 +311,8 @@ public class AppCompatCameraOverridesTest extends WindowTestsBase { public void shouldOverrideMinAspectRatioForCamera_overrideDisabled_returnsFalse() { runTestScenario((robot) -> { robot.activity().createActivityWithComponent(); - robot.activity().activateCameraInPolicy(/* isCameraActive */ true); - robot.checkShouldOverrideMinAspectRatioForCamera(/* expected */ false); + robot.checkIsOverrideMinAspectRatioForCameraEnabled(/* expected */ false); }); } @@ -354,7 +323,7 @@ public class AppCompatCameraOverridesTest extends WindowTestsBase { robot.prop().disable(PROPERTY_COMPAT_ALLOW_MIN_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); - robot.checkShouldOverrideMinAspectRatioForCamera(/* expected */ false); + robot.checkIsOverrideMinAspectRatioForCameraEnabled(/* expected */ false); }); } @@ -364,9 +333,8 @@ public class AppCompatCameraOverridesTest extends WindowTestsBase { runTestScenario((robot) -> { robot.prop().disable(PROPERTY_COMPAT_ALLOW_MIN_ASPECT_RATIO_OVERRIDE); robot.activity().createActivityWithComponent(); - robot.activity().activateCameraInPolicy(/* isCameraActive */ true); - robot.checkShouldOverrideMinAspectRatioForCamera(/* expected */ false); + robot.checkIsOverrideMinAspectRatioForCameraEnabled(/* expected */ false); }); } @@ -412,13 +380,9 @@ public class AppCompatCameraOverridesTest extends WindowTestsBase { .shouldApplyFreeformTreatmentForCameraCompat(), expected); } - void checkShouldOverrideMinAspectRatioForCamera(boolean expected) { + void checkIsOverrideMinAspectRatioForCameraEnabled(boolean expected) { Assert.assertEquals(getAppCompatCameraOverrides() - .shouldOverrideMinAspectRatioForCamera(), expected); - } - - void checkIsCameraActive(boolean active) { - Assert.assertEquals(getAppCompatCameraOverrides().isCameraActive(), active); + .isOverrideMinAspectRatioForCameraEnabled(), expected); } private AppCompatCameraOverrides getAppCompatCameraOverrides() { diff --git a/services/tests/wmtests/src/com/android/server/wm/AppCompatCameraPolicyTest.java b/services/tests/wmtests/src/com/android/server/wm/AppCompatCameraPolicyTest.java index 2ae23f88812a..d91b38efd40b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppCompatCameraPolicyTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppCompatCameraPolicyTest.java @@ -16,6 +16,8 @@ package com.android.server.wm; +import static android.content.pm.ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA; + import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.window.flags.Flags.FLAG_CAMERA_COMPAT_FOR_FREEFORM; @@ -31,6 +33,9 @@ import android.platform.test.annotations.Presubmit; import androidx.annotation.NonNull; +import libcore.junit.util.compat.CoreCompatChangeRule.DisableCompatChanges; +import libcore.junit.util.compat.CoreCompatChangeRule.EnableCompatChanges; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestRule; @@ -186,16 +191,6 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase { }); } - /** - * Runs a test scenario providing a Robot. - */ - void runTestScenario(@NonNull Consumer consumer) { - spyOn(mWm.mAppCompatConfiguration); - final AppCompatCameraPolicyRobotTest robot = - new AppCompatCameraPolicyRobotTest(mWm, mAtm, mSupervisor); - consumer.accept(robot); - } - @Test public void testIsCameraCompatTreatmentActive_whenTreatmentForTopActivityIsEnabled() { runTestScenario((robot) -> { @@ -220,6 +215,58 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase { }); } + @Test + @EnableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA) + public void testShouldOverrideMinAspectRatioForCamera_whenCameraIsNotRunning() { + runTestScenario((robot) -> { + robot.applyOnActivity((a)-> { + robot.conf().enableCameraCompatTreatmentAtBuildTime(/* enabled= */ true); + a.createActivityWithComponentInNewTaskAndDisplay(); + a.setTopActivityCameraActive(/* active */ false); + }); + + robot.checkShouldOverrideMinAspectRatioForCamera(/* active */ false); + }); + } + + @Test + @DisableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA) + public void testShouldOverrideMinAspectRatioForCamera_whenCameraIsRunning_overrideDisabled() { + runTestScenario((robot) -> { + robot.applyOnActivity((a)-> { + robot.conf().enableCameraCompatTreatmentAtBuildTime(/* enabled= */ true); + a.createActivityWithComponentInNewTaskAndDisplay(); + a.setTopActivityCameraActive(/* active */ true); + }); + + robot.checkShouldOverrideMinAspectRatioForCamera(/* active */ false); + }); + } + + @Test + @EnableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA) + public void testShouldOverrideMinAspectRatioForCamera_whenCameraIsRunning_overrideEnabled() { + runTestScenario((robot) -> { + robot.applyOnActivity((a)-> { + robot.conf().enableCameraCompatTreatmentAtBuildTime(/* enabled= */ true); + a.createActivityWithComponentInNewTaskAndDisplay(); + a.setTopActivityCameraActive(/* active */ true); + }); + + robot.checkShouldOverrideMinAspectRatioForCamera(/* active */ true); + }); + } + + /** + * Runs a test scenario providing a Robot. + */ + void runTestScenario(@NonNull Consumer consumer) { + final AppCompatCameraPolicyRobotTest robot = + new AppCompatCameraPolicyRobotTest(mWm, mAtm, mSupervisor); + consumer.accept(robot); + } + + private static class AppCompatCameraPolicyRobotTest extends AppCompatRobotBase { AppCompatCameraPolicyRobotTest(@NonNull WindowManagerService wm, @NonNull ActivityTaskManagerService atm, @@ -230,7 +277,14 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase { @Override void onPostDisplayContentCreation(@NonNull DisplayContent displayContent) { super.onPostDisplayContentCreation(displayContent); + spyOn(displayContent.mAppCompatCameraPolicy); + if (displayContent.mAppCompatCameraPolicy.mDisplayRotationCompatPolicy != null) { + spyOn(displayContent.mAppCompatCameraPolicy.mDisplayRotationCompatPolicy); + } + if (displayContent.mAppCompatCameraPolicy.mCameraCompatFreeformPolicy != null) { + spyOn(displayContent.mAppCompatCameraPolicy.mCameraCompatFreeformPolicy); + } } void checkTopActivityHasDisplayRotationCompatPolicy(boolean exists) { @@ -268,6 +322,11 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase { .isTreatmentEnabledForActivity(activity().top()), active); } + void checkShouldOverrideMinAspectRatioForCamera(boolean expected) { + assertEquals(getTopAppCompatCameraPolicy() + .shouldOverrideMinAspectRatioForCamera(activity().top()), expected); + } + // TODO(b/350460645): Create Desktop Windowing Robot to reuse common functionalities. void allowEnterDesktopMode(boolean isAllowed) { doReturn(isAllowed).when(() -> -- GitLab From 4db9092ad1d099f75726367544bb8949fdb79c2f Mon Sep 17 00:00:00 2001 From: Yuri Lin Date: Mon, 9 Sep 2024 15:40:24 -0400 Subject: [PATCH 201/492] Update handling of vibration effects that don't need cropping This change splits the addition of vibration effects into three cases: - has equivalent vibration pattern, and that pattern needs trimming: delegate to setVibrationPattern to trim & re-convert to a vibration effect - has equivalent vibration pattern, which is under the size limit: set vibration pattern directly, and store the effect passed in by the caller - has no equivalent vibration pattern: trim effect if possible Also: when there is no equivalent vibration pattern, set it to null, thus making sure to override any value previously set by setVibrationPattern. This fixes some tests that were expecting the effect to be exactly the same as what was passed in, but we were instead producing an equivalent one with an extra "0"-duration at the beginning, and otherwise avoids doing some redundant conversions. Also parameterizes the unit test to run with both values of notif_channel_crop_vibration_effects, to avoid running into any further potential test issues when the flag turns on. Bug: 345881518 Bug: 365538915 Fixes: 364960520 Test: NotificationChannelTest (both CTS and unit) Flag: android.app.notif_channel_crop_vibration_effects Change-Id: I3073e88a95169b049b051b37936e3fb9e8c16e9f --- .../java/android/app/NotificationChannel.java | 16 +++++++++--- .../android/app/NotificationChannelTest.java | 26 ++++++++++++++++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java index 1b29b7a294df..32e9542e91a7 100644 --- a/core/java/android/app/NotificationChannel.java +++ b/core/java/android/app/NotificationChannel.java @@ -761,14 +761,22 @@ public final class NotificationChannel implements Parcelable { this.mVibrationEnabled = effect != null; this.mVibrationEffect = effect; if (Flags.notifChannelCropVibrationEffects() && effect != null) { - // Try converting to a vibration pattern and trimming that array. If not convertible - // to a pattern directly, try trimming the vibration effect if possible and storing - // that version instead. long[] pattern = effect.computeCreateWaveformOffOnTimingsOrNull(); if (pattern != null) { - setVibrationPattern(pattern); + // If this effect has an equivalent pattern, AND the pattern needs to be truncated + // due to being too long, we delegate to setVibrationPattern to re-generate the + // effect as well. Otherwise, we use the effect (already set above) and converted + // pattern directly. + if (pattern.length > MAX_VIBRATION_LENGTH) { + setVibrationPattern(pattern); + } else { + this.mVibrationPattern = pattern; + } } else { + // If not convertible to a pattern directly, try trimming the vibration effect if + // possible and storing that version instead. this.mVibrationEffect = getTrimmedVibrationEffect(mVibrationEffect); + this.mVibrationPattern = null; } } else { this.mVibrationPattern = diff --git a/core/tests/coretests/src/android/app/NotificationChannelTest.java b/core/tests/coretests/src/android/app/NotificationChannelTest.java index e47ef2df48b9..e19f887c1284 100644 --- a/core/tests/coretests/src/android/app/NotificationChannelTest.java +++ b/core/tests/coretests/src/android/app/NotificationChannelTest.java @@ -47,12 +47,13 @@ import android.os.RemoteException; import android.os.VibrationEffect; import android.platform.test.annotations.EnableFlags; import android.platform.test.annotations.Presubmit; +import android.platform.test.annotations.UsesFlags; +import android.platform.test.flag.junit.FlagsParameterization; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.MediaStore.Audio.AudioColumns; import android.test.mock.MockContentResolver; import android.util.Xml; -import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import com.android.modules.utils.TypedXmlPullParser; @@ -61,6 +62,7 @@ import com.android.modules.utils.TypedXmlSerializer; import com.google.common.base.Strings; import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -71,14 +73,28 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.lang.reflect.Field; import java.util.Arrays; +import java.util.List; import java.util.function.Consumer; -@RunWith(AndroidJUnit4.class) +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + +@RunWith(ParameterizedAndroidJunit4.class) +@UsesFlags(android.app.Flags.class) @SmallTest @Presubmit public class NotificationChannelTest { + @ClassRule + public static final SetFlagsRule.ClassRule mSetFlagsClassRule = new SetFlagsRule.ClassRule(); + + @Parameters(name = "{0}") + public static List getParams() { + return FlagsParameterization.allCombinationsOf( + Flags.FLAG_NOTIF_CHANNEL_CROP_VIBRATION_EFFECTS); + } + @Rule - public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + public final SetFlagsRule mSetFlagsRule; private final String CLASS = "android.app.NotificationChannel"; @@ -86,6 +102,10 @@ public class NotificationChannelTest { ContentProvider mContentProvider; IContentProvider mIContentProvider; + public NotificationChannelTest(FlagsParameterization flags) { + mSetFlagsRule = mSetFlagsClassRule.createSetFlagsRule(flags); + } + @Before public void setUp() throws Exception { mContext = mock(Context.class); -- GitLab From e5cb884b02cf4eef6f32a6c0e1eeac4f8841b563 Mon Sep 17 00:00:00 2001 From: Vladimir Komsiyski Date: Tue, 10 Sep 2024 14:55:44 +0000 Subject: [PATCH 202/492] Null documentation on InsetsParams#getInsetsSize As per the API council feedback Change-Id: Icb8bc6cd0ca818d47cc33800f993b0a28a12ebc4 Fix: 365745876 Test: n/a comment only Flag: EXEMPT comment only --- core/java/android/view/WindowManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 4fe11e6ce274..5b39f62db261 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -6183,7 +6183,8 @@ public interface WindowManager extends ViewManager { } /** - * Returns the size of the provided insets. + * Returns the size of the provided insets. May be {@code null} if the provided insets have + * the same size as the window frame. */ public @Nullable Insets getInsetsSize() { return mInsets; -- GitLab From 496c34dadbb87603d6e54f15d5a1f21f7087e692 Mon Sep 17 00:00:00 2001 From: Marvin Ramin Date: Tue, 10 Sep 2024 12:06:06 +0200 Subject: [PATCH 203/492] Don't show MediaProjection consent Dialog above lockscreen Remove FLAG_SHOW_WHEN_LOCKED from the MediaProjection consent Dialog to prevent it from showing above the lockscreen. Bug: 351409536 Test: manual Flag: EXEMPT bugfix Change-Id: Icfbee72318d39b9b669973c1be22782095c76a2d --- .../permission/MediaProjectionPermissionActivity.java | 2 +- .../systemui/statusbar/phone/SystemUIDialog.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionActivity.java index 18c6f53630a4..4251b81226b3 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionActivity.java +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionActivity.java @@ -307,7 +307,7 @@ public class MediaProjectionPermissionActivity extends Activity { private void setUpDialog(AlertDialog dialog) { SystemUIDialog.registerDismissListener(dialog); - SystemUIDialog.applyFlags(dialog); + SystemUIDialog.applyFlags(dialog, /* showWhenLocked= */ false); SystemUIDialog.setDialogSize(dialog); dialog.setOnCancelListener(this::onDialogDismissedOrCancelled); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java index c04616847ebe..0ad1042a665f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java @@ -480,10 +480,16 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh } public static AlertDialog applyFlags(AlertDialog dialog) { + return applyFlags(dialog, true); + } + + public static AlertDialog applyFlags(AlertDialog dialog, boolean showWhenLocked) { final Window window = dialog.getWindow(); window.setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL); - window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM - | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); + if (showWhenLocked) { + window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + } window.getAttributes().setFitInsetsTypes( window.getAttributes().getFitInsetsTypes() & ~Type.statusBars()); return dialog; -- GitLab From 6ba013cf0763bbb6c6a80151318b090d61690f7f Mon Sep 17 00:00:00 2001 From: Abdelrahman Awadalla Date: Wed, 4 Sep 2024 13:42:29 +0000 Subject: [PATCH 204/492] Visualize the fingers on the touchpad visualizer Visualize the fingers and its movements as ovals that changes its size, orientation and position according to the movement of the finger on the touchpad in real life. Bug: 286551975 Test: Manual Flag: com.android.hardware.input.touchpad_visualizer Change-Id: I9ecd133abbea42d2301525fd83ff72cc5f67a593 --- .../server/input/debug/TouchpadDebugView.java | 30 ++-- .../debug/TouchpadDebugViewController.java | 21 +-- .../debug/TouchpadVisualisationView.java | 26 ---- .../debug/TouchpadVisualizationView.java | 130 ++++++++++++++++++ .../TouchpadDebugViewControllerTests.java | 4 + .../input/debug/TouchpadDebugViewTest.java | 6 +- 6 files changed, 172 insertions(+), 45 deletions(-) delete mode 100644 services/core/java/com/android/server/input/debug/TouchpadVisualisationView.java create mode 100644 services/core/java/com/android/server/input/debug/TouchpadVisualizationView.java diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java index 7d8ce5fdb918..486d4afdbf43 100644 --- a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java +++ b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java @@ -32,6 +32,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.android.server.input.TouchpadFingerState; +import com.android.server.input.TouchpadHardwareProperties; import com.android.server.input.TouchpadHardwareState; import java.util.Objects; @@ -60,13 +61,15 @@ public class TouchpadDebugView extends LinearLayout { private TouchpadHardwareState mLastTouchpadState = new TouchpadHardwareState(0, 0 /* buttonsDown */, 0, 0, new TouchpadFingerState[0]); + private TouchpadVisualizationView mTouchpadVisualizationView; - public TouchpadDebugView(Context context, int touchpadId) { + public TouchpadDebugView(Context context, int touchpadId, + TouchpadHardwareProperties touchpadHardwareProperties) { super(context); mTouchpadId = touchpadId; mWindowManager = Objects.requireNonNull(getContext().getSystemService(WindowManager.class)); - init(context, touchpadId); + init(context, touchpadHardwareProperties, touchpadId); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); // TODO(b/360137366): Use the hardware properties to initialise layout parameters. @@ -89,7 +92,8 @@ public class TouchpadDebugView extends LinearLayout { mWindowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT; } - private void init(Context context, int touchpadId) { + private void init(Context context, TouchpadHardwareProperties touchpadHardwareProperties, + int touchpadId) { setOrientation(VERTICAL); setLayoutParams(new LayoutParams( LayoutParams.WRAP_CONTENT, @@ -106,10 +110,12 @@ public class TouchpadDebugView extends LinearLayout { nameView.setTextColor(Color.WHITE); nameView.setLayoutParams(new LayoutParams(1000, 200)); - TouchpadVisualisationView touchpadVisualisationView = - new TouchpadVisualisationView(context); - touchpadVisualisationView.setBackgroundColor(Color.WHITE); - touchpadVisualisationView.setLayoutParams(new LayoutParams(1000, 200)); + mTouchpadVisualizationView = new TouchpadVisualizationView(context, + touchpadHardwareProperties); + mTouchpadVisualizationView.setBackgroundColor(Color.WHITE); + //TODO(b/365568238): set the view size according to the touchpad size from the + // TouchpadHardwareProperties + mTouchpadVisualizationView.setLayoutParams(new LayoutParams(778, 500)); //TODO(b/365562952): Add a display for recognized gesture info here TextView gestureInfoView = new TextView(context); @@ -121,7 +127,7 @@ public class TouchpadDebugView extends LinearLayout { gestureInfoView.setLayoutParams(new LayoutParams(1000, 200)); addView(nameView); - addView(touchpadVisualisationView); + addView(mTouchpadVisualizationView); addView(gestureInfoView); updateScreenDimensions(); @@ -214,14 +220,18 @@ public class TouchpadDebugView extends LinearLayout { } /** - * Notify the view of a change in TouchpadHardwareState and changing the - * color of the view based on the status of the button click. + * Notify the view of a change in the hardware state of a touchpad. The view should + * update its content to reflect the new state. + * + * @param touchpadHardwareState the hardware state of a touchpad + * @param deviceId the deviceId of the touchpad that is sending the hardware state */ public void updateHardwareState(TouchpadHardwareState touchpadHardwareState, int deviceId) { if (deviceId != mTouchpadId) { return; } + mTouchpadVisualizationView.onTouchpadHardwareStateNotified(touchpadHardwareState); if (mLastTouchpadState.getButtonsDown() == 0) { if (touchpadHardwareState.getButtonsDown() > 0) { onTouchpadButtonPress(); diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java b/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java index 4d527bdff0d3..b4b357a29363 100644 --- a/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java +++ b/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java @@ -112,18 +112,20 @@ public class TouchpadDebugViewController implements InputManager.InputDeviceList final WindowManager wm = Objects.requireNonNull( mContext.getSystemService(WindowManager.class)); - mTouchpadDebugView = new TouchpadDebugView(mContext, touchpadId); + TouchpadHardwareProperties touchpadHardwareProperties = + mInputManagerService.getTouchpadHardwareProperties( + touchpadId); + + mTouchpadDebugView = new TouchpadDebugView(mContext, touchpadId, + touchpadHardwareProperties); final WindowManager.LayoutParams mWindowLayoutParams = mTouchpadDebugView.getWindowLayoutParams(); wm.addView(mTouchpadDebugView, mWindowLayoutParams); Slog.d(TAG, "Touchpad debug view created."); - TouchpadHardwareProperties mTouchpadHardwareProperties = - mInputManagerService.getTouchpadHardwareProperties( - touchpadId); - if (mTouchpadHardwareProperties != null) { - Slog.d(TAG, mTouchpadHardwareProperties.toString()); + if (touchpadHardwareProperties != null) { + Slog.d(TAG, touchpadHardwareProperties.toString()); } else { Slog.w(TAG, "Failed to retrieve touchpad hardware properties for " + "device ID: " + touchpadId); @@ -142,10 +144,13 @@ public class TouchpadDebugViewController implements InputManager.InputDeviceList } /** - * Notify the TouchpadDebugView with the new TouchpadHardwareState. + * Notifies about an update in the touchpad's hardware state. + * + * @param touchpadHardwareState the hardware state of a touchpad + * @param deviceId the deviceId of the touchpad that is sending the hardware state */ public void updateTouchpadHardwareState(TouchpadHardwareState touchpadHardwareState, - int deviceId) { + int deviceId) { if (mTouchpadDebugView != null) { mTouchpadDebugView.updateHardwareState(touchpadHardwareState, deviceId); } diff --git a/services/core/java/com/android/server/input/debug/TouchpadVisualisationView.java b/services/core/java/com/android/server/input/debug/TouchpadVisualisationView.java deleted file mode 100644 index 38442bcc0292..000000000000 --- a/services/core/java/com/android/server/input/debug/TouchpadVisualisationView.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.server.input.debug; - -import android.content.Context; -import android.view.View; - -public class TouchpadVisualisationView extends View { - public TouchpadVisualisationView(Context context) { - super(context); - } -} diff --git a/services/core/java/com/android/server/input/debug/TouchpadVisualizationView.java b/services/core/java/com/android/server/input/debug/TouchpadVisualizationView.java new file mode 100644 index 000000000000..9ba7d0a655f5 --- /dev/null +++ b/services/core/java/com/android/server/input/debug/TouchpadVisualizationView.java @@ -0,0 +1,130 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.input.debug; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.RectF; +import android.util.Slog; +import android.view.View; + +import com.android.server.input.TouchpadFingerState; +import com.android.server.input.TouchpadHardwareProperties; +import com.android.server.input.TouchpadHardwareState; + +public class TouchpadVisualizationView extends View { + private static final String TAG = "TouchpadVizMain"; + private static final boolean DEBUG = true; + + private final TouchpadHardwareProperties mTouchpadHardwareProperties; + + TouchpadHardwareState mLatestHardwareState = new TouchpadHardwareState(0, 0, 0, 0, + new TouchpadFingerState[]{}); + + private final Paint mOvalPaint; + + public TouchpadVisualizationView(Context context, + TouchpadHardwareProperties touchpadHardwareProperties) { + super(context); + mTouchpadHardwareProperties = touchpadHardwareProperties; + mOvalPaint = new Paint(); + mOvalPaint.setAntiAlias(true); + mOvalPaint.setARGB(255, 0, 0, 0); + mOvalPaint.setStyle(Paint.Style.STROKE); + } + + private final RectF mOvalRect = new RectF(); + + private void drawOval(Canvas canvas, float x, float y, float major, float minor, float angle, + Paint paint) { + canvas.save(Canvas.MATRIX_SAVE_FLAG); + canvas.rotate(angle, x, y); + mOvalRect.left = x - minor / 2; + mOvalRect.right = x + minor / 2; + mOvalRect.top = y - major / 2; + mOvalRect.bottom = y + major / 2; + canvas.drawOval(mOvalRect, paint); + canvas.restore(); + } + + @Override + protected void onDraw(Canvas canvas) { + for (TouchpadFingerState touchpadFingerState : mLatestHardwareState.getFingerStates()) { + float newX = translateRange(mTouchpadHardwareProperties.getLeft(), + mTouchpadHardwareProperties.getRight(), 0, getWidth(), + touchpadFingerState.getPositionX()); + + float newY = translateRange(mTouchpadHardwareProperties.getTop(), + mTouchpadHardwareProperties.getBottom(), 0, getHeight(), + touchpadFingerState.getPositionY()); + + float newAngle = -translateRange(mTouchpadHardwareProperties.getOrientationMinimum(), + mTouchpadHardwareProperties.getOrientationMaximum(), 0, 360, + touchpadFingerState.getOrientation()); + + float newTouchMajor = + touchpadFingerState.getTouchMajor() / mTouchpadHardwareProperties.getResX(); + float newTouchMinor = + touchpadFingerState.getTouchMinor() / mTouchpadHardwareProperties.getResY(); + + drawOval(canvas, newX, newY, newTouchMajor, newTouchMinor, newAngle, mOvalPaint); + } + } + + /** + * Receiving the touchpad hardware state and based on it update the latest hardware state. + * + * @param schs The new hardware state received. + */ + public void onTouchpadHardwareStateNotified(TouchpadHardwareState schs) { + if (DEBUG) { + logHardwareState(schs); + } + + mLatestHardwareState = schs; + + invalidate(); + } + + private float translateRange(float rangeBeforeMin, float rangeBeforeMax, + float rangeAfterMin, float rangeAfterMax, float value) { + return rangeAfterMin + (value - rangeBeforeMin) / (rangeBeforeMax - rangeBeforeMin) * ( + rangeAfterMax - rangeAfterMin); + } + + private void logHardwareState(TouchpadHardwareState schs) { + Slog.d(TAG, "notifyTouchpadHardwareState: Time: " + + schs.getTimestamp() + ", No. Buttons: " + + schs.getButtonsDown() + ", No. Fingers: " + + schs.getFingerCount() + ", No. Touch: " + + schs.getTouchCount()); + + for (TouchpadFingerState finger : schs.getFingerStates()) { + Slog.d(TAG, "Finger #" + finger.getTrackingId() + + ": touchMajor= " + finger.getTouchMajor() + + ", touchMinor= " + finger.getTouchMinor() + + ", widthMajor= " + finger.getWidthMajor() + + ", widthMinor= " + finger.getWidthMinor() + + ", pressure= " + finger.getPressure() + + ", orientation= " + finger.getOrientation() + + ", positionX= " + finger.getPositionX() + + ", positionY= " + finger.getPositionY()); + } + } + +} diff --git a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewControllerTests.java b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewControllerTests.java index c7ebd3a27a2e..5875520cd259 100644 --- a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewControllerTests.java +++ b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewControllerTests.java @@ -38,6 +38,7 @@ import android.view.WindowMetrics; import androidx.test.platform.app.InstrumentationRegistry; import com.android.server.input.InputManagerService; +import com.android.server.input.TouchpadHardwareProperties; import org.junit.Before; import org.junit.Rule; @@ -87,6 +88,9 @@ public class TouchpadDebugViewControllerTests { mTestableLooper = TestableLooper.get(this); mTestableContext.addMockSystemService(InputManager.class, mInputManagerMock); + when(mInputManagerServiceMock.getTouchpadHardwareProperties(DEVICE_ID)).thenReturn( + new TouchpadHardwareProperties.Builder(-100f, 100f, -100f, 100f, 45f, 45f, -5f, 5f, + (short) 10, true, false).build()); mTouchpadDebugViewController = new TouchpadDebugViewController(mTestableContext, mTestableLooper.getLooper(), mInputManagerServiceMock); diff --git a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java index 2a49eb12c3ff..99e04cce64f4 100644 --- a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java +++ b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java @@ -43,6 +43,7 @@ import androidx.test.runner.AndroidJUnit4; import com.android.cts.input.MotionEventBuilder; import com.android.cts.input.PointerBuilder; import com.android.server.input.TouchpadFingerState; +import com.android.server.input.TouchpadHardwareProperties; import com.android.server.input.TouchpadHardwareState; import org.junit.Before; @@ -83,7 +84,10 @@ public class TouchpadDebugViewTest { when(mWindowManager.getCurrentWindowMetrics()).thenReturn(mWindowMetrics); - mTouchpadDebugView = new TouchpadDebugView(mTestableContext, TOUCHPAD_DEVICE_ID); + mTouchpadDebugView = new TouchpadDebugView(mTestableContext, TOUCHPAD_DEVICE_ID, + new TouchpadHardwareProperties.Builder(500f, 500f, 500f, + 500f, 0f, 0f, -5f, 5f, (short) 10, true, + true).build()); mTouchpadDebugView.measure( View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), -- GitLab From e77084fb15c4c8a43ee250efa92306852d7f58fb Mon Sep 17 00:00:00 2001 From: Ajinkya Chalke Date: Thu, 5 Sep 2024 20:18:43 +0000 Subject: [PATCH 205/492] Remove the backlink resolves to same app check - Backlinks now uses the name and icon of the app that backlink will resolve to instead of the screenshotted app. Flag: com.android.systemui.app_clips_backlinks Test: atest AppClipsActivityTest AppClipsViewModelTest AppClipsTest Bug: 356129075 Fix: 356129075 Change-Id: I2a8d80c4d2dbd0e2f444e0e3e870e3aa0efc41d8 --- .../appclips/AppClipsViewModel.java | 136 ++++++++++++------ .../appclips/InternalBacklinksData.kt | 42 ++++-- .../appclips/AppClipsViewModelTest.java | 83 +++++++++-- 3 files changed, 196 insertions(+), 65 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsViewModel.java b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsViewModel.java index 9a38358a2768..4b1504f1cc2f 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsViewModel.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsViewModel.java @@ -28,9 +28,9 @@ import android.app.TaskInfo; import android.app.WindowConfiguration; import android.app.assist.AssistContent; import android.content.ClipData; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.Bitmap; @@ -249,7 +249,6 @@ final class AppClipsViewModel extends ViewModel { .map(taskInfo -> new InternalTaskInfo(taskInfo.topActivityInfo, taskInfo.taskId, taskInfo.userId, getPackageManagerForUser(taskInfo.userId))) - .filter(this::canAppStartThroughLauncher) .map(this::getBacklinksDataForTaskInfo) .toList(), mBgExecutor); @@ -257,6 +256,17 @@ final class AppClipsViewModel extends ViewModel { return Futures.transformAsync(backlinksNestedListFuture, Futures::allAsList, mBgExecutor); } + private PackageManager getPackageManagerForUser(int userId) { + // If app clips was launched as the same user, then reuse the available PM from mContext. + if (mContext.getUserId() == userId) { + return mContext.getPackageManager(); + } + + // PackageManager required for a different user, create its context and return its PM. + UserHandle userHandle = UserHandle.of(userId); + return mContext.createContextAsUser(userHandle, /* flags= */ 0).getPackageManager(); + } + /** * Returns all tasks on a given display after querying {@link IActivityTaskManager} from the * {@link #mBgExecutor}. @@ -310,17 +320,6 @@ final class AppClipsViewModel extends ViewModel { && taskInfo.getActivityType() == WindowConfiguration.ACTIVITY_TYPE_STANDARD; } - /** - * Returns whether the app represented by the {@link InternalTaskInfo} can be launched through - * the all apps tray by a user. - */ - private boolean canAppStartThroughLauncher(InternalTaskInfo internalTaskInfo) { - // Use Intent.resolveActivity API to check if the intent resolves as that is what Android - // uses internally when apps use Context.startActivity. - return getMainLauncherIntentForTask(internalTaskInfo) - .resolveActivity(internalTaskInfo.getPackageManager()) != null; - } - /** * Returns an {@link InternalBacklinksData} that represents the Backlink data internally, which * is captured by querying the system using {@link TaskInfo#taskId}. @@ -390,11 +389,14 @@ final class AppClipsViewModel extends ViewModel { internalTaskInfo.getTaskId(), internalTaskInfo.getTopActivityNameForDebugLogging())); - String appName = internalTaskInfo.getTopActivityAppName(); - Drawable appIcon = internalTaskInfo.getTopActivityAppIcon(); - ClipData mainLauncherIntent = ClipData.newIntent(appName, - getMainLauncherIntentForTask(internalTaskInfo)); - InternalBacklinksData fallback = new BacklinksData(mainLauncherIntent, appIcon); + String screenshottedAppName = internalTaskInfo.getTopActivityAppName(); + Drawable screenshottedAppIcon = internalTaskInfo.getTopActivityAppIcon(); + Intent screenshottedAppMainLauncherIntent = getMainLauncherIntentForTask( + internalTaskInfo.getTopActivityPackageName(), internalTaskInfo.getPackageManager()); + ClipData screenshottedAppMainLauncherClipData = + ClipData.newIntent(screenshottedAppName, screenshottedAppMainLauncherIntent); + InternalBacklinksData fallback = + new BacklinksData(screenshottedAppMainLauncherClipData, screenshottedAppIcon); if (content == null) { return fallback; } @@ -406,10 +408,14 @@ final class AppClipsViewModel extends ViewModel { Uri uri = content.getWebUri(); Intent backlinksIntent = new Intent(ACTION_VIEW).setData(uri); - if (doesIntentResolveToSameTask(backlinksIntent, internalTaskInfo)) { + BacklinkDisplayInfo backlinkDisplayInfo = getInfoThatResolvesIntent(backlinksIntent, + internalTaskInfo); + if (backlinkDisplayInfo != null) { DebugLogger.INSTANCE.logcatMessage(this, () -> "getBacklinksDataFromAssistContent: using app provided uri"); - return new BacklinksData(ClipData.newRawUri(appName, uri), appIcon); + return new BacklinksData( + ClipData.newRawUri(backlinkDisplayInfo.getDisplayLabel(), uri), + backlinkDisplayInfo.getAppIcon()); } } @@ -419,10 +425,14 @@ final class AppClipsViewModel extends ViewModel { () -> "getBacklinksDataFromAssistContent: app has provided an intent"); Intent backlinksIntent = content.getIntent(); - if (doesIntentResolveToSameTask(backlinksIntent, internalTaskInfo)) { + BacklinkDisplayInfo backlinkDisplayInfo = getInfoThatResolvesIntent(backlinksIntent, + internalTaskInfo); + if (backlinkDisplayInfo != null) { DebugLogger.INSTANCE.logcatMessage(this, () -> "getBacklinksDataFromAssistContent: using app provided intent"); - return new BacklinksData(ClipData.newIntent(appName, backlinksIntent), appIcon); + return new BacklinksData( + ClipData.newIntent(backlinkDisplayInfo.getDisplayLabel(), backlinksIntent), + backlinkDisplayInfo.getAppIcon()); } } @@ -431,27 +441,76 @@ final class AppClipsViewModel extends ViewModel { return fallback; } - private boolean doesIntentResolveToSameTask(Intent intentToResolve, - InternalTaskInfo requiredTaskInfo) { - PackageManager packageManager = requiredTaskInfo.getPackageManager(); - ComponentName resolvedComponent = intentToResolve.resolveActivity(packageManager); - if (resolvedComponent == null) { - return false; + /** + * Returns {@link BacklinkDisplayInfo} for the app that would resolve the provided backlink + * {@link Intent}. + * + *

    The method uses the {@link PackageManager} available in the provided + * {@link InternalTaskInfo}. + * + *

    This method returns {@code null} if Android is not able to resolve the backlink intent or + * if the resolved app does not have an icon in the launcher. + */ + @Nullable + private BacklinkDisplayInfo getInfoThatResolvesIntent(Intent backlinkIntent, + InternalTaskInfo internalTaskInfo) { + PackageManager packageManager = internalTaskInfo.getPackageManager(); + + // Query for all available activities as there is a chance that multiple apps could resolve + // the intent. In such cases the normal `intent.resolveActivity` API returns the activity + // resolver info which isn't helpful for further checks. Also, using MATCH_DEFAULT_ONLY flag + // is required as that flag will be used when the notes app builds the intent and calls + // startActivity with the intent. + List resolveInfos = packageManager.queryIntentActivities(backlinkIntent, + PackageManager.MATCH_DEFAULT_ONLY); + if (resolveInfos.isEmpty()) { + DebugLogger.INSTANCE.logcatMessage(this, + () -> "getInfoThatResolvesIntent: could not resolve backlink intent"); + return null; + } + + // Only use the first result as the list is ordered from best match to worst and Android + // will also use the best match with `intent.startActivity` API which notes app will use. + ActivityInfo activityInfo = resolveInfos.get(0).activityInfo; + if (activityInfo == null) { + DebugLogger.INSTANCE.logcatMessage(this, + () -> "getInfoThatResolvesIntent: could not find activity info for backlink " + + "intent"); + return null; + } + + // Ignore resolved backlink app if users cannot start it through all apps tray. + if (!canAppStartThroughLauncher(activityInfo.packageName, packageManager)) { + DebugLogger.INSTANCE.logcatMessage(this, + () -> "getInfoThatResolvesIntent: ignoring resolved backlink app as it cannot" + + " start through launcher"); + return null; } - String requiredPackageName = requiredTaskInfo.getTopActivityPackageName(); - return resolvedComponent.getPackageName().equals(requiredPackageName); + Drawable appIcon = InternalBacklinksDataKt.getAppIcon(activityInfo, packageManager); + String appName = InternalBacklinksDataKt.getAppName(activityInfo, packageManager); + return new BacklinkDisplayInfo(appIcon, appName); + } + + /** + * Returns whether the app represented by the provided {@code pkgName} can be launched through + * the all apps tray by the user. + */ + private static boolean canAppStartThroughLauncher(String pkgName, PackageManager pkgManager) { + // Use Intent.resolveActivity API to check if the intent resolves as that is what Android + // uses internally when apps use Context.startActivity. + return getMainLauncherIntentForTask(pkgName, pkgManager) + .resolveActivity(pkgManager) != null; } - private Intent getMainLauncherIntentForTask(InternalTaskInfo internalTaskInfo) { - String pkgName = internalTaskInfo.getTopActivityPackageName(); + private static Intent getMainLauncherIntentForTask(String pkgName, + PackageManager packageManager) { Intent intent = new Intent(ACTION_MAIN).addCategory(CATEGORY_LAUNCHER).setPackage(pkgName); // Not all apps use DEFAULT_CATEGORY for their main launcher activity so the exact component // needs to be queried and set on the Intent in order for note-taking apps to be able to // start this intent. When starting an activity with an implicit intent, Android adds the // DEFAULT_CATEGORY flag otherwise it fails to resolve the intent. - PackageManager packageManager = internalTaskInfo.getPackageManager(); ResolveInfo resolvedActivity = packageManager.resolveActivity(intent, /* flags= */ 0); if (resolvedActivity != null) { intent.setComponent(resolvedActivity.getComponentInfo().getComponentName()); @@ -460,17 +519,6 @@ final class AppClipsViewModel extends ViewModel { return intent; } - private PackageManager getPackageManagerForUser(int userId) { - // If app clips was launched as the same user, then reuse the available PM from mContext. - if (mContext.getUserId() == userId) { - return mContext.getPackageManager(); - } - - // PackageManager required for a different user, create its context and return its PM. - UserHandle userHandle = UserHandle.of(userId); - return mContext.createContextAsUser(userHandle, /* flags= */ 0).getPackageManager(); - } - /** Helper factory to help with injecting {@link AppClipsViewModel}. */ static final class Factory implements ViewModelProvider.Factory { diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/InternalBacklinksData.kt b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/InternalBacklinksData.kt index 234692ea2fc6..f4faa36ef718 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/InternalBacklinksData.kt +++ b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/InternalBacklinksData.kt @@ -27,16 +27,27 @@ import android.graphics.drawable.Drawable * represent error when necessary. */ internal sealed class InternalBacklinksData( - open val appIcon: Drawable, - open var displayLabel: String + // Fields from this object are made accessible through accessors to keep call sites simpler. + private val backlinkDisplayInfo: BacklinkDisplayInfo, ) { - data class BacklinksData(val clipData: ClipData, override val appIcon: Drawable) : - InternalBacklinksData(appIcon, clipData.description.label.toString()) + // Use separate field to access display label so that callers don't have to access through + // internal object. + var displayLabel: String + get() = backlinkDisplayInfo.displayLabel + set(value) { + backlinkDisplayInfo.displayLabel = value + } - data class CrossProfileError( - override val appIcon: Drawable, - override var displayLabel: String - ) : InternalBacklinksData(appIcon, displayLabel) + // Use separate field to access app icon so that callers don't have to access through internal + // object. + val appIcon: Drawable + get() = backlinkDisplayInfo.appIcon + + data class BacklinksData(val clipData: ClipData, private val icon: Drawable) : + InternalBacklinksData(BacklinkDisplayInfo(icon, clipData.description.label.toString())) + + data class CrossProfileError(private val icon: Drawable, private var label: String) : + InternalBacklinksData(BacklinkDisplayInfo(icon, label)) } /** @@ -54,11 +65,16 @@ internal data class InternalTaskInfo( val userId: Int, val packageManager: PackageManager ) { - fun getTopActivityNameForDebugLogging(): String = topActivityInfo.name + val topActivityNameForDebugLogging: String = topActivityInfo.name + val topActivityPackageName: String = topActivityInfo.packageName + val topActivityAppName: String by lazy { topActivityInfo.getAppName(packageManager) } + val topActivityAppIcon: Drawable by lazy { topActivityInfo.loadIcon(packageManager) } +} - fun getTopActivityPackageName(): String = topActivityInfo.packageName +internal fun ActivityInfo.getAppName(packageManager: PackageManager) = + loadLabel(packageManager).toString() - fun getTopActivityAppName(): String = topActivityInfo.loadLabel(packageManager).toString() +internal fun ActivityInfo.getAppIcon(packageManager: PackageManager) = loadIcon(packageManager) - fun getTopActivityAppIcon(): Drawable = topActivityInfo.loadIcon(packageManager) -} +/** A class to hold data that is used for displaying backlink to user in SysUI activity. */ +internal data class BacklinkDisplayInfo(val appIcon: Drawable, var displayLabel: String) diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsViewModelTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsViewModelTest.java index 5d71c054244a..886b32b09225 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsViewModelTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsViewModelTest.java @@ -24,6 +24,7 @@ import static android.content.Intent.ACTION_MAIN; import static android.content.Intent.ACTION_VIEW; import static android.content.Intent.CAPTURE_CONTENT_FOR_NOTE_FAILED; import static android.content.Intent.CATEGORY_LAUNCHER; +import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY; import static android.view.Display.DEFAULT_DISPLAY; import static com.google.common.truth.Truth.assertThat; @@ -32,6 +33,7 @@ import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.reset; @@ -73,6 +75,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatcher; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -108,19 +111,24 @@ public final class AppClipsViewModelTest extends SysuiTestCase { Context mMockedContext; @Mock private PackageManager mPackageManager; - private ArgumentCaptor mPackageManagerIntentCaptor; + private ArgumentCaptor mPackageManagerLauncherIntentCaptor; + private ArgumentCaptor mPackageManagerBacklinkIntentCaptor; private AppClipsViewModel mViewModel; @Before public void setUp() throws RemoteException { MockitoAnnotations.initMocks(this); - mPackageManagerIntentCaptor = ArgumentCaptor.forClass(Intent.class); + mPackageManagerLauncherIntentCaptor = ArgumentCaptor.forClass(Intent.class); + mPackageManagerBacklinkIntentCaptor = ArgumentCaptor.forClass(Intent.class); // Set up mocking for backlinks. when(mAtmService.getTasks(Integer.MAX_VALUE, false, false, DEFAULT_DISPLAY)) .thenReturn(List.of(createTaskInfoForBacklinksTask())); - when(mPackageManager.resolveActivity(mPackageManagerIntentCaptor.capture(), anyInt())) - .thenReturn(createBacklinksTaskResolveInfo()); + ResolveInfo expectedResolveInfo = createBacklinksTaskResolveInfo(); + when(mPackageManager.resolveActivity(mPackageManagerLauncherIntentCaptor.capture(), + anyInt())).thenReturn(expectedResolveInfo); + when(mPackageManager.queryIntentActivities(mPackageManagerBacklinkIntentCaptor.capture(), + eq(MATCH_DEFAULT_ONLY))).thenReturn(List.of(expectedResolveInfo)); when(mPackageManager.loadItemIcon(any(), any())).thenReturn(FAKE_DRAWABLE); when(mMockedContext.getPackageManager()).thenReturn(mPackageManager); @@ -209,7 +217,7 @@ public final class AppClipsViewModelTest extends SysuiTestCase { mViewModel.triggerBacklinks(Collections.emptySet(), DEFAULT_DISPLAY); waitForIdleSync(); - Intent queriedIntent = mPackageManagerIntentCaptor.getValue(); + Intent queriedIntent = mPackageManagerBacklinkIntentCaptor.getValue(); assertThat(queriedIntent.getData()).isEqualTo(expectedUri); assertThat(queriedIntent.getAction()).isEqualTo(ACTION_VIEW); @@ -225,6 +233,63 @@ public final class AppClipsViewModelTest extends SysuiTestCase { assertThat(result).isEqualTo(mViewModel.getBacklinksLiveData().getValue().get(0)); } + @Test + public void triggerBacklinks_shouldUpdateBacklinks_withUriForDifferentApp() { + Uri expectedUri = Uri.parse("https://android.com"); + AssistContent contentWithUri = new AssistContent(); + contentWithUri.setWebUri(expectedUri); + mockForAssistContent(contentWithUri, BACKLINKS_TASK_ID); + + // Reset PackageManager mocking done in setup. + reset(mPackageManager); + String package2 = BACKLINKS_TASK_PACKAGE_NAME + 2; + String appName2 = BACKLINKS_TASK_APP_NAME + 2; + ResolveInfo resolveInfo2 = createBacklinksTaskResolveInfo(); + ActivityInfo activityInfo2 = resolveInfo2.activityInfo; + activityInfo2.name = appName2; + activityInfo2.packageName = package2; + activityInfo2.applicationInfo.packageName = package2; + + Intent app2LauncherIntent = new Intent(ACTION_MAIN).addCategory( + CATEGORY_LAUNCHER).setPackage(package2); + when(mPackageManager.resolveActivity(intentEquals(app2LauncherIntent), eq(/* flags= */ 0))) + .thenReturn(resolveInfo2); + Intent uriIntent = new Intent(ACTION_VIEW).setData(expectedUri); + when(mPackageManager.queryIntentActivities(intentEquals(uriIntent), eq(MATCH_DEFAULT_ONLY))) + .thenReturn(List.of(resolveInfo2)); + when(mPackageManager.loadItemIcon(any(), any())).thenReturn(FAKE_DRAWABLE); + + mViewModel.triggerBacklinks(Collections.emptySet(), DEFAULT_DISPLAY); + waitForIdleSync(); + + BacklinksData result = (BacklinksData) mViewModel.mSelectedBacklinksLiveData.getValue(); + ClipData clipData = result.getClipData(); + ClipDescription resultDescription = clipData.getDescription(); + assertThat(resultDescription.getLabel().toString()).isEqualTo(appName2); + assertThat(resultDescription.getMimeType(0)).isEqualTo(MIMETYPE_TEXT_URILIST); + assertThat(clipData.getItemCount()).isEqualTo(1); + assertThat(clipData.getItemAt(0).getUri()).isEqualTo(expectedUri); + + assertThat(mViewModel.getBacklinksLiveData().getValue().size()).isEqualTo(1); + } + + private static class IntentMatcher implements ArgumentMatcher { + private final Intent mExpectedIntent; + + IntentMatcher(Intent expectedIntent) { + mExpectedIntent = expectedIntent; + } + + @Override + public boolean matches(Intent actualIntent) { + return actualIntent != null && mExpectedIntent.filterEquals(actualIntent); + } + } + + private static Intent intentEquals(Intent intent) { + return argThat(new IntentMatcher(intent)); + } + @Test public void triggerBacklinks_withNonResolvableUri_usesMainLauncherIntent() { Uri expectedUri = Uri.parse("https://developers.android.com"); @@ -249,7 +314,7 @@ public final class AppClipsViewModelTest extends SysuiTestCase { mViewModel.triggerBacklinks(Collections.emptySet(), DEFAULT_DISPLAY); waitForIdleSync(); - Intent queriedIntent = mPackageManagerIntentCaptor.getValue(); + Intent queriedIntent = mPackageManagerBacklinkIntentCaptor.getValue(); assertThat(queriedIntent.getPackage()).isEqualTo(expectedIntent.getPackage()); BacklinksData result = (BacklinksData) mViewModel.mSelectedBacklinksLiveData.getValue(); @@ -283,7 +348,7 @@ public final class AppClipsViewModelTest extends SysuiTestCase { mViewModel.triggerBacklinks(Collections.emptySet(), DEFAULT_DISPLAY); waitForIdleSync(); - Intent queriedIntent = mPackageManagerIntentCaptor.getValue(); + Intent queriedIntent = mPackageManagerLauncherIntentCaptor.getValue(); assertThat(queriedIntent.getPackage()).isEqualTo(BACKLINKS_TASK_PACKAGE_NAME); assertThat(queriedIntent.getAction()).isEqualTo(ACTION_MAIN); assertThat(queriedIntent.getCategories()).containsExactly(CATEGORY_LAUNCHER); @@ -356,7 +421,9 @@ public final class AppClipsViewModelTest extends SysuiTestCase { // For each task, the logic queries PM 3 times, twice for verifying if an app can be // launched via launcher and once with the data provided in backlink intent. when(mPackageManager.resolveActivity(any(), anyInt())).thenReturn(resolveInfo1, - resolveInfo1, resolveInfo1, resolveInfo2, resolveInfo2, resolveInfo2); + resolveInfo1, resolveInfo2, resolveInfo2); + when(mPackageManager.queryIntentActivities(any(Intent.class), eq(MATCH_DEFAULT_ONLY))) + .thenReturn(List.of(resolveInfo1)).thenReturn(List.of(resolveInfo2)); when(mPackageManager.loadItemIcon(any(), any())).thenReturn(FAKE_DRAWABLE); when(mAtmService.getTasks(Integer.MAX_VALUE, false, false, DEFAULT_DISPLAY)) .thenReturn(List.of(runningTaskInfo1, runningTaskInfo2)); -- GitLab From 84642f815835c014747c1398f1f38ec2692872d2 Mon Sep 17 00:00:00 2001 From: Kaylee Lubick Date: Mon, 9 Sep 2024 19:44:27 +0000 Subject: [PATCH 206/492] Remove references to SkMSec type Skia wants to remove this from the public API: https://skia-review.googlesource.com/c/skia/+/897150 Change-Id: Idef3d1d79014a10cfd1f1e2ad740666bebe6d3cf Flag: EXEMPT refactor --- libs/hwui/SkiaInterpolator.cpp | 28 +++++++++++++++------------- libs/hwui/jni/GIFMovie.cpp | 10 +++++----- libs/hwui/jni/Movie.h | 12 +++++++----- libs/hwui/jni/MovieImpl.cpp | 8 ++++---- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/libs/hwui/SkiaInterpolator.cpp b/libs/hwui/SkiaInterpolator.cpp index 5a45ad9085e7..8deac61e8baa 100644 --- a/libs/hwui/SkiaInterpolator.cpp +++ b/libs/hwui/SkiaInterpolator.cpp @@ -47,6 +47,8 @@ static inline Dot14 pin_and_convert(float x) { return static_cast(x * Dot14_ONE); } +using MSec = uint32_t; // millisecond duration + static float SkUnitCubicInterp(float value, float bx, float by, float cx, float cy) { // pin to the unit-square, and convert to 2.14 Dot14 x = pin_and_convert(value); @@ -120,7 +122,7 @@ void SkiaInterpolatorBase::reset(int elemCount, int frameCount) { Totaling fElemCount+2 entries per keyframe */ -bool SkiaInterpolatorBase::getDuration(SkMSec* startTime, SkMSec* endTime) const { +bool SkiaInterpolatorBase::getDuration(MSec* startTime, MSec* endTime) const { if (fFrameCount == 0) { return false; } @@ -134,7 +136,7 @@ bool SkiaInterpolatorBase::getDuration(SkMSec* startTime, SkMSec* endTime) const return true; } -float SkiaInterpolatorBase::ComputeRelativeT(SkMSec time, SkMSec prevTime, SkMSec nextTime, +float SkiaInterpolatorBase::ComputeRelativeT(MSec time, MSec prevTime, MSec nextTime, const float blend[4]) { LOG_FATAL_IF(time < prevTime || time > nextTime); @@ -144,7 +146,7 @@ float SkiaInterpolatorBase::ComputeRelativeT(SkMSec time, SkMSec prevTime, SkMSe // Returns the index of where the item is or the bit not of the index // where the item should go in order to keep arr sorted in ascending order. -int SkiaInterpolatorBase::binarySearch(const SkTimeCode* arr, int count, SkMSec target) { +int SkiaInterpolatorBase::binarySearch(const SkTimeCode* arr, int count, MSec target) { if (count <= 0) { return ~0; } @@ -154,7 +156,7 @@ int SkiaInterpolatorBase::binarySearch(const SkTimeCode* arr, int count, SkMSec while (lo < hi) { int mid = (hi + lo) / 2; - SkMSec elem = arr[mid].fTime; + MSec elem = arr[mid].fTime; if (elem == target) { return mid; } else if (elem < target) { @@ -171,21 +173,21 @@ int SkiaInterpolatorBase::binarySearch(const SkTimeCode* arr, int count, SkMSec return ~(lo + 1); } -SkiaInterpolatorBase::Result SkiaInterpolatorBase::timeToT(SkMSec time, float* T, int* indexPtr, +SkiaInterpolatorBase::Result SkiaInterpolatorBase::timeToT(MSec time, float* T, int* indexPtr, bool* exactPtr) const { LOG_FATAL_IF(fFrameCount <= 0); Result result = kNormal_Result; if (fRepeat != 1.0f) { - SkMSec startTime = 0, endTime = 0; // initialize to avoid warning + MSec startTime = 0, endTime = 0; // initialize to avoid warning this->getDuration(&startTime, &endTime); - SkMSec totalTime = endTime - startTime; - SkMSec offsetTime = time - startTime; + MSec totalTime = endTime - startTime; + MSec offsetTime = time - startTime; endTime = SkScalarFloorToInt(fRepeat * totalTime); if (offsetTime >= endTime) { float fraction = SkScalarFraction(fRepeat); offsetTime = fraction == 0 && fRepeat > 0 ? totalTime - : (SkMSec)SkScalarFloorToInt(fraction * totalTime); + : (MSec)SkScalarFloorToInt(fraction * totalTime); result = kFreezeEnd_Result; } else { int mirror = fFlags & kMirror; @@ -217,11 +219,11 @@ SkiaInterpolatorBase::Result SkiaInterpolatorBase::timeToT(SkMSec time, float* T } LOG_FATAL_IF(index >= fFrameCount); const SkTimeCode* nextTime = &fTimes[index]; - SkMSec nextT = nextTime[0].fTime; + MSec nextT = nextTime[0].fTime; if (exact) { *T = 0; } else { - SkMSec prevT = nextTime[-1].fTime; + MSec prevT = nextTime[-1].fTime; *T = ComputeRelativeT(time, prevT, nextT, nextTime[-1].fBlend); } *indexPtr = index; @@ -251,7 +253,7 @@ void SkiaInterpolator::reset(int elemCount, int frameCount) { static const float gIdentityBlend[4] = {0.33333333f, 0.33333333f, 0.66666667f, 0.66666667f}; -bool SkiaInterpolator::setKeyFrame(int index, SkMSec time, const float values[], +bool SkiaInterpolator::setKeyFrame(int index, MSec time, const float values[], const float blend[4]) { LOG_FATAL_IF(values == nullptr); @@ -272,7 +274,7 @@ bool SkiaInterpolator::setKeyFrame(int index, SkMSec time, const float values[], return success; } -SkiaInterpolator::Result SkiaInterpolator::timeToValues(SkMSec time, float values[]) const { +SkiaInterpolator::Result SkiaInterpolator::timeToValues(MSec time, float values[]) const { float T; int index; bool exact; diff --git a/libs/hwui/jni/GIFMovie.cpp b/libs/hwui/jni/GIFMovie.cpp index ae6ac4ce4ecc..6c82aa1ca27d 100644 --- a/libs/hwui/jni/GIFMovie.cpp +++ b/libs/hwui/jni/GIFMovie.cpp @@ -30,7 +30,7 @@ public: protected: virtual bool onGetInfo(Info*); - virtual bool onSetTime(SkMSec); + virtual bool onSetTime(Movie::MSec); virtual bool onGetBitmap(SkBitmap*); private: @@ -72,7 +72,7 @@ GIFMovie::~GIFMovie() DGifCloseFile(fGIF, nullptr); } -static SkMSec savedimage_duration(const SavedImage* image) +static Movie::MSec savedimage_duration(const SavedImage* image) { for (int j = 0; j < image->ExtensionBlockCount; j++) { @@ -91,7 +91,7 @@ bool GIFMovie::onGetInfo(Info* info) if (nullptr == fGIF) return false; - SkMSec dur = 0; + Movie::MSec dur = 0; for (int i = 0; i < fGIF->ImageCount; i++) dur += savedimage_duration(&fGIF->SavedImages[i]); @@ -102,12 +102,12 @@ bool GIFMovie::onGetInfo(Info* info) return true; } -bool GIFMovie::onSetTime(SkMSec time) +bool GIFMovie::onSetTime(Movie::MSec time) { if (nullptr == fGIF) return false; - SkMSec dur = 0; + Movie::MSec dur = 0; for (int i = 0; i < fGIF->ImageCount; i++) { dur += savedimage_duration(&fGIF->SavedImages[i]); diff --git a/libs/hwui/jni/Movie.h b/libs/hwui/jni/Movie.h index 02113dd58ec8..d633d935f566 100644 --- a/libs/hwui/jni/Movie.h +++ b/libs/hwui/jni/Movie.h @@ -19,6 +19,8 @@ class SkStreamRewindable; class Movie : public SkRefCnt { public: + using MSec = uint32_t; // millisecond duration + /** Try to create a movie from the stream. If the stream format is not supported, return NULL. */ @@ -36,7 +38,7 @@ public: */ static Movie* DecodeMemory(const void* data, size_t length); - SkMSec duration(); + MSec duration(); int width(); int height(); int isOpaque(); @@ -46,21 +48,21 @@ public: bitmap/frame from the previous state (i.e. true means you need to redraw). */ - bool setTime(SkMSec); + bool setTime(MSec); // return the right bitmap for the current time code const SkBitmap& bitmap(); protected: struct Info { - SkMSec fDuration; + MSec fDuration; int fWidth; int fHeight; bool fIsOpaque; }; virtual bool onGetInfo(Info*) = 0; - virtual bool onSetTime(SkMSec) = 0; + virtual bool onSetTime(MSec) = 0; virtual bool onGetBitmap(SkBitmap*) = 0; // visible for subclasses @@ -68,7 +70,7 @@ protected: private: Info fInfo; - SkMSec fCurrTime; + MSec fCurrTime; SkBitmap fBitmap; bool fNeedBitmap; diff --git a/libs/hwui/jni/MovieImpl.cpp b/libs/hwui/jni/MovieImpl.cpp index abb75fa99c94..a31a15f061b1 100644 --- a/libs/hwui/jni/MovieImpl.cpp +++ b/libs/hwui/jni/MovieImpl.cpp @@ -11,7 +11,7 @@ // We should never see this in normal operation since our time values are // 0-based. So we use it as a sentinel. -#define UNINITIALIZED_MSEC ((SkMSec)-1) +#define UNINITIALIZED_MSEC ((Movie::MSec)-1) Movie::Movie() { @@ -26,7 +26,7 @@ void Movie::ensureInfo() memset(&fInfo, 0, sizeof(fInfo)); // failure } -SkMSec Movie::duration() +Movie::MSec Movie::duration() { this->ensureInfo(); return fInfo.fDuration; @@ -50,9 +50,9 @@ int Movie::isOpaque() return fInfo.fIsOpaque; } -bool Movie::setTime(SkMSec time) +bool Movie::setTime(Movie::MSec time) { - SkMSec dur = this->duration(); + Movie::MSec dur = this->duration(); if (time > dur) time = dur; -- GitLab From f4373512a50864ae1ed726ef12748a0b708a1d58 Mon Sep 17 00:00:00 2001 From: Jorge Betancourt Date: Mon, 9 Sep 2024 21:21:21 +0000 Subject: [PATCH 207/492] remove unused forward declarations in Canvas header Flag: EXEMPT no-op change Test: none Bug: b/365765709 Change-Id: Ia82b55c03e01f1ac1c9ed88b4dd2aea0b7eb9e61 --- libs/hwui/hwui/Canvas.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/hwui/hwui/Canvas.h b/libs/hwui/hwui/Canvas.h index 4eb6918d7e9a..b6988b21333b 100644 --- a/libs/hwui/hwui/Canvas.h +++ b/libs/hwui/hwui/Canvas.h @@ -28,11 +28,9 @@ #include "pipeline/skia/AnimatedDrawables.h" #include "utils/Macros.h" -class SkAnimatedImage; enum class SkBlendMode; class SkCanvasState; class SkRRect; -class SkRuntimeShaderBuilder; class SkVertices; namespace minikin { -- GitLab From d02bb11e0dca41b6402dc69f30349b908cd43b61 Mon Sep 17 00:00:00 2001 From: Olivier Nshimiye Date: Mon, 9 Sep 2024 17:04:28 +0000 Subject: [PATCH 208/492] Add a custom message to prompt user to set up screenlock before PS reset Flag: EXEMPT Bugfix in a low risk scenario Bug: 363050220 Test: atest ResetOptionsDeletePrivateSpaceControllerTest Change-Id: Ib8bc7c124d93d742f9fbd02a78c3fe1e7cfef426 --- .../android/internal/app/SetScreenLockDialogActivity.java | 6 ++++++ core/res/res/values/strings.xml | 3 +++ core/res/res/values/symbols.xml | 2 ++ 3 files changed, 11 insertions(+) diff --git a/core/java/com/android/internal/app/SetScreenLockDialogActivity.java b/core/java/com/android/internal/app/SetScreenLockDialogActivity.java index 360fcafe3318..4c3af4d45380 100644 --- a/core/java/com/android/internal/app/SetScreenLockDialogActivity.java +++ b/core/java/com/android/internal/app/SetScreenLockDialogActivity.java @@ -60,6 +60,7 @@ public class SetScreenLockDialogActivity extends AlertActivity LAUNCH_REASON_PRIVATE_SPACE_SETTINGS_ACCESS, LAUNCH_REASON_DISABLE_QUIET_MODE, LAUNCH_REASON_UNKNOWN, + LAUNCH_REASON_RESET_PRIVATE_SPACE_SETTINGS_ACCESS, }) @Retention(RetentionPolicy.SOURCE) public @interface LaunchReason { @@ -67,6 +68,7 @@ public class SetScreenLockDialogActivity extends AlertActivity public static final int LAUNCH_REASON_UNKNOWN = -1; public static final int LAUNCH_REASON_DISABLE_QUIET_MODE = 1; public static final int LAUNCH_REASON_PRIVATE_SPACE_SETTINGS_ACCESS = 2; + public static final int LAUNCH_REASON_RESET_PRIVATE_SPACE_SETTINGS_ACCESS = 3; private @LaunchReason int mReason; private int mOriginUserId; @@ -139,7 +141,11 @@ public class SetScreenLockDialogActivity extends AlertActivity // Always set private space message if launch reason is specific to private space builder.setMessage(R.string.private_space_set_up_screen_lock_message); return; + } else if (mReason == LAUNCH_REASON_RESET_PRIVATE_SPACE_SETTINGS_ACCESS) { + builder.setMessage(R.string.private_space_set_up_screen_lock_for_reset); + return; } + final UserManager userManager = getApplicationContext().getSystemService(UserManager.class); if (userManager != null) { UserInfo userInfo = userManager.getUserInfo(mOriginUserId); diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index f40466610724..d3b065422101 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -5509,6 +5509,9 @@ To use your private space, set a screen lock on this device + + To delete private space, set a screen lock on this device + App is not available diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 74922aca3b02..fc1df54d341c 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3298,6 +3298,8 @@ + + -- GitLab From 0d323f1d8c864689f5d197672b3d42039edf0fef Mon Sep 17 00:00:00 2001 From: Marzia Favaro Date: Wed, 28 Aug 2024 12:21:16 +0000 Subject: [PATCH 209/492] Refactor dimmer getter To avoid code duplication in next cls Test: Manual, verify correctness of dimming on closing activities with dim Bug: 327332488 Flag: com.android.window.flags.use_tasks_dim_only Change-Id: I9d816c213d0cf7a7adc32ebbbf843e35ea734d47 --- .../core/java/com/android/server/wm/Task.java | 14 ++++----- .../com/android/server/wm/Transition.java | 8 ++--- .../com/android/server/wm/WindowState.java | 30 ++++++++++++++----- .../android/server/wm/TransitionTests.java | 4 +-- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 8c93b4fe447c..3bb273c55f55 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -3192,13 +3192,6 @@ class Task extends TaskFragment { return "Task=" + mTaskId; } - WindowContainer getDimmerParent() { - if (!inMultiWindowMode() && isTranslucentForTransition()) { - return getRootDisplayArea(); - } - return this; - } - @Deprecated @Override Dimmer getDimmer() { @@ -3222,6 +3215,13 @@ class Task extends TaskFragment { return mDimmer; } + boolean isSuitableForDimming() { + // If the window is in multi-window mode, we want to dim at the Task level to ensure the dim + // bounds match the area the app lives in. + // If translucent, we will move the dim to the display area + return inMultiWindowMode() || !isTranslucentAndVisible(); + } + @Override void prepareSurfaces() { mDimmer.resetDimStates(); diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index e6226ab6786d..44e07cf50ab5 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -484,12 +484,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { boolean canApplyDim(@NonNull Task task) { if (mTransientLaunches == null) return true; if (Flags.useTasksDimOnly()) { - WindowContainer dimmerParent = task.getDimmerParent(); - if (dimmerParent == null) { - return false; - } - // Always allow to dim if the host only affects its task. - if (dimmerParent.asTask() == task) { + if (task.isSuitableForDimming()) { + // Always allow to dim if the dimming occurs at task level (dim parented to task) return true; } } else { diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 256d0c661634..f0022e6295a8 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -5196,14 +5196,8 @@ class WindowState extends WindowContainer implements WindowManagerP Dimmer dimmer; WindowContainer geometryParent = task; if (Flags.useTasksDimOnly()) { - if (task != null) { - geometryParent = task.getDimmerParent(); - dimmer = task.mDimmer; - } else { - RootDisplayArea displayArea = getRootDisplayArea(); - geometryParent = displayArea; - dimmer = displayArea != null ? displayArea.getDimmer() : null; - } + geometryParent = getDimParent(); + dimmer = getDimController(); if (dimmer == null) { ProtoLog.e(WM_DEBUG_DIMMER, "WindowState %s does not have task or" + " display area for dimming", this); @@ -5221,6 +5215,26 @@ class WindowState extends WindowContainer implements WindowManagerP } } + private Dimmer getDimController() { + Task task = getTask(); + if (task != null) { + return task.mDimmer; + } + RootDisplayArea displayArea = getRootDisplayArea(); + if (displayArea != null) { + return displayArea.getDimmer(); + } + return null; + } + + private WindowContainer getDimParent() { + Task task = getTask(); + if (task != null && task.isSuitableForDimming()) { + return task; + } + return getRootDisplayArea(); + } + private boolean shouldDrawBlurBehind() { return (mAttrs.flags & FLAG_BLUR_BEHIND) != 0 && mWmService.mBlurController.getBlurEnabled(); diff --git a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java index 52a80b01971d..cc327d60fd79 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java @@ -1590,10 +1590,10 @@ public class TransitionTests extends WindowTestsBase { }); assertTrue(activity1.isVisible()); doReturn(false).when(task1).isTranslucent(null); - doReturn(false).when(task1).isTranslucentForTransition(); + doReturn(false).when(task1).isTranslucentAndVisible(); assertTrue(controller.canApplyDim(task1)); doReturn(true).when(task1).isTranslucent(null); - doReturn(true).when(task1).isTranslucentForTransition(); + doReturn(true).when(task1).isTranslucentAndVisible(); assertFalse(controller.canApplyDim(task1)); controller.finishTransition(ActionChain.testFinish(closeTransition)); -- GitLab From 64feeb2649effaaca6a57541f80ce546fd4b4a60 Mon Sep 17 00:00:00 2001 From: Marzia Favaro Date: Fri, 30 Aug 2024 09:13:52 +0000 Subject: [PATCH 210/492] Restrict to assumptions that have been valid for a while Bug: 327332488 Test: DimmerTests Flag: EXEMPT no logic change Change-Id: I545a39ec0fae15f98b138bfd3487c675e1f834f8 --- .../java/com/android/server/wm/Dimmer.java | 31 ++-- .../server/wm/DimmerAnimationHelper.java | 35 ++-- .../com/android/server/wm/WindowState.java | 3 +- .../com/android/server/wm/DimmerTests.java | 149 +++++++----------- 4 files changed, 92 insertions(+), 126 deletions(-) diff --git a/services/core/java/com/android/server/wm/Dimmer.java b/services/core/java/com/android/server/wm/Dimmer.java index 2d1eb419a0bf..c5643ea54623 100644 --- a/services/core/java/com/android/server/wm/Dimmer.java +++ b/services/core/java/com/android/server/wm/Dimmer.java @@ -55,7 +55,7 @@ class Dimmer { SurfaceControl mDimSurface; final WindowContainer mHostContainer; // The last container to request to dim - private WindowContainer mLastRequestedDimContainer; + private WindowState mLastDimmingWindow; /** Animation */ private final DimmerAnimationHelper mAnimationHelper; boolean mSkipAnimation = false; @@ -129,8 +129,8 @@ class Dimmer { * Set the parameters to prepare the dim to be relative parented to the dimming container */ void prepareReparent(@NonNull WindowContainer geometryParent, - @NonNull WindowContainer relativeParent, int relativeLayer) { - mAnimationHelper.setRequestedRelativeParent(relativeParent, relativeLayer); + @NonNull WindowState relativeParent) { + mAnimationHelper.setRequestedRelativeParent(relativeParent); mAnimationHelper.setRequestedGeometryParent(geometryParent); } @@ -146,7 +146,7 @@ class Dimmer { * Whether anyone is currently requesting the dim */ boolean isDimming() { - return mLastRequestedDimContainer != null + return mLastDimmingWindow != null && (mHostContainer.isVisibleRequested() || !Flags.useTasksDimOnly()); } @@ -186,7 +186,7 @@ class Dimmer { */ void resetDimStates() { if (mDimState != null) { - mDimState.mLastRequestedDimContainer = null; + mDimState.mLastDimmingWindow = null; } } @@ -200,7 +200,7 @@ class Dimmer { * @param alpha Dim amount * @param blurRadius Blur amount */ - protected void adjustAppearance(@NonNull WindowContainer dimmingContainer, + protected void adjustAppearance(@NonNull WindowState dimmingContainer, float alpha, int blurRadius) { final DimState d = obtainDimState(dimmingContainer); d.prepareLookChange(alpha, blurRadius); @@ -218,14 +218,13 @@ class Dimmer { * continue dimming. Indeed, this method won't be able to keep dimming or get a new DimState * without also adjusting the appearance. * @param geometryParent The container that defines the geometry of the dim - * @param dimmingContainer The container which to dim above. Should be a child of the host. - * @param relativeLayer The position of the dim wrt the container + * @param dimmingContainer The container that is dimming. The dim layer will be rel-z + * parented below it */ public void adjustPosition(@NonNull WindowContainer geometryParent, - @NonNull WindowContainer dimmingContainer, - int relativeLayer) { + @NonNull WindowState dimmingContainer) { if (mDimState != null) { - mDimState.prepareReparent(geometryParent, dimmingContainer, relativeLayer); + mDimState.prepareReparent(geometryParent, dimmingContainer); } } @@ -250,9 +249,9 @@ class Dimmer { if (!Flags.useTasksDimOnly()) { mDimState.adjustSurfaceLayout(t); } - final WindowState ws = mDimState.mLastRequestedDimContainer.asWindowState(); - if (!mDimState.mIsVisible && ws != null && ws.mActivityRecord != null - && ws.mActivityRecord.mStartingData != null) { + if (!mDimState.mIsVisible && mDimState.mLastDimmingWindow != null + && mDimState.mLastDimmingWindow.mActivityRecord != null + && mDimState.mLastDimmingWindow.mActivityRecord.mStartingData != null) { // Skip enter animation while starting window is on top of its activity mDimState.mSkipAnimation = true; } @@ -262,11 +261,11 @@ class Dimmer { } @NonNull - private DimState obtainDimState(@NonNull WindowContainer container) { + private DimState obtainDimState(@NonNull WindowState window) { if (mDimState == null) { mDimState = new DimState(); } - mDimState.mLastRequestedDimContainer = container; + mDimState.mLastDimmingWindow = window; return mDimState; } diff --git a/services/core/java/com/android/server/wm/DimmerAnimationHelper.java b/services/core/java/com/android/server/wm/DimmerAnimationHelper.java index 4abf80618f6c..c9ede74b8fca 100644 --- a/services/core/java/com/android/server/wm/DimmerAnimationHelper.java +++ b/services/core/java/com/android/server/wm/DimmerAnimationHelper.java @@ -48,9 +48,8 @@ public class DimmerAnimationHelper { static class Change { private float mAlpha = -1f; private int mBlurRadius = -1; - private WindowContainer mDimmingContainer = null; + private WindowState mDimmingContainer = null; private WindowContainer mGeometryParent = null; - private int mRelativeLayer = -1; private static final float EPSILON = 0.0001f; Change() {} @@ -64,7 +63,6 @@ public class DimmerAnimationHelper { mBlurRadius = other.mBlurRadius; mDimmingContainer = other.mDimmingContainer; mGeometryParent = other.mGeometryParent; - mRelativeLayer = other.mRelativeLayer; } // Same alpha and blur @@ -84,7 +82,7 @@ public class DimmerAnimationHelper { @Override public String toString() { return "Dim state: alpha=" + mAlpha + ", blur=" + mBlurRadius + ", container=" - + mDimmingContainer + ", relativePosition=" + mRelativeLayer; + + mDimmingContainer + ", geometryParent " + mGeometryParent; } } @@ -100,14 +98,13 @@ public class DimmerAnimationHelper { } void setExitParameters() { - setRequestedRelativeParent(mRequestedProperties.mDimmingContainer, -1 /* relativeLayer */); + setRequestedRelativeParent(mRequestedProperties.mDimmingContainer); setRequestedAppearance(0f /* alpha */, 0 /* blur */); } // Sets a requested change without applying it immediately - void setRequestedRelativeParent(@NonNull WindowContainer relativeParent, int relativeLayer) { + void setRequestedRelativeParent(@NonNull WindowState relativeParent) { mRequestedProperties.mDimmingContainer = relativeParent; - mRequestedProperties.mRelativeLayer = relativeLayer; } // Sets the requested layer to reparent the dim to without applying it immediately @@ -124,7 +121,7 @@ public class DimmerAnimationHelper { /** * Commit the last changes we received. Called after * {@link Change#setExitParameters()}, - * {@link Change#setRequestedRelativeParent(WindowContainer, int)}, or + * {@link Change#setRequestedRelativeParent(WindowContainer)}, or * {@link Change#setRequestedAppearance(float, int)} */ void applyChanges(@NonNull SurfaceControl.Transaction t, @NonNull Dimmer.DimState dim) { @@ -147,8 +144,8 @@ public class DimmerAnimationHelper { reparent(dim.mDimSurface, startProperties.mGeometryParent != mRequestedProperties.mGeometryParent ? mRequestedProperties.mGeometryParent.getSurfaceControl() : null, - mRequestedProperties.mDimmingContainer.getSurfaceControl(), - mRequestedProperties.mRelativeLayer, t); + mRequestedProperties.mDimmingContainer != startProperties.mDimmingContainer + ? mRequestedProperties.mDimmingContainer.getSurfaceControl() : null, t); if (!startProperties.hasSameVisualProperties(mRequestedProperties)) { stopCurrentAnimation(dim.mDimSurface); @@ -232,14 +229,15 @@ public class DimmerAnimationHelper { */ static void reparent(@NonNull SurfaceControl dimLayer, @Nullable SurfaceControl newGeometryParent, - @NonNull SurfaceControl relativeParent, - int relativePosition, + @Nullable SurfaceControl newRelativeParent, @NonNull SurfaceControl.Transaction t) { try { if (newGeometryParent != null) { t.reparent(dimLayer, newGeometryParent); } - t.setRelativeLayer(dimLayer, relativeParent, relativePosition); + if (newRelativeParent != null) { + t.setRelativeLayer(dimLayer, newRelativeParent, -1); + } } catch (NullPointerException e) { Log.w(TAG, "Tried to change parent of dim " + dimLayer + " after remove", e); } @@ -256,10 +254,13 @@ public class DimmerAnimationHelper { private static long getDimDuration(@NonNull WindowContainer container) { // Use the same duration as the animation on the WindowContainer - AnimationAdapter animationAdapter = container.mSurfaceAnimator.getAnimation(); - final float durationScale = container.mWmService.getTransitionAnimationScaleLocked(); - return animationAdapter == null ? (long) (DEFAULT_DIM_ANIM_DURATION_MS * durationScale) - : animationAdapter.getDurationHint(); + if (container.mSurfaceAnimator != null) { + AnimationAdapter animationAdapter = container.mSurfaceAnimator.getAnimation(); + final float durationScale = container.mWmService.getTransitionAnimationScaleLocked(); + return animationAdapter == null ? (long) (DEFAULT_DIM_ANIM_DURATION_MS * durationScale) + : animationAdapter.getDurationHint(); + } + return 0; } /** diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index f0022e6295a8..021be5727bf6 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -5210,8 +5210,7 @@ class WindowState extends WindowContainer implements WindowManagerP if (isVisibleNow()) { dimmer.adjustAppearance(this, dimAmount, blurRadius); } - dimmer.adjustPosition(geometryParent, - this /* relativeParent */, -1 /* relativeLayer */); + dimmer.adjustPosition(geometryParent, this /* relativeParent */); } } diff --git a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java index e57e36d36621..144f5b675b92 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java @@ -52,39 +52,14 @@ import org.junit.runner.RunWith; @RunWith(WindowTestRunner.class) public class DimmerTests extends WindowTestsBase { - private static class TestWindowContainer extends WindowContainer { - final SurfaceControl mControl = mock(SurfaceControl.class); - final SurfaceControl.Transaction mPendingTransaction = spy(StubTransaction.class); - final SurfaceControl.Transaction mSyncTransaction = spy(StubTransaction.class); - - TestWindowContainer(WindowManagerService wm) { - super(wm); - setVisibleRequested(true); - } - - @Override - public SurfaceControl getSurfaceControl() { - return mControl; - } - - @Override - public SurfaceControl.Transaction getSyncTransaction() { - return mSyncTransaction; - } - - @Override - public SurfaceControl.Transaction getPendingTransaction() { - return mPendingTransaction; - } - } - - private static class MockSurfaceBuildingContainer extends WindowContainer { + private static class MockSurfaceBuildingContainer extends WindowContainer { final SurfaceSession mSession = new SurfaceSession(); final SurfaceControl mHostControl = mock(SurfaceControl.class); final SurfaceControl.Transaction mHostTransaction = spy(StubTransaction.class); MockSurfaceBuildingContainer(WindowManagerService wm) { super(wm); + mVisibleRequested = true; } class MockSurfaceBuilder extends SurfaceControl.Builder { @@ -129,28 +104,41 @@ public class DimmerTests extends WindowTestsBase { } } - private MockSurfaceBuildingContainer mHost; private Dimmer mDimmer; private SurfaceControl.Transaction mTransaction; - private TestWindowContainer mChild; + private WindowState mChild1; + private WindowState mChild2; private static AnimationAdapter sTestAnimation; @Before public void setUp() throws Exception { - mHost = new MockSurfaceBuildingContainer(mWm); + MockSurfaceBuildingContainer host = new MockSurfaceBuildingContainer(mWm); mTransaction = spy(StubTransaction.class); - mChild = new TestWindowContainer(mWm); + + final SurfaceControl mControl1 = mock(SurfaceControl.class); + final SurfaceControl mControl2 = mock(SurfaceControl.class); + + SurfaceAnimator animator = mock(SurfaceAnimator.class); + when(animator.getAnimation()).thenReturn(null); + + mChild1 = mock(WindowState.class); + when(mChild1.getSurfaceControl()).thenReturn(mControl1); + + mChild2 = mock(WindowState.class); + when(mChild2.getSurfaceControl()).thenReturn(mControl2); + + host.addChild(mChild1, 0); + host.addChild(mChild2, 1); + sTestAnimation = spy(new MockAnimationAdapter()); - mDimmer = new Dimmer(mHost, new MockAnimationAdapterFactory()); + mDimmer = new Dimmer(host, new MockAnimationAdapterFactory()); } @Test @RequiresFlagsDisabled(Flags.FLAG_USE_TASKS_DIM_ONLY) public void testUpdateDimsAppliesCrop() { - mHost.addChild(mChild, 0); - - mDimmer.adjustAppearance(mChild, 1, 1); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, 1, 1); + mDimmer.adjustPosition(mChild1, mChild1); int width = 100; int height = 300; @@ -165,9 +153,8 @@ public class DimmerTests extends WindowTestsBase { public void testDimBelowWithChildSurfaceCreatesSurfaceBelowChild() { final float alpha = 0.7f; final int blur = 50; - mHost.addChild(mChild, 0); - mDimmer.adjustAppearance(mChild, alpha, blur); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, alpha, blur); + mDimmer.adjustPosition(mChild1, mChild1); SurfaceControl dimLayer = mDimmer.getDimLayer(); assertNotNull("Dimmer should have created a surface", dimLayer); @@ -175,25 +162,23 @@ public class DimmerTests extends WindowTestsBase { mDimmer.updateDims(mTransaction); verify(sTestAnimation).startAnimation(eq(dimLayer), eq(mTransaction), anyInt(), any(SurfaceAnimator.OnAnimationFinishedCallback.class)); - verify(mTransaction).setRelativeLayer(dimLayer, mChild.mControl, -1); + verify(mTransaction).setRelativeLayer(dimLayer, mChild1.getSurfaceControl(), -1); verify(mTransaction, lastCall()).setAlpha(dimLayer, alpha); verify(mTransaction).setBackgroundBlurRadius(dimLayer, blur); } @Test public void testDimBelowWithChildSurfaceDestroyedWhenReset() { - mHost.addChild(mChild, 0); - final float alpha = 0.8f; final int blur = 50; // Dim once - mDimmer.adjustAppearance(mChild, alpha, blur); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, alpha, blur); + mDimmer.adjustPosition(mChild1, mChild1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); // Reset, and don't dim mDimmer.resetDimStates(); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustPosition(mChild1, mChild1); mDimmer.updateDims(mTransaction); verify(mTransaction).show(dimLayer); verify(mTransaction).remove(dimLayer); @@ -201,19 +186,17 @@ public class DimmerTests extends WindowTestsBase { @Test public void testDimBelowWithChildSurfaceNotDestroyedWhenPersisted() { - mHost.addChild(mChild, 0); - final float alpha = 0.8f; final int blur = 20; // Dim once - mDimmer.adjustAppearance(mChild, alpha, blur); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, alpha, blur); + mDimmer.adjustPosition(mChild1, mChild1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); // Reset and dim again mDimmer.resetDimStates(); - mDimmer.adjustAppearance(mChild, alpha, blur); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, alpha, blur); + mDimmer.adjustPosition(mChild1, mChild1); mDimmer.updateDims(mTransaction); verify(mTransaction).show(dimLayer); verify(mTransaction, never()).remove(dimLayer); @@ -222,10 +205,9 @@ public class DimmerTests extends WindowTestsBase { @Test @RequiresFlagsDisabled(Flags.FLAG_USE_TASKS_DIM_ONLY) public void testDimUpdateWhileDimming() { - mHost.addChild(mChild, 0); final float alpha = 0.8f; - mDimmer.adjustAppearance(mChild, alpha, 20); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, alpha, 20); + mDimmer.adjustPosition(mChild1, mChild1); final Rect bounds = mDimmer.getDimBounds(); SurfaceControl dimLayer = mDimmer.getDimLayer(); @@ -243,9 +225,8 @@ public class DimmerTests extends WindowTestsBase { @Test public void testRemoveDimImmediately() { - mHost.addChild(mChild, 0); - mDimmer.adjustAppearance(mChild, 1, 2); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, 1, 2); + mDimmer.adjustPosition(mChild1, mChild1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); verify(mTransaction, times(1)).show(dimLayer); @@ -266,22 +247,20 @@ public class DimmerTests extends WindowTestsBase { */ @Test public void testContainerDimsOpeningAnimationByItself() { - mHost.addChild(mChild, 0); - mDimmer.resetDimStates(); - mDimmer.adjustAppearance(mChild, 0.1f, 0); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, 0.1f, 0); + mDimmer.adjustPosition(mChild1, mChild1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); mDimmer.resetDimStates(); - mDimmer.adjustAppearance(mChild, 0.2f, 0); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, 0.2f, 0); + mDimmer.adjustPosition(mChild1, mChild1); mDimmer.updateDims(mTransaction); mDimmer.resetDimStates(); - mDimmer.adjustAppearance(mChild, 0.3f, 0); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, 0.3f, 0); + mDimmer.adjustPosition(mChild1, mChild1); mDimmer.updateDims(mTransaction); verify(mTransaction).setAlpha(dimLayer, 0.2f); @@ -297,22 +276,20 @@ public class DimmerTests extends WindowTestsBase { */ @Test public void testContainerDimsClosingAnimationByItself() { - mHost.addChild(mChild, 0); - mDimmer.resetDimStates(); - mDimmer.adjustAppearance(mChild, 0.2f, 0); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, 0.2f, 0); + mDimmer.adjustPosition(mChild1, mChild1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); mDimmer.resetDimStates(); - mDimmer.adjustAppearance(mChild, 0.1f, 0); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, 0.1f, 0); + mDimmer.adjustPosition(mChild1, mChild1); mDimmer.updateDims(mTransaction); mDimmer.resetDimStates(); - mDimmer.adjustAppearance(mChild, 0f, 0); - mDimmer.adjustPosition(mChild, mChild, -1); + mDimmer.adjustAppearance(mChild1, 0f, 0); + mDimmer.adjustPosition(mChild1, mChild1); mDimmer.updateDims(mTransaction); mDimmer.resetDimStates(); @@ -325,19 +302,14 @@ public class DimmerTests extends WindowTestsBase { */ @Test public void testMultipleContainersDimmingConsecutively() { - TestWindowContainer first = mChild; - TestWindowContainer second = new TestWindowContainer(mWm); - mHost.addChild(first, 0); - mHost.addChild(second, 1); - - mDimmer.adjustAppearance(first, 0.5f, 0); - mDimmer.adjustPosition(mChild, first, -1); + mDimmer.adjustAppearance(mChild1, 0.5f, 0); + mDimmer.adjustPosition(mChild1, mChild1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); mDimmer.resetDimStates(); - mDimmer.adjustAppearance(second, 0.9f, 0); - mDimmer.adjustPosition(mChild, second, -1); + mDimmer.adjustAppearance(mChild2, 0.9f, 0); + mDimmer.adjustPosition(mChild1, mChild2); mDimmer.updateDims(mTransaction); verify(sTestAnimation, times(2)).startAnimation( @@ -353,16 +325,11 @@ public class DimmerTests extends WindowTestsBase { */ @Test public void testMultipleContainersDimmingAtTheSameTime() { - TestWindowContainer first = mChild; - TestWindowContainer second = new TestWindowContainer(mWm); - mHost.addChild(first, 0); - mHost.addChild(second, 1); - - mDimmer.adjustAppearance(first, 0.5f, 0); - mDimmer.adjustPosition(mChild, first, -1); + mDimmer.adjustAppearance(mChild1, 0.5f, 0); + mDimmer.adjustPosition(mChild1, mChild1); SurfaceControl dimLayer = mDimmer.getDimLayer(); - mDimmer.adjustAppearance(second, 0.9f, 0); - mDimmer.adjustPosition(mChild, second, -1); + mDimmer.adjustAppearance(mChild2, 0.9f, 0); + mDimmer.adjustPosition(mChild1, mChild2); mDimmer.updateDims(mTransaction); verify(sTestAnimation, times(1)).startAnimation( -- GitLab From 31068add7a581f944b794e0729c960570d75d1ec Mon Sep 17 00:00:00 2001 From: Marzia Favaro Date: Wed, 4 Sep 2024 15:41:37 +0000 Subject: [PATCH 211/492] Fix finish callback transaction An old transaction was being used. Get the current sync transaction instead. Bug: 327332488 Fix: 334577675 Test: DimmerTests Flag: EXEMPT minor change Change-Id: Ic46eaa4c720a08f8ad523d1fa3031a8c6eac71b5 --- .../java/com/android/server/wm/DimmerAnimationHelper.java | 6 ++++-- .../wmtests/src/com/android/server/wm/DimmerTests.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/DimmerAnimationHelper.java b/services/core/java/com/android/server/wm/DimmerAnimationHelper.java index c9ede74b8fca..faf6dc667916 100644 --- a/services/core/java/com/android/server/wm/DimmerAnimationHelper.java +++ b/services/core/java/com/android/server/wm/DimmerAnimationHelper.java @@ -184,9 +184,11 @@ public class DimmerAnimationHelper { mLocalAnimationAdapter.startAnimation(dim.mDimSurface, t, ANIMATION_TYPE_DIMMER, /* finishCallback */ (type, animator) -> { synchronized (dim.mHostContainer.mWmService.mGlobalLock) { - setCurrentAlphaBlur(dim.mDimSurface, t); + SurfaceControl.Transaction finishTransaction = + dim.mHostContainer.getSyncTransaction(); + setCurrentAlphaBlur(dim.mDimSurface, finishTransaction); if (targetAlpha == 0f && !dim.isDimming()) { - dim.remove(t); + dim.remove(finishTransaction); } mLocalAnimationAdapter = null; mAlphaAnimationSpec = null; diff --git a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java index 144f5b675b92..1f3aa350b5b2 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java @@ -113,7 +113,7 @@ public class DimmerTests extends WindowTestsBase { @Before public void setUp() throws Exception { MockSurfaceBuildingContainer host = new MockSurfaceBuildingContainer(mWm); - mTransaction = spy(StubTransaction.class); + mTransaction = host.getSyncTransaction(); final SurfaceControl mControl1 = mock(SurfaceControl.class); final SurfaceControl mControl2 = mock(SurfaceControl.class); -- GitLab From 288bfec6203f98f4b120f3fe1dd56397fba56e14 Mon Sep 17 00:00:00 2001 From: Ibrahim Yilmaz Date: Tue, 10 Sep 2024 16:12:25 +0000 Subject: [PATCH 212/492] [RONs] Define Progress Thumb Icon for EnRouteStyle Bug: 359918677 Test: Presubmit Flag: android.app.api_rich_ongoing Change-Id: Ieb176097d658a079ae213ccc5eb6a5233918c5d0 --- core/java/android/app/Notification.java | 45 ++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index e99ba84276cd..4bd61951045c 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1593,6 +1593,17 @@ public class Notification implements Parcelable */ @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) public static final String EXTRA_ENROUTE_LARGE_ICON_SUBTEXT = "android.enrouteLargeIconSubText"; + + /** + * {@link #extras} key: {@link Icon} of an image used as a thumb icon on + * {@link Notification} progress bar for {@link EnRouteStyle} notifications. + * This extra is an {@code Icon}. + * @hide + */ + @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) + public static final String EXTRA_ENROUTE_PROGRESS_THUMB_ICON = + "android.enrouteProgressThumbIcon"; + /** * {@link #extras} key: whether the notification should be colorized as * supplied to {@link Builder#setColorized(boolean)}. @@ -3057,6 +3068,8 @@ public class Notification implements Parcelable if (Flags.apiRichOngoing()) { visitIconUri(visitor, extras.getParcelable(EXTRA_ENROUTE_OVERLAY_ICON, Icon.class)); + visitIconUri(visitor, extras.getParcelable(EXTRA_ENROUTE_PROGRESS_THUMB_ICON, + Icon.class)); } if (mBubbleMetadata != null) { @@ -11030,6 +11043,9 @@ public class Notification implements Parcelable @Nullable private CharSequence mLargeIconSubText = null; + @Nullable + private Icon mProgressThumbIcon = null; + public EnRouteStyle() { } @@ -11073,6 +11089,25 @@ public class Notification implements Parcelable return this; } + /** + * Returns the progress thumb icon. + * @see EnRouteStyle#setProgressThumbIcon + */ + @Nullable + public Icon getProgressThumbIcon() { + return mProgressThumbIcon; + } + + /** + * Optional icon to be used as a progress thumb. + */ + @NonNull + public EnRouteStyle setProgressThumbIcon(@Nullable Icon progressThumbIcon) { + mProgressThumbIcon = progressThumbIcon; + return this; + } + + /** * @hide */ @@ -11084,7 +11119,8 @@ public class Notification implements Parcelable final EnRouteStyle enRouteStyle = (EnRouteStyle) other; return !Objects.equals(mOverlayIcon, enRouteStyle.mOverlayIcon) - || !Objects.equals(mLargeIconSubText, enRouteStyle.mLargeIconSubText); + || !Objects.equals(mLargeIconSubText, enRouteStyle.mLargeIconSubText) + || !Objects.equals(mProgressThumbIcon, enRouteStyle.mProgressThumbIcon); } /** @@ -11095,6 +11131,7 @@ public class Notification implements Parcelable super.addExtras(extras); extras.putParcelable(EXTRA_ENROUTE_OVERLAY_ICON, mOverlayIcon); extras.putCharSequence(EXTRA_ENROUTE_LARGE_ICON_SUBTEXT, mLargeIconSubText); + extras.putParcelable(EXTRA_ENROUTE_PROGRESS_THUMB_ICON, mProgressThumbIcon); } /** @@ -11105,6 +11142,8 @@ public class Notification implements Parcelable super.restoreFromExtras(extras); mOverlayIcon = extras.getParcelable(EXTRA_ENROUTE_OVERLAY_ICON, Icon.class); mLargeIconSubText = extras.getCharSequence(EXTRA_ENROUTE_LARGE_ICON_SUBTEXT); + mProgressThumbIcon = + extras.getParcelable(EXTRA_ENROUTE_PROGRESS_THUMB_ICON, Icon.class); } /** @@ -11116,6 +11155,10 @@ public class Notification implements Parcelable if (mOverlayIcon != null) { mOverlayIcon.convertToAshmem(); } + + if (mProgressThumbIcon != null) { + mProgressThumbIcon.convertToAshmem(); + } } /** -- GitLab From f39dfee1dd822bad053d1da40510ae6a61923a6b Mon Sep 17 00:00:00 2001 From: omarmt Date: Tue, 10 Sep 2024 11:53:52 +0000 Subject: [PATCH 213/492] Fixed errors after updated ag/29186008 After ag/29186008 the last event in the PointerInput API can contain multiple pointers, but always and only one pointer with id == velocityPointerId. Completed the swipe gesture in multiPointerWaitAConsumableEventInMainPass to avoid possible errors. Test: atest ElementTest Test: atest MultiPointerDraggableTest Bug: 365564010 Flag: com.android.systemui.scene_container Change-Id: I69beecd0ae7c0b993da4812a663ae95077dff749 --- .../compose/animation/scene/MultiPointerDraggable.kt | 11 ++++++++--- .../animation/scene/MultiPointerDraggableTest.kt | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MultiPointerDraggable.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MultiPointerDraggable.kt index b99b7f9f4fe4..fb9dde345251 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MultiPointerDraggable.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MultiPointerDraggable.kt @@ -234,8 +234,8 @@ internal class MultiPointerDraggableNode( pointersDown == 0 -> { startedPosition = null - // This is the last pointer up - velocityTracker.addPointerInputChange(changes.single()) + val lastPointerUp = changes.single { it.id == velocityPointerId } + velocityTracker.addPointerInputChange(lastPointerUp) } // The first pointer down, startedPosition was not set. @@ -271,7 +271,12 @@ internal class MultiPointerDraggableNode( // If the previous pointer has been removed, we use the first available // change to keep tracking the velocity. - velocityPointerId = pointerChange.id + velocityPointerId = + if (pointerChange.pressed) { + pointerChange.id + } else { + changes.first { it.pressed }.id + } velocityTracker.addPointerInputChange(pointerChange) } diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MultiPointerDraggableTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MultiPointerDraggableTest.kt index 942cb2303dc5..af717ac7d50b 100644 --- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MultiPointerDraggableTest.kt +++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MultiPointerDraggableTest.kt @@ -438,6 +438,9 @@ class MultiPointerDraggableTest { continueDraggingDown() assertThat(stopped).isTrue() + + // Complete the gesture + rule.onRoot().performTouchInput { up() } } @Test -- GitLab From 916f65fa72baeaa5152a70d2894f83364bc0a9b6 Mon Sep 17 00:00:00 2001 From: omarmt Date: Tue, 10 Sep 2024 12:09:17 +0000 Subject: [PATCH 214/492] Run ktfmt 0.52 on SceneTransitionLayout sources > external/ktfmt/ktfmt.sh --kotlinlang-style packages/SystemUI/compose/scene/src/ Test: No tests. Ktfmt refactor Bug: 336710600 Flag: com.android.systemui.scene_container Change-Id: I67cc153efa34c88f367bc80b217f047bef8bf236 --- .../animation/scene/AnimateSharedAsState.kt | 34 +++++-------------- .../animation/scene/DraggableHandler.kt | 13 +++---- .../compose/animation/scene/Element.kt | 32 ++++++----------- .../animation/scene/InterruptionHandler.kt | 5 +-- .../android/compose/animation/scene/Key.kt | 10 ++---- .../compose/animation/scene/MovableElement.kt | 10 ++---- .../scene/ObservableTransitionState.kt | 11 ++---- .../animation/scene/PredictiveBackHandler.kt | 4 +-- .../animation/scene/SceneTransitionLayout.kt | 2 +- .../scene/SceneTransitionLayoutImpl.kt | 4 +-- .../scene/SceneTransitionLayoutState.kt | 14 ++++---- .../animation/scene/SceneTransitions.kt | 16 ++++----- .../compose/animation/scene/SwipeAnimation.kt | 2 +- .../compose/animation/scene/SwipeToScene.kt | 8 ++--- .../compose/animation/scene/TransitionDsl.kt | 15 ++++---- .../animation/scene/TransitionDslImpl.kt | 20 +++++------ .../scene/UserActionDistanceScopeImpl.kt | 10 +++--- .../animation/scene/content/Content.kt | 4 +-- .../scene/content/state/TransitionState.kt | 6 ++-- .../animation/scene/modifiers/SizeMatcher.kt | 24 ++++++------- .../scene/transformation/AnchoredTranslate.kt | 10 ++---- .../scene/transformation/EdgeTranslate.kt | 2 +- .../animation/scene/transformation/Fade.kt | 6 ++-- .../scene/transformation/Transformation.kt | 8 ++--- .../scene/transformation/Translate.kt | 12 ++----- .../scene/transition/link/StateLink.kt | 4 +-- .../src/com/android/compose/grid/Grids.kt | 7 ++-- .../android/compose/ui/util/MathHelpers.kt | 4 +-- .../compose/ui/util/SpaceVectorConverter.kt | 9 +++++ .../ui/compose/CommunalSwipeDetector.kt | 2 +- 30 files changed, 113 insertions(+), 195 deletions(-) diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/AnimateSharedAsState.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/AnimateSharedAsState.kt index b30f2b7002ce..0fc88b22a4d0 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/AnimateSharedAsState.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/AnimateSharedAsState.kt @@ -121,7 +121,7 @@ fun ContentScope.animateContentFloatAsState( @Deprecated( "Use animateContentFloatAsState() instead", - replaceWith = ReplaceWith("animateContentFloatAsState(value, key, canOverflow)") + replaceWith = ReplaceWith("animateContentFloatAsState(value, key, canOverflow)"), ) @Composable fun ContentScope.animateSceneFloatAsState( @@ -172,14 +172,11 @@ fun ContentScope.animateContentDpAsState( @Deprecated( "Use animateContentDpAsState() instead", - replaceWith = ReplaceWith("animateContentDpAsState(value, key, canOverflow)") + replaceWith = ReplaceWith("animateContentDpAsState(value, key, canOverflow)"), ) @Composable -fun ContentScope.animateSceneDpAsState( - value: Dp, - key: ValueKey, - canOverflow: Boolean = true, -) = animateContentDpAsState(value, key, canOverflow) +fun ContentScope.animateSceneDpAsState(value: Dp, key: ValueKey, canOverflow: Boolean = true) = + animateContentDpAsState(value, key, canOverflow) /** * Animate a shared element Dp value. @@ -214,10 +211,7 @@ private object SharedDpType : SharedValueType { * @see ContentScope.animateContentValueAsState */ @Composable -fun ContentScope.animateContentColorAsState( - value: Color, - key: ValueKey, -): AnimatedState { +fun ContentScope.animateContentColorAsState(value: Color, key: ValueKey): AnimatedState { return animateContentValueAsState(value, key, SharedColorType, canOverflow = false) } @@ -227,10 +221,7 @@ fun ContentScope.animateContentColorAsState( * @see ElementScope.animateElementValueAsState */ @Composable -fun ElementScope<*>.animateElementColorAsState( - value: Color, - key: ValueKey, -): AnimatedState { +fun ElementScope<*>.animateElementColorAsState(value: Color, key: ValueKey): AnimatedState { return animateElementValueAsState(value, key, SharedColorType, canOverflow = false) } @@ -274,12 +265,7 @@ private object SharedColorType : SharedValueType { * Note: This class is necessary because Color() checks the bounds of its values and UncheckedColor * is internal. */ -private class ColorDelta( - val red: Float, - val green: Float, - val blue: Float, - val alpha: Float, -) +private class ColorDelta(val red: Float, val green: Float, val blue: Float, val alpha: Float) @Composable internal fun animateSharedValueAsState( @@ -331,7 +317,7 @@ internal fun animateSharedValueAsState( private fun sharedValue( layoutImpl: SceneTransitionLayoutImpl, key: ValueKey, - element: ElementKey? + element: ElementKey?, ): SharedValue { return layoutImpl.sharedValues[key]?.get(element)?.let { it as SharedValue } ?: error(valueReadTooEarlyMessage(key)) @@ -342,9 +328,7 @@ private fun valueReadTooEarlyMessage(key: ValueKey) = "means that you are reading it during composition, which you should not do. See the " + "documentation of AnimatedState for more information." -internal class SharedValue( - val type: SharedValueType, -) { +internal class SharedValue(val type: SharedValueType) { /** The target value of this shared value for each content. */ val targetValues = SnapshotStateMap() diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt index 007b84a2954a..f38a31026664 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt @@ -109,12 +109,12 @@ internal class DraggableHandlerImpl( return (upOrLeft != null && contentTransition.isTransitioningBetween( fromContent.key, - upOrLeft.toContent(currentScene) + upOrLeft.toContent(currentScene), )) || (downOrRight != null && contentTransition.isTransitioningBetween( fromContent.key, - downOrRight.toContent(currentScene) + downOrRight.toContent(currentScene), )) } @@ -163,7 +163,7 @@ internal class DraggableHandlerImpl( private fun updateDragController( swipes: Swipes, - swipeAnimation: SwipeAnimation<*> + swipeAnimation: SwipeAnimation<*>, ): DragControllerImpl { val newDragController = DragControllerImpl(this, swipes, swipeAnimation) newDragController.updateTransition(swipeAnimation, force = true) @@ -171,10 +171,7 @@ internal class DraggableHandlerImpl( return newDragController } - internal fun createSwipeAnimation( - swipes: Swipes, - result: UserActionResult, - ): SwipeAnimation<*> { + internal fun createSwipeAnimation(swipes: Swipes, result: UserActionResult): SwipeAnimation<*> { val upOrLeftResult = swipes.upOrLeftResult val downOrRightResult = swipes.downOrRightResult val isUpOrLeft = @@ -266,7 +263,7 @@ private class DragControllerImpl( layoutState.startTransitionImmediately( animationScope = draggableHandler.layoutImpl.animationScope, newTransition.contentTransition, - true + true, ) } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt index a076f22a74d7..1061cc4f5989 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt @@ -263,7 +263,7 @@ internal class ElementNode( @ExperimentalComposeUiApi override fun MeasureScope.measure( measurable: Measurable, - constraints: Constraints + constraints: Constraints, ): MeasureResult { check(isLookingAhead) @@ -344,7 +344,7 @@ internal class ElementNode( private fun ApproachMeasureScope.doNotPlace( measurable: Measurable, - constraints: Constraints + constraints: Constraints, ): MeasureResult { recursivelyClearPlacementValues() stateInContent.lastSize = Element.SizeUnspecified @@ -355,7 +355,7 @@ internal class ElementNode( private fun ApproachMeasureScope.placeNormally( measurable: Measurable, - constraints: Constraints + constraints: Constraints, ): MeasureResult { val placeable = measurable.measure(constraints) stateInContent.lastSize = placeable.size() @@ -670,10 +670,7 @@ private fun prepareInterruption( * Reconcile the state of [element] in the formContent and toContent of [transition] so that the * values before interruption have their expected values, taking shared transitions into account. */ -private fun reconcileStates( - element: Element, - transition: TransitionState.Transition, -) { +private fun reconcileStates(element: Element, transition: TransitionState.Transition) { val fromContentState = element.stateByContent[transition.fromContent] ?: return val toContentState = element.stateByContent[transition.toContent] ?: return if (!isSharedElementEnabled(element.key, transition)) { @@ -1139,7 +1136,7 @@ private fun ContentDrawScope.getDrawScale( Offset.Unspecified } else { a.pivot.specifiedOrCenter() - b.pivot.specifiedOrCenter() - } + }, ) }, add = { a, b, bProgress -> @@ -1151,9 +1148,9 @@ private fun ContentDrawScope.getDrawScale( Offset.Unspecified } else { a.pivot.specifiedOrCenter() + b.pivot.specifiedOrCenter() * bProgress - } + }, ) - } + }, ) stateInContent.lastScale = interruptedScale @@ -1371,7 +1368,7 @@ private inline fun computeValue( lerp( lerp(previewTargetValue, targetValueOrNull ?: idleValue, previewRangeProgress), idleValue, - transformation?.range?.progress(transition.progress) ?: transition.progress + transformation?.range?.progress(transition.progress) ?: transition.progress, ) } else { if (targetValueOrNull == null) { @@ -1384,7 +1381,7 @@ private inline fun computeValue( lerp( lerp(idleValue, previewTargetValue, previewRangeProgress), targetValueOrNull, - transformation.range?.progress(transition.progress) ?: transition.progress + transformation.range?.progress(transition.progress) ?: transition.progress, ) } } @@ -1399,14 +1396,7 @@ private inline fun computeValue( val idleValue = contentValue(contentState) val targetValue = - transformation.transform( - layoutImpl, - content, - element, - contentState, - transition, - idleValue, - ) + transformation.transform(layoutImpl, content, element, contentState, transition, idleValue) // Make sure we don't read progress if values are the same and we don't need to interpolate, so // we don't invalidate the phase where this is read. @@ -1433,7 +1423,7 @@ private inline fun interpolateSharedElement( fromState: Element.State, toState: Element.State, isSpecified: (T) -> Boolean, - lerp: (T, T, Float) -> T + lerp: (T, T, Float) -> T, ): T { val start = contentValue(fromState) val end = contentValue(toState) diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/InterruptionHandler.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/InterruptionHandler.kt index cb18c6729170..205714608e3c 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/InterruptionHandler.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/InterruptionHandler.kt @@ -79,9 +79,6 @@ object DefaultInterruptionHandler : InterruptionHandler { interrupted: TransitionState.Transition.ChangeScene, newTargetScene: SceneKey, ): InterruptionResult { - return InterruptionResult( - animateFrom = interrupted.currentScene, - chain = true, - ) + return InterruptionResult(animateFrom = interrupted.currentScene, chain = true) } } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Key.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Key.kt index ced177ccb9a0..f9a9eeb0d34f 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Key.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Key.kt @@ -49,10 +49,7 @@ sealed class ContentKey(debugName: String, identity: Any) : Key(debugName, ident } /** Key for a scene. */ -class SceneKey( - debugName: String, - identity: Any = Object(), -) : ContentKey(debugName, identity) { +class SceneKey(debugName: String, identity: Any = Object()) : ContentKey(debugName, identity) { override val testTag: String = "scene:$debugName" /** The unique [ElementKey] identifying this scene's root element. */ @@ -64,10 +61,7 @@ class SceneKey( } /** Key for an overlay. */ -class OverlayKey( - debugName: String, - identity: Any = Object(), -) : ContentKey(debugName, identity) { +class OverlayKey(debugName: String, identity: Any = Object()) : ContentKey(debugName, identity) { override val testTag: String = "overlay:$debugName" override fun toString(): String { diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt index 471ad3fee9fb..1f26b71cf3e5 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt @@ -86,7 +86,7 @@ private abstract class BaseElementScope( value: T, key: ValueKey, type: SharedValueType, - canOverflow: Boolean + canOverflow: Boolean, ): AnimatedState { return animateSharedValueAsState( layoutImpl, @@ -200,7 +200,7 @@ private fun shouldComposeMovableElement( content, element, elementState, - isInContent = { contents.contains(it) } + isInContent = { contents.contains(it) }, ) } } @@ -220,11 +220,7 @@ private fun movableElementContentWhenIdle( elementState: TransitionState.Idle, ): ContentKey { val contents = element.contentPicker.contents - return elementContentWhenIdle( - layoutImpl, - elementState, - isInContent = { contents.contains(it) }, - ) + return elementContentWhenIdle(layoutImpl, elementState, isInContent = { contents.contains(it) }) } /** diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt index 8ae3a1145e24..9f2ac24b844e 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt @@ -57,10 +57,8 @@ sealed interface ObservableTransitionState { /** No transition/animation is currently running. */ data class Idle @JvmOverloads - constructor( - val currentScene: SceneKey, - val currentOverlays: Set = emptySet(), - ) : ObservableTransitionState + constructor(val currentScene: SceneKey, val currentOverlays: Set = emptySet()) : + ObservableTransitionState /** There is a transition animating between two scenes. */ sealed class Transition( @@ -219,10 +217,7 @@ fun SceneTransitionLayoutState.observableTransitionState(): Flow - ObservableTransitionState.Idle( - state.currentScene, - state.currentOverlays, - ) + ObservableTransitionState.Idle(state.currentScene, state.currentOverlays) is TransitionState.Transition.ChangeScene -> { ObservableTransitionState.Transition.ChangeScene( fromScene = state.fromScene, diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt index 8480d3afaed4..b00c8ade07eb 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt @@ -35,9 +35,7 @@ internal fun PredictiveBackHandler( layoutImpl: SceneTransitionLayoutImpl, result: UserActionResult?, ) { - PredictiveBackHandler( - enabled = result != null, - ) { events: Flow -> + PredictiveBackHandler(enabled = result != null) { events: Flow -> if (result == null) { // Note: We have to collect progress otherwise PredictiveBackHandler will throw. events.first() diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayout.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayout.kt index 004bb40bb0ad..f20548b1f81b 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayout.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayout.kt @@ -585,7 +585,7 @@ fun interface UserActionDistance { */ fun UserActionDistanceScope.absoluteDistance( fromSceneSize: IntSize, - orientation: Orientation + orientation: Orientation, ): Float } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutImpl.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutImpl.kt index f36c0fa2d75c..fe052344023c 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutImpl.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutImpl.kt @@ -253,7 +253,7 @@ internal class SceneTransitionLayoutImpl( key: OverlayKey, userActions: Map, alignment: Alignment, - content: @Composable (ContentScope.() -> Unit) + content: @Composable (ContentScope.() -> Unit), ) { overlaysDefined = true overlaysToRemove.remove(key) @@ -291,7 +291,7 @@ internal class SceneTransitionLayoutImpl( private fun resolveUserActions( key: ContentKey, userActions: Map, - layoutDirection: LayoutDirection + layoutDirection: LayoutDirection, ): Map { return userActions .mapKeys { it.key.resolve(layoutDirection) } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt index c2d5dd053148..dbff8a4f7f45 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayoutState.kt @@ -328,9 +328,7 @@ internal class MutableSceneTransitionLayoutStateImpl( ): Job { // Note that we start with UNDISPATCHED so that startTransition() is called directly and // transition becomes the current [transitionState] right after this call. - return animationScope.launch( - start = CoroutineStart.UNDISPATCHED, - ) { + return animationScope.launch(start = CoroutineStart.UNDISPATCHED) { startTransition(transition, chain) } } @@ -461,7 +459,7 @@ internal class MutableSceneTransitionLayoutStateImpl( val indicator = if (finishedTransitions.contains(transition)) "x" else " " appendLine(" [$indicator] $from => $to ($transition)") } - } + }, ) } @@ -621,7 +619,7 @@ internal class MutableSceneTransitionLayoutStateImpl( override fun showOverlay( overlay: OverlayKey, animationScope: CoroutineScope, - transitionKey: TransitionKey? + transitionKey: TransitionKey?, ) { checkThread() @@ -654,7 +652,7 @@ internal class MutableSceneTransitionLayoutStateImpl( ) { animate( replacedTransition = currentState, - reversed = overlay == currentState.fromContent + reversed = overlay == currentState.fromContent, ) } else { animate() @@ -664,7 +662,7 @@ internal class MutableSceneTransitionLayoutStateImpl( override fun hideOverlay( overlay: OverlayKey, animationScope: CoroutineScope, - transitionKey: TransitionKey? + transitionKey: TransitionKey?, ) { checkThread() @@ -705,7 +703,7 @@ internal class MutableSceneTransitionLayoutStateImpl( from: OverlayKey, to: OverlayKey, animationScope: CoroutineScope, - transitionKey: TransitionKey? + transitionKey: TransitionKey?, ) { checkThread() diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitions.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitions.kt index e65ed9b7dc97..b358faf2c418 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitions.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitions.kt @@ -50,7 +50,7 @@ internal constructor( private val transitionCache = mutableMapOf< ContentKey, - MutableMap> + MutableMap>, >() private val overscrollCache = @@ -70,7 +70,7 @@ internal constructor( private fun findSpec( from: ContentKey, to: ContentKey, - key: TransitionKey? + key: TransitionKey?, ): TransitionSpecImpl { val spec = transition(from, to, key) { it.from == from && it.to == to } if (spec != null) { @@ -250,7 +250,7 @@ internal class TransitionSpecImpl( override val to: ContentKey?, private val previewTransformationSpec: (() -> TransformationSpecImpl)? = null, private val reversePreviewTransformationSpec: (() -> TransformationSpecImpl)? = null, - private val transformationSpec: () -> TransformationSpecImpl + private val transformationSpec: () -> TransformationSpecImpl, ) : TransitionSpec { override fun reversed(): TransitionSpecImpl { return TransitionSpecImpl( @@ -265,9 +265,9 @@ internal class TransitionSpecImpl( progressSpec = reverse.progressSpec, swipeSpec = reverse.swipeSpec, distance = reverse.distance, - transformations = reverse.transformations.map { it.reversed() } + transformations = reverse.transformations.map { it.reversed() }, ) - } + }, ) } @@ -382,11 +382,7 @@ internal class TransformationSpecImpl( return ElementTransformations(shared, offset, size, drawScale, alpha) } - private fun throwIfNotNull( - previous: Transformation?, - element: ElementKey, - name: String, - ) { + private fun throwIfNotNull(previous: Transformation?, element: ElementKey, name: String) { if (previous != null) { error("$element has multiple $name transformations") } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt index 966bda410231..84dce0d730c4 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt @@ -54,7 +54,7 @@ internal fun createSwipeAnimation( result: UserActionResult, isUpOrLeft: Boolean, orientation: Orientation, - distance: Float = DistanceUnspecified + distance: Float = DistanceUnspecified, ): SwipeAnimation<*> { var lastDistance = distance diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeToScene.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeToScene.kt index dc7eda5b9cf6..98d4aaa91458 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeToScene.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeToScene.kt @@ -39,14 +39,14 @@ import com.android.compose.animation.scene.content.Content @Stable internal fun Modifier.swipeToScene( draggableHandler: DraggableHandlerImpl, - swipeDetector: SwipeDetector + swipeDetector: SwipeDetector, ): Modifier { return this.then(SwipeToSceneElement(draggableHandler, swipeDetector)) } private data class SwipeToSceneElement( val draggableHandler: DraggableHandlerImpl, - val swipeDetector: SwipeDetector + val swipeDetector: SwipeDetector, ) : ModifierNodeElement() { override fun create(): SwipeToSceneNode = SwipeToSceneNode(draggableHandler, swipeDetector) @@ -183,12 +183,12 @@ internal fun interface ScrollBehaviorOwner { */ private class ScrollBehaviorOwnerNode( override val traverseKey: Any, - val nestedScrollHandlerImpl: NestedScrollHandlerImpl + val nestedScrollHandlerImpl: NestedScrollHandlerImpl, ) : Modifier.Node(), TraversableNode, ScrollBehaviorOwner { override fun updateScrollBehaviors( topOrLeftBehavior: NestedScrollBehavior, bottomOrRightBehavior: NestedScrollBehavior, - isExternalOverscrollGesture: () -> Boolean + isExternalOverscrollGesture: () -> Boolean, ) { nestedScrollHandlerImpl.topOrLeftBehavior = topOrLeftBehavior nestedScrollHandlerImpl.bottomOrRightBehavior = bottomOrRightBehavior diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/TransitionDsl.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/TransitionDsl.kt index 1f82e0bd026a..763dc6bf49e0 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/TransitionDsl.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/TransitionDsl.kt @@ -333,7 +333,7 @@ object HighestZIndexContentPicker : ElementContentPicker { element: ElementKey, transition: TransitionState.Transition, fromContentZIndex: Float, - toContentZIndex: Float + toContentZIndex: Float, ): ContentKey { return if (fromContentZIndex > toContentZIndex) { transition.fromContent @@ -354,7 +354,7 @@ object HighestZIndexContentPicker : ElementContentPicker { element: ElementKey, transition: TransitionState.Transition, fromContentZIndex: Float, - toContentZIndex: Float + toContentZIndex: Float, ): ContentKey { return HighestZIndexContentPicker.contentDuringTransition( element, @@ -375,7 +375,7 @@ object LowestZIndexContentPicker : ElementContentPicker { element: ElementKey, transition: TransitionState.Transition, fromContentZIndex: Float, - toContentZIndex: Float + toContentZIndex: Float, ): ContentKey { return if (fromContentZIndex < toContentZIndex) { transition.fromContent @@ -396,7 +396,7 @@ object LowestZIndexContentPicker : ElementContentPicker { element: ElementKey, transition: TransitionState.Transition, fromContentZIndex: Float, - toContentZIndex: Float + toContentZIndex: Float, ): ContentKey { return LowestZIndexContentPicker.contentDuringTransition( element, @@ -423,9 +423,8 @@ object LowestZIndexContentPicker : ElementContentPicker { * is not the same as when going from scene B to scene A, so it's not usable in situations where * z-ordering during the transition matters. */ -class MovableElementContentPicker( - override val contents: Set, -) : StaticElementContentPicker { +class MovableElementContentPicker(override val contents: Set) : + StaticElementContentPicker { override fun contentDuringTransition( element: ElementKey, transition: TransitionState.Transition, @@ -501,7 +500,7 @@ interface PropertyTransformationBuilder { matcher: ElementMatcher, scaleX: Float = 1f, scaleY: Float = 1f, - pivot: Offset = Offset.Unspecified + pivot: Offset = Offset.Unspecified, ) /** diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/TransitionDslImpl.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/TransitionDslImpl.kt index da4c8d8db752..7ec5e4f4f149 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/TransitionDslImpl.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/TransitionDslImpl.kt @@ -41,9 +41,7 @@ import com.android.compose.animation.scene.transformation.Transformation import com.android.compose.animation.scene.transformation.TransformationRange import com.android.compose.animation.scene.transformation.Translate -internal fun transitionsImpl( - builder: SceneTransitionsBuilder.() -> Unit, -): SceneTransitions { +internal fun transitionsImpl(builder: SceneTransitionsBuilder.() -> Unit): SceneTransitions { val impl = SceneTransitionsBuilderImpl().apply(builder) return SceneTransitions( impl.defaultSwipeSpec, @@ -67,7 +65,7 @@ private class SceneTransitionsBuilderImpl : SceneTransitionsBuilder { key: TransitionKey?, preview: (TransitionBuilder.() -> Unit)?, reversePreview: (TransitionBuilder.() -> Unit)?, - builder: TransitionBuilder.() -> Unit + builder: TransitionBuilder.() -> Unit, ): TransitionSpec { return transition(from = null, to = to, key = key, preview, reversePreview, builder) } @@ -78,7 +76,7 @@ private class SceneTransitionsBuilderImpl : SceneTransitionsBuilder { key: TransitionKey?, preview: (TransitionBuilder.() -> Unit)?, reversePreview: (TransitionBuilder.() -> Unit)?, - builder: TransitionBuilder.() -> Unit + builder: TransitionBuilder.() -> Unit, ): TransitionSpec { return transition(from = from, to = to, key = key, preview, reversePreview, builder) } @@ -86,7 +84,7 @@ private class SceneTransitionsBuilderImpl : SceneTransitionsBuilder { override fun overscroll( content: ContentKey, orientation: Orientation, - builder: OverscrollBuilder.() -> Unit + builder: OverscrollBuilder.() -> Unit, ): OverscrollSpec { val impl = OverscrollBuilderImpl().apply(builder) check(impl.transformations.isNotEmpty()) { @@ -150,7 +148,7 @@ private class SceneTransitionsBuilderImpl : SceneTransitionsBuilder { to, previewTransformationSpec, reversePreviewTransformationSpec, - transformationSpec + transformationSpec, ) transitionSpecs.add(spec) return spec @@ -167,7 +165,7 @@ internal abstract class BaseTransitionBuilderImpl : BaseTransitionBuilder { start: Float?, end: Float?, easing: Easing, - builder: PropertyTransformationBuilder.() -> Unit + builder: PropertyTransformationBuilder.() -> Unit, ) { range = TransformationRange(start, end, easing) builder() @@ -202,7 +200,7 @@ internal abstract class BaseTransitionBuilderImpl : BaseTransitionBuilder { override fun translate( matcher: ElementMatcher, edge: Edge, - startsOutsideLayoutBounds: Boolean + startsOutsideLayoutBounds: Boolean, ) { transformation(EdgeTranslate(matcher, edge, startsOutsideLayoutBounds)) } @@ -256,7 +254,7 @@ internal class TransitionBuilderImpl : BaseTransitionBuilderImpl(), TransitionBu startMillis: Int?, endMillis: Int?, easing: Easing, - builder: PropertyTransformationBuilder.() -> Unit + builder: PropertyTransformationBuilder.() -> Unit, ) { if (startMillis != null && (startMillis < 0 || startMillis > durationMillis)) { error("invalid start value: startMillis=$startMillis durationMillis=$durationMillis") @@ -278,7 +276,7 @@ internal open class OverscrollBuilderImpl : BaseTransitionBuilderImpl(), Overscr override fun translate( matcher: ElementMatcher, x: OverscrollScope.() -> Float, - y: OverscrollScope.() -> Float + y: OverscrollScope.() -> Float, ) { transformation(OverscrollTranslate(matcher, x, y)) } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/UserActionDistanceScopeImpl.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/UserActionDistanceScopeImpl.kt index 9851b32c42c4..b7fa0d497200 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/UserActionDistanceScopeImpl.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/UserActionDistanceScopeImpl.kt @@ -19,9 +19,8 @@ package com.android.compose.animation.scene import androidx.compose.ui.geometry.Offset import androidx.compose.ui.unit.IntSize -internal class ElementStateScopeImpl( - private val layoutImpl: SceneTransitionLayoutImpl, -) : ElementStateScope { +internal class ElementStateScopeImpl(private val layoutImpl: SceneTransitionLayoutImpl) : + ElementStateScope { override fun ElementKey.targetSize(scene: SceneKey): IntSize? { return layoutImpl.elements[this]?.stateByContent?.get(scene)?.targetSize.takeIf { it != Element.SizeUnspecified @@ -39,9 +38,8 @@ internal class ElementStateScopeImpl( } } -internal class UserActionDistanceScopeImpl( - private val layoutImpl: SceneTransitionLayoutImpl, -) : UserActionDistanceScope, ElementStateScope by layoutImpl.elementStateScope { +internal class UserActionDistanceScopeImpl(private val layoutImpl: SceneTransitionLayoutImpl) : + UserActionDistanceScope, ElementStateScope by layoutImpl.elementStateScope { override val density: Float get() = layoutImpl.density.density diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/Content.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/Content.kt index 59dd896ad9ea..c8407b13db66 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/Content.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/Content.kt @@ -106,7 +106,7 @@ internal class ContentScopeImpl( override fun Element( key: ElementKey, modifier: Modifier, - content: @Composable (ElementScope.() -> Unit) + content: @Composable (ElementScope.() -> Unit), ) { Element(layoutImpl, this@ContentScopeImpl.content, key, modifier, content) } @@ -115,7 +115,7 @@ internal class ContentScopeImpl( override fun MovableElement( key: MovableElementKey, modifier: Modifier, - content: @Composable (ElementScope.() -> Unit) + content: @Composable (ElementScope.() -> Unit), ) { MovableElement(layoutImpl, this@ContentScopeImpl.content, key, modifier, content) } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt index a47caaa15f18..364c2036e02d 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/content/state/TransitionState.kt @@ -184,7 +184,7 @@ sealed interface TransitionState { private fun computeCurrentOverlays( include: OverlayKey, - exclude: OverlayKey + exclude: OverlayKey, ): Set { return buildSet { addAll(currentOverlaysWhenTransitionStarted) @@ -336,9 +336,7 @@ sealed interface TransitionState { return specForCurrentScene.transformationSpec.transformations.isNotEmpty() } - internal open fun interruptionProgress( - layoutImpl: SceneTransitionLayoutImpl, - ): Float { + internal open fun interruptionProgress(layoutImpl: SceneTransitionLayoutImpl): Float { if (!layoutImpl.state.enableInterruptions) { return 0f } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/modifiers/SizeMatcher.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/modifiers/SizeMatcher.kt index a4bd2be45297..4698e5849d02 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/modifiers/SizeMatcher.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/modifiers/SizeMatcher.kt @@ -119,9 +119,8 @@ fun Modifier.sizeMatcherDestination(matcher: SizeMatcher): Modifier { return this.then(SizeMatcherDestinationElement(matcher)) } -private data class SizeMatcherSourceNodeElement( - private val matcher: SizeMatcher, -) : ModifierNodeElement() { +private data class SizeMatcherSourceNodeElement(private val matcher: SizeMatcher) : + ModifierNodeElement() { override fun create(): SizeMatcherSourceNode = SizeMatcherSourceNode(matcher) override fun update(node: SizeMatcherSourceNode) { @@ -129,9 +128,8 @@ private data class SizeMatcherSourceNodeElement( } } -private class SizeMatcherSourceNode( - private var matcher: SizeMatcher, -) : Modifier.Node(), LayoutModifierNode { +private class SizeMatcherSourceNode(private var matcher: SizeMatcher) : + Modifier.Node(), LayoutModifierNode { override fun onAttach() { matcher.source = this } @@ -150,7 +148,7 @@ private class SizeMatcherSourceNode( override fun MeasureScope.measure( measurable: Measurable, - constraints: Constraints + constraints: Constraints, ): MeasureResult { return measurable.measure(constraints).run { matcher.sourceSize = IntSize(width, height) @@ -159,9 +157,8 @@ private class SizeMatcherSourceNode( } } -private data class SizeMatcherDestinationElement( - private val matcher: SizeMatcher, -) : ModifierNodeElement() { +private data class SizeMatcherDestinationElement(private val matcher: SizeMatcher) : + ModifierNodeElement() { override fun create(): SizeMatcherDestinationNode = SizeMatcherDestinationNode(matcher) override fun update(node: SizeMatcherDestinationNode) { @@ -169,9 +166,8 @@ private data class SizeMatcherDestinationElement( } } -private class SizeMatcherDestinationNode( - private var matcher: SizeMatcher, -) : Modifier.Node(), LayoutModifierNode { +private class SizeMatcherDestinationNode(private var matcher: SizeMatcher) : + Modifier.Node(), LayoutModifierNode { override fun onAttach() { this.matcher.destinations.add(this) } @@ -190,7 +186,7 @@ private class SizeMatcherDestinationNode( override fun MeasureScope.measure( measurable: Measurable, - constraints: Constraints + constraints: Constraints, ): MeasureResult { val preferredSize = matcher.sourceSize val preferredConstraints = Constraints.fixed(preferredSize.width, preferredSize.height) diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/AnchoredTranslate.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/AnchoredTranslate.kt index 05878c2d3f08..86e06ab1f243 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/AnchoredTranslate.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/AnchoredTranslate.kt @@ -61,15 +61,9 @@ internal class AnchoredTranslate( val offset = anchorToOffset - anchorFromOffset return if (content == transition.toContent) { - Offset( - value.x - offset.x, - value.y - offset.y, - ) + Offset(value.x - offset.x, value.y - offset.y) } else { - Offset( - value.x + offset.x, - value.y + offset.y, - ) + Offset(value.x + offset.x, value.y + offset.y) } } } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/EdgeTranslate.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/EdgeTranslate.kt index a32c7dd09f95..031f50e17225 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/EdgeTranslate.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/EdgeTranslate.kt @@ -36,7 +36,7 @@ internal class EdgeTranslate( element: Element, stateInContent: Element.State, transition: TransitionState.Transition, - value: Offset + value: Offset, ): Offset { val sceneSize = layoutImpl.content(content).targetSize val elementSize = stateInContent.targetSize diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Fade.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Fade.kt index 4528eefedb3e..078aa0f7efe9 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Fade.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Fade.kt @@ -23,16 +23,14 @@ import com.android.compose.animation.scene.SceneTransitionLayoutImpl import com.android.compose.animation.scene.content.state.TransitionState /** Fade an element in or out. */ -internal class Fade( - override val matcher: ElementMatcher, -) : PropertyTransformation { +internal class Fade(override val matcher: ElementMatcher) : PropertyTransformation { override fun transform( layoutImpl: SceneTransitionLayoutImpl, content: ContentKey, element: Element, stateInContent: Element.State, transition: TransitionState.Transition, - value: Float + value: Float, ): Float { // Return the alpha value of [element] either when it starts fading in or when it finished // fading out, which is `0` in both cases. diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Transformation.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Transformation.kt index 505ad04c598c..9bb302307359 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Transformation.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Transformation.kt @@ -83,17 +83,13 @@ internal class RangedPropertyTransformation( override fun reversed(): Transformation { return RangedPropertyTransformation( delegate.reversed() as PropertyTransformation, - range.reversed() + range.reversed(), ) } } /** The progress-based range of a [PropertyTransformation]. */ -data class TransformationRange( - val start: Float, - val end: Float, - val easing: Easing, -) { +data class TransformationRange(val start: Float, val end: Float, val easing: Easing) { constructor( start: Float? = null, end: Float? = null, diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Translate.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Translate.kt index 8f845866a0f3..70142717fffe 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Translate.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transformation/Translate.kt @@ -40,12 +40,7 @@ internal class Translate( transition: TransitionState.Transition, value: Offset, ): Offset { - return with(layoutImpl.density) { - Offset( - value.x + x.toPx(), - value.y + y.toPx(), - ) - } + return with(layoutImpl.density) { Offset(value.x + x.toPx(), value.y + y.toPx()) } } } @@ -71,10 +66,7 @@ internal class OverscrollTranslate( val overscrollScope = cachedOverscrollScope.getFromCacheOrCompute(layoutImpl.density, overscrollProperties) - return Offset( - x = value.x + overscrollScope.x(), - y = value.y + overscrollScope.y(), - ) + return Offset(x = value.x + overscrollScope.x(), y = value.y + overscrollScope.y()) } } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/link/StateLink.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/link/StateLink.kt index c830ca4fa7c0..2aec5091c3e5 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/link/StateLink.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/link/StateLink.kt @@ -50,9 +50,7 @@ class StateLink(target: SceneTransitionLayoutState, val transitionLinks: List + Layout(modifier = modifier, content = content) { measurables, constraints -> val cells = measurables.size val columns: Int val rows: Int @@ -142,7 +139,7 @@ private fun Grid( (constraints.maxHeight - totalVerticalSpacingBetweenChildren) / rows } else { Constraints.Infinity - } + }, ) val placeables = buildList { diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/ui/util/MathHelpers.kt b/packages/SystemUI/compose/scene/src/com/android/compose/ui/util/MathHelpers.kt index e78ab297bfba..0447c36ea3f4 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/ui/util/MathHelpers.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/ui/util/MathHelpers.kt @@ -27,7 +27,7 @@ import com.android.compose.animation.scene.Scale fun lerp(start: IntSize, stop: IntSize, fraction: Float): IntSize { return IntSize( lerp(start.width, stop.width, fraction), - lerp(start.height, stop.height, fraction) + lerp(start.height, stop.height, fraction), ) } @@ -43,6 +43,6 @@ fun lerp(start: Scale, stop: Scale, fraction: Float): Scale { return Scale( lerp(start.scaleX, stop.scaleX, fraction), lerp(start.scaleY, stop.scaleY, fraction), - pivot + pivot, ) } diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/ui/util/SpaceVectorConverter.kt b/packages/SystemUI/compose/scene/src/com/android/compose/ui/util/SpaceVectorConverter.kt index a13e9441523a..f08a18046537 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/ui/util/SpaceVectorConverter.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/ui/util/SpaceVectorConverter.kt @@ -22,8 +22,11 @@ import androidx.compose.ui.unit.Velocity interface SpaceVectorConverter { fun Offset.toFloat(): Float + fun Velocity.toFloat(): Float + fun Float.toOffset(): Offset + fun Float.toVelocity(): Velocity } @@ -36,15 +39,21 @@ fun SpaceVectorConverter(orientation: Orientation) = private val HorizontalConverter = object : SpaceVectorConverter { override fun Offset.toFloat() = x + override fun Velocity.toFloat() = x + override fun Float.toOffset() = Offset(this, 0f) + override fun Float.toVelocity() = Velocity(this, 0f) } private val VerticalConverter = object : SpaceVectorConverter { override fun Offset.toFloat() = y + override fun Velocity.toFloat() = y + override fun Float.toOffset() = Offset(0f, this) + override fun Float.toVelocity() = Velocity(0f, this) } diff --git a/packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt b/packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt index 41b015a2ede8..00e5405dd904 100644 --- a/packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt +++ b/packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt @@ -43,7 +43,7 @@ class CommunalSwipeDetector(private var lastDirection: SwipeSource.Resolved? = n layoutSize: IntSize, position: IntOffset, density: Density, - orientation: Orientation + orientation: Orientation, ): SwipeSource.Resolved? { return lastDirection } -- GitLab From 9fe38eb066bf375503243f9028b196715b391486 Mon Sep 17 00:00:00 2001 From: Juan Sebastian Martinez Date: Fri, 30 Aug 2024 11:43:48 -0700 Subject: [PATCH 215/492] Removing Haptic Brightness Slider flag This feature has been publicly released. Test: presubmit Flag: NONE flag is being removed. Bug: 296467915 Change-Id: I186a36c979af4c7114a11120872fb4ce1452dfd6 --- packages/SystemUI/aconfig/systemui.aconfig | 9 +-------- .../settings/brightness/BrightnessSliderController.java | 6 +----- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index ad14035d9d0a..02e8cd6c398d 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -246,13 +246,6 @@ flag { bug: "261728888" } -flag { - name: "haptic_brightness_slider" - namespace: "systemui" - description: "Adds haptic feedback to the brightness slider." - bug: "296467915" -} - flag { name: "unfold_animation_background_progress" namespace: "systemui" @@ -1401,4 +1394,4 @@ flag { namespace: "systemui" description: "Allow non-touchscreen devices to bypass falsing" bug: "319809270" -} \ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java index 083cee73f591..75165cb5610e 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java +++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java @@ -16,8 +16,6 @@ package com.android.systemui.settings.brightness; -import static com.android.systemui.Flags.hapticBrightnessSlider; - import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; @@ -317,9 +315,7 @@ public class BrightnessSliderController extends ViewController Date: Wed, 4 Sep 2024 15:48:13 -0700 Subject: [PATCH 216/492] Fix BubbleExtractor not looking up activity info in a user-based way Use package manager to look up activity info with the userId for the notification, instead of using package manager based on current context which doesn't work for HSUM. Flag: EXEMPT bug fix Test: atest BubbleExtractorTest NotificationManagerServiceTest Test: manual - make a secondary user and send an intent-based bubble - ensure the bubble button is on the notification Bug: 362181768 Change-Id: I5359bc395f06cbb5d0706f81fa2be1a56efc63d5 --- .../server/notification/BubbleExtractor.java | 38 ++-- .../NotificationManagerService.java | 1 + .../notification/BubbleExtractorTest.java | 179 ++++++++++-------- .../NotificationManagerServiceTest.java | 2 +- 4 files changed, 129 insertions(+), 91 deletions(-) diff --git a/services/core/java/com/android/server/notification/BubbleExtractor.java b/services/core/java/com/android/server/notification/BubbleExtractor.java index b8900d7acee5..3d6f9cfed697 100644 --- a/services/core/java/com/android/server/notification/BubbleExtractor.java +++ b/services/core/java/com/android/server/notification/BubbleExtractor.java @@ -27,10 +27,11 @@ import static com.android.internal.util.FrameworkStatsLog.BUBBLE_DEVELOPER_ERROR import android.app.ActivityManager; import android.app.Notification; import android.app.NotificationChannel; -import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.util.Slog; @@ -47,6 +48,7 @@ public class BubbleExtractor implements NotificationSignalExtractor { private ShortcutHelper mShortcutHelper; private RankingConfig mConfig; private ActivityManager mActivityManager; + private PackageManager mPackageManager; private Context mContext; boolean mSupportsBubble; @@ -76,6 +78,11 @@ public class BubbleExtractor implements NotificationSignalExtractor { return null; } + if (mPackageManager == null) { + if (DBG) Slog.d(TAG, "missing package manager"); + return null; + } + boolean notifCanPresentAsBubble = canPresentAsBubble(record) && !mActivityManager.isLowRamDevice() && record.isConversation() @@ -133,6 +140,10 @@ public class BubbleExtractor implements NotificationSignalExtractor { mShortcutHelper = helper; } + public void setPackageManager(PackageManager packageManager) { + mPackageManager = packageManager; + } + @VisibleForTesting public void setActivityManager(ActivityManager manager) { mActivityManager = manager; @@ -176,30 +187,25 @@ public class BubbleExtractor implements NotificationSignalExtractor { // TODO: check the shortcut intent / ensure it can show in activity view return true; } - return canLaunchInTaskView(mContext, metadata.getIntent(), pkg); + return canLaunchInTaskView(metadata.getIntent().getIntent(), pkg, + r.getUser().getIdentifier()); } /** - * Whether an intent is properly configured to display in an {@link - * TaskView} for bubbling. + * Whether an intent is properly configured to display in a TaskView for bubbling. * - * @param context the context to use. - * @param pendingIntent the pending intent of the bubble. - * @param packageName the notification package name for this bubble. + * @param intent the intent of the bubble. + * @param packageName the notification package name for this bubble. */ - // Keep checks in sync with BubbleController#canLaunchInTaskView. - @VisibleForTesting - protected boolean canLaunchInTaskView(Context context, PendingIntent pendingIntent, - String packageName) { - if (pendingIntent == null) { + // Keep checks in sync with BubbleController#isResizableActivity. + private boolean canLaunchInTaskView(Intent intent, String packageName, int userId) { + if (intent == null) { Slog.w(TAG, "Unable to create bubble -- no intent"); return false; } - Intent intent = pendingIntent.getIntent(); - ActivityInfo info = intent != null - ? intent.resolveActivityInfo(context.getPackageManager(), 0) - : null; + ResolveInfo resolveInfo = mPackageManager.resolveActivityAsUser(intent, 0, userId); + ActivityInfo info = resolveInfo != null ? resolveInfo.activityInfo : null; if (info == null) { FrameworkStatsLog.write(FrameworkStatsLog.BUBBLE_DEVELOPER_ERROR_REPORTED, packageName, diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 54e918972d46..e2ec0063c711 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -3020,6 +3020,7 @@ public class NotificationManagerService extends SystemService { BubbleExtractor bubbsExtractor = mRankingHelper.findExtractor(BubbleExtractor.class); if (bubbsExtractor != null) { bubbsExtractor.setShortcutHelper(mShortcutHelper); + bubbsExtractor.setPackageManager(mPackageManagerClient); } registerNotificationPreferencesPullers(); if (mLockUtils == null) { diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java index b5bc610f82ea..2effc692e877 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java @@ -30,9 +30,9 @@ import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -44,6 +44,8 @@ import android.app.PendingIntent; import android.app.Person; import android.content.Intent; import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.content.pm.ShortcutInfo; import android.os.SystemClock; import android.os.UserHandle; @@ -89,6 +91,8 @@ public class BubbleExtractorTest extends UiServiceTestCase { @Mock ShortcutHelper mShortcutHelper; @Mock + PackageManager mPackageManager; + @Mock ActivityManager mActivityManager; @Before @@ -98,6 +102,7 @@ public class BubbleExtractorTest extends UiServiceTestCase { mBubbleExtractor.initialize(mContext, mock(NotificationUsageStats.class)); mBubbleExtractor.setConfig(mConfig); mBubbleExtractor.setShortcutHelper(mShortcutHelper); + mBubbleExtractor.setPackageManager(mPackageManager); mBubbleExtractor.setActivityManager(mActivityManager); mChannel = new NotificationChannel(CHANNEL_ID, CHANNEL_ID, IMPORTANCE_DEFAULT); @@ -106,7 +111,7 @@ public class BubbleExtractorTest extends UiServiceTestCase { } /* NotificationRecord that fulfills conversation requirements (message style + shortcut) */ - private NotificationRecord getNotificationRecord(boolean addBubble) { + private NotificationRecord getNotificationRecord(boolean addBubble, UserHandle user) { final Builder builder = new Builder(getContext()) .setContentTitle("foo") .setSmallIcon(android.R.drawable.sym_def_app_icon) @@ -127,13 +132,13 @@ public class BubbleExtractorTest extends UiServiceTestCase { n.setBubbleMetadata(mBubbleMetadata); } StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, ID, TAG, UID, - PID, n, mUser, null, System.currentTimeMillis()); + PID, n, user, null, System.currentTimeMillis()); NotificationRecord r = new NotificationRecord(getContext(), sbn, mChannel); r.setShortcutInfo(mShortcutInfo); return r; } - void setUpIntentBubble(boolean isValid) { + void setUpIntentBubble(boolean isValid, UserHandle user) { when(mPendingIntent.getIntent()).thenReturn(mIntent); when(mBubbleMetadata.getIntent()).thenReturn(mPendingIntent); when(mBubbleMetadata.getShortcutId()).thenReturn(null); @@ -143,18 +148,21 @@ public class BubbleExtractorTest extends UiServiceTestCase { info.resizeMode = isValid ? RESIZE_MODE_RESIZEABLE : RESIZE_MODE_UNRESIZEABLE; - when(mIntent.resolveActivityInfo(any(), anyInt())).thenReturn(info); + ResolveInfo resolveInfo = new ResolveInfo(); + resolveInfo.activityInfo = info; + when(mPackageManager.resolveActivityAsUser(eq(mIntent), eq(0), eq(user.getIdentifier()))) + .thenReturn(resolveInfo); } - void setUpShortcutBubble(boolean isValid) { + void setUpShortcutBubble(boolean isValid, UserHandle user) { when(mBubbleMetadata.getShortcutId()).thenReturn(SHORTCUT_ID); when(mBubbleMetadata.getIntent()).thenReturn(null); ShortcutInfo answer = isValid ? mShortcutInfo : null; - when(mShortcutHelper.getValidShortcutInfo(SHORTCUT_ID, PKG, mUser)).thenReturn(answer); + when(mShortcutHelper.getValidShortcutInfo(SHORTCUT_ID, PKG, user)).thenReturn(answer); } - void setUpBubblesEnabled(boolean feature, int app, int channel) { - when(mConfig.bubblesEnabled(mUser)).thenReturn(feature); + void setUpBubblesEnabled(boolean feature, int app, int channel, UserHandle user) { + when(mConfig.bubblesEnabled(user)).thenReturn(feature); when(mConfig.getBubblePreference(anyString(), anyInt())).thenReturn(app); mChannel.setAllowBubbles(channel); } @@ -167,10 +175,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppYesChannelNo() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - ALLOW_BUBBLE_OFF /* channel */); + ALLOW_BUBBLE_OFF /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); - NotificationRecord r = getNotificationRecord(true /* bubble */); + setUpShortcutBubble(true /* isValid */, mUser); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); assertFalse(r.canBubble()); @@ -181,10 +190,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppYesChannelDefault() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); - NotificationRecord r = getNotificationRecord(true /* bubble */); + setUpShortcutBubble(true /* isValid */, mUser); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -195,10 +205,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppYesChannelYes() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - ALLOW_BUBBLE_ON /* channel */); + ALLOW_BUBBLE_ON /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); - NotificationRecord r = getNotificationRecord(true /* bubble */); + setUpShortcutBubble(true /* isValid */, mUser); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -209,10 +220,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppYesChannelYesFeatureNo() { setUpBubblesEnabled(false /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - ALLOW_BUBBLE_ON /* channel */); + ALLOW_BUBBLE_ON /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); - NotificationRecord r = getNotificationRecord(true /* bubble */); + setUpShortcutBubble(true /* isValid */, mUser); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -224,10 +236,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppNoChannelYes() throws Exception { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_NONE /* app */, - ALLOW_BUBBLE_ON /* channel */); + ALLOW_BUBBLE_ON /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); - NotificationRecord r = getNotificationRecord(true /* bubble */); + setUpShortcutBubble(true /* isValid */, mUser); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -239,10 +252,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppNoChannelDefault() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_NONE /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); - NotificationRecord r = getNotificationRecord(true /* bubble */); + setUpShortcutBubble(true /* isValid */, mUser); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -254,10 +268,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppSelectedChannelDefault() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_SELECTED /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); - NotificationRecord r = getNotificationRecord(true /* bubble */); + setUpShortcutBubble(true /* isValid */, mUser); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -269,10 +284,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppSelectedChannelNo() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_SELECTED /* app */, - ALLOW_BUBBLE_OFF /* channel */); + ALLOW_BUBBLE_OFF /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); - NotificationRecord r = getNotificationRecord(true /* bubble */); + setUpShortcutBubble(true /* isValid */, mUser); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -284,11 +300,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppSeletedChannelYes() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_SELECTED /* app */, - ALLOW_BUBBLE_ON /* channel */); + ALLOW_BUBBLE_ON /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); + setUpShortcutBubble(true /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -299,11 +316,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testAppSeletedChannelYesFeatureNo() { setUpBubblesEnabled(false /* feature */, BUBBLE_PREFERENCE_SELECTED /* app */, - ALLOW_BUBBLE_ON /* channel */); + ALLOW_BUBBLE_ON /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); + setUpShortcutBubble(true /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); @@ -319,11 +337,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_previouslyRemoved() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); + setUpShortcutBubble(true /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); r.setFlagBubbleRemoved(true); mBubbleExtractor.process(r); @@ -337,11 +356,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_true_shortcutBubble() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(true /* isValid */); + setUpShortcutBubble(true /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); assertTrue(r.canBubble()); @@ -353,11 +373,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_true_intentBubble() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpIntentBubble(true /* isValid */); + setUpIntentBubble(true /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); assertTrue(r.canBubble()); @@ -369,11 +390,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_noIntentInvalidShortcut() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpShortcutBubble(false /* isValid */); + setUpShortcutBubble(false /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); r.setShortcutInfo(null); mBubbleExtractor.process(r); @@ -386,11 +408,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_invalidIntentNoShortcut() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpIntentBubble(false /* isValid */); + setUpIntentBubble(false /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); r.setShortcutInfo(null); mBubbleExtractor.process(r); @@ -403,11 +426,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_noIntentNoShortcut() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); // Shortcut here is for the notification not the bubble - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); assertFalse(r.canBubble()); @@ -419,10 +443,11 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_noMetadata() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - NotificationRecord r = getNotificationRecord(false /* bubble */); + NotificationRecord r = getNotificationRecord(false /* bubble */, mUser); mBubbleExtractor.process(r); assertFalse(r.canBubble()); @@ -434,11 +459,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_noShortcut() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpIntentBubble(true /* isValid */); + setUpIntentBubble(true /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); r.setShortcutInfo(null); r.getNotification().extras.putString(Notification.EXTRA_TEMPLATE, null); @@ -453,11 +479,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_notConversation() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(false); - setUpIntentBubble(true /* isValid */); + setUpIntentBubble(true /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); r.userDemotedAppFromConvoSpace(true); r.getNotification().extras.putString(Notification.EXTRA_TEMPLATE, null); @@ -472,11 +499,12 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_lowRamDevice() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(true); - setUpIntentBubble(true /* isValid */); + setUpIntentBubble(true /* isValid */, mUser); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); assertFalse(r.canBubble()); @@ -488,12 +516,13 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_noIntent() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(true); - setUpIntentBubble(true /* isValid */); + setUpIntentBubble(true /* isValid */, mUser); when(mPendingIntent.getIntent()).thenReturn(null); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); assertFalse(r.canBubble()); @@ -505,13 +534,15 @@ public class BubbleExtractorTest extends UiServiceTestCase { public void testFlagBubble_false_noActivityInfo() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, - DEFAULT_ALLOW_BUBBLE /* channel */); + DEFAULT_ALLOW_BUBBLE /* channel */, + mUser); when(mActivityManager.isLowRamDevice()).thenReturn(true); - setUpIntentBubble(true /* isValid */); + setUpIntentBubble(true /* isValid */, mUser); when(mPendingIntent.getIntent()).thenReturn(mIntent); - when(mIntent.resolveActivityInfo(any(), anyInt())).thenReturn(null); + when(mPackageManager.resolveActivityAsUser(eq(mIntent), eq(0), eq(mUser.getIdentifier()))) + .thenReturn(null); - NotificationRecord r = getNotificationRecord(true /* bubble */); + NotificationRecord r = getNotificationRecord(true /* bubble */, mUser); mBubbleExtractor.process(r); assertFalse(r.canBubble()); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 6a1140cc84e9..196bc47572ba 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -1255,7 +1255,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { info.resizeMode = RESIZE_MODE_RESIZEABLE; ResolveInfo ri = new ResolveInfo(); ri.activityInfo = info; - when(mPackageManagerClient.resolveActivity(any(), anyInt())).thenReturn(ri); + when(mPackageManagerClient.resolveActivityAsUser(any(), anyInt(), anyInt())).thenReturn(ri); return new Notification.BubbleMetadata.Builder( mActivityIntent, -- GitLab From 509d4ce70b04d0cad2f4b2d3a81ec2f6f1fc86c8 Mon Sep 17 00:00:00 2001 From: Varun Shah Date: Tue, 10 Sep 2024 00:50:54 +0000 Subject: [PATCH 217/492] Rate limit calls to AM.getMyMemoryState(). Apps do not need to call getMyMemoryState any more than 200 times per second. Rate limit this API to 2 calls every 10ms which will allow apps to keep getting updated info at a reasonable interval. Flag: android.app.rate_limit_get_my_memory_state Bug: 365182205 Test: atest ActivityManagerTest Test: manually check logs for cache hits/misses Change-Id: I0ab53c8f477dc5a82c812d1fe541491e04367cc9 --- core/java/android/app/ActivityManager.java | 41 ++++++++++++++++++- .../java/android/app/activity_manager.aconfig | 11 +++++ .../com/android/server/am/ProcessList.java | 27 +++++------- 3 files changed, 61 insertions(+), 18 deletions(-) diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index b4fb4803a2b9..7273e64846c0 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -247,6 +247,14 @@ public class ActivityManager { @GuardedBy("mMemoryInfoCache") private static final MemoryInfo mRateLimitedMemInfo = new MemoryInfo(); + /** Rate-Limiting cache that allows no more than 200 calls to the service per second. */ + @GuardedBy("mMyMemoryStateCache") + private static final RateLimitingCache mMyMemoryStateCache = + new RateLimitingCache<>(10, 2); + /** Used to store cached results for rate-limited calls to getMyMemoryState(). */ + @GuardedBy("mMyMemoryStateCache") + private static final RunningAppProcessInfo mRateLimitedMemState = new RunningAppProcessInfo(); + /** * Query handler for mGetCurrentUserIdCache - returns a cached value of the current foreground * user id if the backstage_power/android.app.cache_get_current_user_id flag is enabled. @@ -4223,6 +4231,23 @@ public class ActivityManager { lastActivityTime = source.readLong(); } + /** + * Note: only fields that are updated in ProcessList.fillInProcMemInfoLOSP() are copied. + * @hide + */ + public void copyTo(RunningAppProcessInfo other) { + other.pid = pid; + other.uid = uid; + other.flags = flags; + other.lastTrimLevel = lastTrimLevel; + other.importance = importance; + other.lru = lru; + other.importanceReasonCode = importanceReasonCode; + other.processState = processState; + other.isFocused = isFocused; + other.lastActivityTime = lastActivityTime; + } + public static final @android.annotation.NonNull Creator CREATOR = new Creator() { public RunningAppProcessInfo createFromParcel(Parcel source) { @@ -4854,7 +4879,21 @@ public class ActivityManager { * {@link RunningAppProcessInfo#lru}, and * {@link RunningAppProcessInfo#importanceReasonCode}. */ - static public void getMyMemoryState(RunningAppProcessInfo outState) { + public static void getMyMemoryState(RunningAppProcessInfo outState) { + if (Flags.rateLimitGetMyMemoryState()) { + synchronized (mMyMemoryStateCache) { + mMyMemoryStateCache.get(() -> { + getMyMemoryStateInternal(mRateLimitedMemState); + return mRateLimitedMemState; + }); + mRateLimitedMemState.copyTo(outState); + } + } else { + getMyMemoryStateInternal(outState); + } + } + + private static void getMyMemoryStateInternal(RunningAppProcessInfo outState) { try { getService().getMyMemoryState(outState); } catch (RemoteException e) { diff --git a/core/java/android/app/activity_manager.aconfig b/core/java/android/app/activity_manager.aconfig index c0c81df465e2..38bd576d607a 100644 --- a/core/java/android/app/activity_manager.aconfig +++ b/core/java/android/app/activity_manager.aconfig @@ -136,3 +136,14 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + namespace: "backstage_power" + name: "rate_limit_get_my_memory_state" + description: "Rate limit calls to getMyMemoryState using a cache" + is_fixed_read_only: true + bug: "365182205" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index 5b4e57350c40..e54e4301a4eb 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -4121,19 +4121,6 @@ public final class ProcessList { return false; } - private static int procStateToImportance(int procState, int memAdj, - ActivityManager.RunningAppProcessInfo currApp, - int clientTargetSdk) { - int imp = ActivityManager.RunningAppProcessInfo.procStateToImportanceForTargetSdk( - procState, clientTargetSdk); - if (imp == ActivityManager.RunningAppProcessInfo.IMPORTANCE_BACKGROUND) { - currApp.lru = memAdj; - } else { - currApp.lru = 0; - } - return imp; - } - @GuardedBy(anyOf = {"mService", "mProcLock"}) void fillInProcMemInfoLOSP(ProcessRecord app, ActivityManager.RunningAppProcessInfo outInfo, @@ -4151,14 +4138,20 @@ public final class ProcessList { } outInfo.lastTrimLevel = app.mProfile.getTrimMemoryLevel(); final ProcessStateRecord state = app.mState; - int adj = state.getCurAdj(); - int procState = state.getCurProcState(); - outInfo.importance = procStateToImportance(procState, adj, outInfo, - clientTargetSdk); + final int procState = state.getCurProcState(); + outInfo.importance = ActivityManager.RunningAppProcessInfo + .procStateToImportanceForTargetSdk(procState, clientTargetSdk); + if (outInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_BACKGROUND) { + outInfo.lru = state.getCurAdj(); + } else { + outInfo.lru = 0; + } outInfo.importanceReasonCode = state.getAdjTypeCode(); outInfo.processState = procState; outInfo.isFocused = (app == mService.getTopApp()); outInfo.lastActivityTime = app.getLastActivityTime(); + // Note: ActivityManager$RunningAppProcessInfo.copyTo() must be updated if what gets + // "filled into" outInfo in this method changes. } @GuardedBy(anyOf = {"mService", "mProcLock"}) -- GitLab From 3f3dce4f4eacdd334518275137469e07288c2e32 Mon Sep 17 00:00:00 2001 From: Utkarsh Nigam Date: Tue, 10 Sep 2024 18:13:00 +0000 Subject: [PATCH 218/492] Fix the naming of variables for permission checks. Change-Id: Ibcb54a73c5bef18596370e2f9232ee69f3b894a3 Flag: EXEMPT Trivial change. Test: No tests exist. Bug: 357551503 --- .../server/appfunctions/CallerValidatorImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java b/services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java index 35905edbcf24..618a5aedd9bb 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java +++ b/services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java @@ -79,17 +79,20 @@ class CallerValidatorImpl implements CallerValidator { // TODO(b/360864791): Add and honor apps that opt-out from EXECUTE_APP_FUNCTIONS caller. public boolean verifyCallerCanExecuteAppFunction( @NonNull String callerPackageName, @NonNull String targetPackageName) { + if (callerPackageName.equals(targetPackageName)) { + return true; + } + int pid = Binder.getCallingPid(); int uid = Binder.getCallingUid(); - boolean hasExecutionPermission = + boolean hasTrustedExecutionPermission = mContext.checkPermission( Manifest.permission.EXECUTE_APP_FUNCTIONS_TRUSTED, pid, uid) == PackageManager.PERMISSION_GRANTED; - boolean hasTrustedExecutionPermission = + boolean hasExecutionPermission = mContext.checkPermission(Manifest.permission.EXECUTE_APP_FUNCTIONS, pid, uid) == PackageManager.PERMISSION_GRANTED; - boolean isSamePackage = callerPackageName.equals(targetPackageName); - return hasExecutionPermission || hasTrustedExecutionPermission || isSamePackage; + return hasExecutionPermission || hasTrustedExecutionPermission; } @Override -- GitLab From c317d4a270f9d0cd50f9fd307f31a3f8d92fe26a Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Tue, 10 Sep 2024 11:20:40 -0700 Subject: [PATCH 219/492] Allow junit-impl to see runtime-helper-src Flag: EXEMPT host test change only Bug: 292141694 Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh Change-Id: If540b852eaf0dec6b47e94553000444ef533b5ec --- ravenwood/Android.bp | 4 ++- .../RavenwoodAwareTestRunnerHook.java | 8 +++++ .../ravenwood/RavenwoodEnvironment_host.java | 34 ++----------------- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp index eebe5e9fc054..8ff99e4af30d 100644 --- a/ravenwood/Android.bp +++ b/ravenwood/Android.bp @@ -129,9 +129,9 @@ java_library { ], libs: [ "framework-minus-apex.ravenwood", - "ravenwood-junit", "ravenwood-helper-libcore-runtime", ], + sdk_version: "core_current", visibility: ["//visibility:private"], } @@ -165,6 +165,8 @@ java_library { "services.core.ravenwood", "junit", "framework-annotations-lib", + "ravenwood-helper-framework-runtime", + "ravenwood-helper-libcore-runtime", ], sdk_version: "core_current", visibility: ["//frameworks/base"], diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java index 92a1cb7fc3bf..68472c12a568 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java @@ -28,6 +28,7 @@ import android.util.Log; import androidx.test.platform.app.InstrumentationRegistry; import com.android.internal.os.RuntimeInit; +import com.android.platform.test.ravenwood.runtimehelper.ClassLoadHook; import com.android.ravenwood.common.RavenwoodCommonUtils; import org.junit.runner.Description; @@ -75,6 +76,9 @@ public class RavenwoodAwareTestRunnerHook { // We haven't initialized liblog yet, so directly write to System.out here. RavenwoodCommonUtils.log(TAG, "initOnce()"); + // Make sure libandroid_runtime is loaded. + ClassLoadHook.onClassLoaded(Log.class); + // Redirect stdout/stdin to liblog. RuntimeInit.redirectLogStreams(); @@ -82,6 +86,10 @@ public class RavenwoodAwareTestRunnerHook { System.setProperty("android.junit.runner", "androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner"); System.setProperty(RAVENWOOD_VERSION_JAVA_SYSPROP, "1"); + + // Do the basic set up for the android sysprops. + RavenwoodRuntimeEnvironmentController.setSystemProperties( + RavenwoodSystemProperties.DEFAULT_VALUES); } /** diff --git a/ravenwood/runtime-helper-src/framework/com/android/internal/ravenwood/RavenwoodEnvironment_host.java b/ravenwood/runtime-helper-src/framework/com/android/internal/ravenwood/RavenwoodEnvironment_host.java index 3bf116da19b8..e12ff240c4d9 100644 --- a/ravenwood/runtime-helper-src/framework/com/android/internal/ravenwood/RavenwoodEnvironment_host.java +++ b/ravenwood/runtime-helper-src/framework/com/android/internal/ravenwood/RavenwoodEnvironment_host.java @@ -15,21 +15,10 @@ */ package com.android.internal.ravenwood; -import android.os.SystemProperties_host; -import android.platform.test.ravenwood.RavenwoodSystemProperties; -import android.util.Log; - import com.android.ravenwood.common.JvmWorkaround; import com.android.ravenwood.common.RavenwoodCommonUtils; public class RavenwoodEnvironment_host { - private static final String TAG = RavenwoodEnvironment.TAG; - - private static final Object sInitializeLock = new Object(); - - // @GuardedBy("sInitializeLock") - private static boolean sInitialized; - private RavenwoodEnvironment_host() { } @@ -37,27 +26,8 @@ public class RavenwoodEnvironment_host { * Called from {@link RavenwoodEnvironment#ensureRavenwoodInitialized()}. */ public static void ensureRavenwoodInitialized() { - - // TODO Unify it with the initialization code in RavenwoodAwareTestRunnerHook. - - synchronized (sInitializeLock) { - if (sInitialized) { - return; - } - Log.i(TAG, "Initializing Ravenwood environment"); - - // Set the default values. - var sysProps = RavenwoodSystemProperties.DEFAULT_VALUES; - - // We have a method that does it in RavenwoodRuleImpl, but we can't use that class - // here, So just inline it. - SystemProperties_host.initializeIfNeeded( - sysProps.getValues(), - sysProps.getKeyReadablePredicate(), - sysProps.getKeyWritablePredicate()); - - sInitialized = true; - } + // Initialization is now done by RavenwoodAwareTestRunner. + // Should we remove it? } /** -- GitLab From 6990e09b66691e08d5551cdee3aea740c387248c Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 29 Aug 2024 23:47:40 +0000 Subject: [PATCH 220/492] Add aconfig flag for mouse reverse vertical scrolling DD: go/al-mouse-settings Bug: 359349392 Bug: 352598211 Test: N/A Flag: com.android.hardware.input.mouse_reverse_vertical_scrolling Change-Id: I19cc60886d2d7daf7cf4444f911377cc61bc8ce4 --- core/java/android/hardware/input/input_framework.aconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/java/android/hardware/input/input_framework.aconfig b/core/java/android/hardware/input/input_framework.aconfig index fcd6c31d7d18..4478592ae8a5 100644 --- a/core/java/android/hardware/input/input_framework.aconfig +++ b/core/java/android/hardware/input/input_framework.aconfig @@ -117,3 +117,10 @@ flag { description: "Allow configurable timeout before key repeat and repeat delay rate for key repeats" bug: "336585002" } + +flag { + name: "mouse_reverse_vertical_scrolling" + namespace: "input" + description: "Controls whether external mouse vertical scrolling can be reversed" + bug: "352598211" +} -- GitLab From d032a9c8d402a40facc32afc6e5567118258a1c8 Mon Sep 17 00:00:00 2001 From: Simranjit Kohli Date: Tue, 10 Sep 2024 11:39:42 -0700 Subject: [PATCH 221/492] [Improve logging] Add clear messaging for ignored logs Improve logging by adding clear messaging when the PresentationsStatsEventLogger would be ignoring logs. Another option was to not log, and do an early return in the case of when logging would be ignored. However, I think that it may be helpful for debugging purpose to still have logging to know if something useful is being ignored. Test: m Flag: EXEMPT bugfix Bug: 365801998 Change-Id: I377423d4dbd2ec50bae20a91436906009edbf191 --- .../server/autofill/PresentationStatsEventLogger.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java b/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java index 5044e93b293d..2c261fe668fb 100644 --- a/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java +++ b/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java @@ -842,9 +842,13 @@ public final class PresentationStatsEventLogger { + "event"); return; } + PresentationStatsEventInternal event = mEventInternal.get(); + boolean ignoreLogging = !event.mIsDatasetAvailable; + if (sVerbose) { Slog.v(TAG, "(" + caller + ") " + + (ignoreLogging ? "IGNORING - following event won't be logged: " : "") + "Log AutofillPresentationEventReported:" + " requestId=" + event.mRequestId + " sessionId=" + mSessionId @@ -907,7 +911,8 @@ public final class PresentationStatsEventLogger { } // TODO(b/234185326): Distinguish empty responses from other no presentation reasons. - if (!event.mIsDatasetAvailable) { + if (ignoreLogging) { + Slog.w(TAG, "Empty dataset. Autofill ignoring log"); mEventInternal = Optional.empty(); return; } -- GitLab From 316bd69b5e7ed08e5610df84d97b8278066e0658 Mon Sep 17 00:00:00 2001 From: "Priyanka Advani (xWF)" Date: Tue, 10 Sep 2024 20:18:06 +0000 Subject: [PATCH 222/492] Revert "Move tests/systemui/s* to multivalentTests" This reverts commit 0b2c6ef749283f86a1fa5befcaa12f812cc91ac5. Reason for revert: Droidmonitor created revert due to b/365818453. Change-Id: Ibf031644270df7caf1e7941077561501a3df7972 --- .../domain/interactor/HeadsUpNotificationInteractorTest.kt | 0 .../{utils => }/src/com/android/keyguard/TestScopeProvider.kt | 0 .../com/android/systemui/screenrecord/RecordingServiceTest.java | 0 .../screenrecord/ScreenRecordPermissionDialogDelegateTest.kt | 0 .../screenrecord/data/repository/ScreenRecordRepositoryTest.kt | 0 .../com/android/systemui/screenshot/ActionIntentExecutorTest.kt | 0 .../com/android/systemui/screenshot/AnnouncementResolverTest.kt | 0 .../systemui/screenshot/DraggableConstraintLayoutTest.java | 0 .../src/com/android/systemui/screenshot/FakeImageCapture.kt | 0 .../src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt | 0 .../android/systemui/screenshot/MessageContainerControllerTest.kt | 0 .../src/com/android/systemui/screenshot/RecyclerViewActivity.java | 0 .../systemui/screenshot/ScreenshotActionsControllerTest.kt | 0 .../src/com/android/systemui/screenshot/ScreenshotDataTest.kt | 0 .../systemui/screenshot/ScreenshotDetectionControllerTest.kt | 0 .../screenshot/ScreenshotNotificationSmartActionsTest.java | 0 .../android/systemui/screenshot/ScreenshotSoundControllerTest.kt | 0 .../com/android/systemui/screenshot/SmartActionsReceiverTest.java | 0 .../com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt | 0 .../systemui/screenshot/WorkProfileMessageControllerTest.java | 0 .../screenshot/appclips/AppClipsScreenshotHelperServiceTest.java | 0 .../android/systemui/screenshot/appclips/AppClipsServiceTest.java | 0 .../systemui/screenshot/data/model/DisplayContentScenarios.kt | 0 .../screenshot/data/repository/ProfileTypeRepositoryKosmos.kt | 0 .../systemui/screenshot/message/ProfileMessageControllerTest.kt | 0 .../src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt | 0 .../systemui/screenshot/policy/PolicyRequestProcessorTest.kt | 0 .../systemui/screenshot/policy/PrivateProfilePolicyTest.kt | 0 .../src/com/android/systemui/screenshot/policy/TestUserIds.kt | 0 .../android/systemui/screenshot/policy/WorkProfilePolicyTest.kt | 0 .../com/android/systemui/screenshot/scroll/FakeSessionTest.java | 0 .../screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java | 0 .../android/systemui/screenshot/scroll/ScrollViewActivity.java | 0 .../systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt | 0 .../src/com/android/systemui/scrim/ScrimViewTest.java | 0 .../systemui/settings/brightness/BrightnessControllerTest.kt | 0 .../android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt | 0 .../src/com/android/systemui/shade/ConstraintChangeTest.kt | 0 .../src/com/android/systemui/shade/ConstraintChangesTest.kt | 0 .../systemui/shade/LockscreenHostedDreamGestureListenerTest.kt | 0 .../shade/NotificationPanelUnfoldAnimationControllerTest.kt | 0 .../systemui/shade/NotificationPanelViewControllerBaseTest.java | 0 .../systemui/shade/NotificationPanelViewControllerTest.java | 0 .../shade/NotificationPanelViewControllerWithCoroutinesTest.kt | 0 .../com/android/systemui/shade/NotificationShadeWindowViewTest.kt | 0 .../systemui/shade/NotificationsQuickSettingsContainerTest.kt | 0 .../src/com/android/systemui/shade/PulsingGestureListenerTest.kt | 0 .../src/com/android/systemui/shade/QsBatteryModeControllerTest.kt | 0 .../systemui/shade/QuickSettingsControllerImplBaseTest.java | 0 .../shade/QuickSettingsControllerImplWithCoroutinesTest.kt | 0 .../src/com/android/systemui/shade/ShadeControllerImplTest.kt | 0 .../src/com/android/systemui/shade/carrier/CellSignalStateTest.kt | 0 .../src/com/android/systemui/shade/carrier/ShadeCarrierTest.java | 0 .../systemui/shade/data/repository/ShadeRepositoryImplTest.kt | 0 .../shade/transition/LinearLargeScreenShadeInterpolator.kt | 0 .../shade/transition/ScrimShadeTransitionControllerTest.kt | 0 .../shared/animation/DisableSubpixelTextTransitionListenerTest.kt | 0 .../shared/animation/UnfoldConstantTranslateAnimatorTest.kt | 0 .../systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt | 0 .../src/com/android/systemui/shared/clocks/ClockRegistryTest.kt | 0 .../android/systemui/shared/clocks/DefaultClockProviderTest.kt | 0 .../android/systemui/shared/condition/ConditionExtensionsTest.kt | 0 .../android/systemui/shared/condition/ConditionMonitorTest.java | 0 .../src/com/android/systemui/shared/condition/ConditionTest.java | 0 .../src/com/android/systemui/shared/condition/FakeCondition.java | 0 .../com/android/systemui/shared/plugins/PluginManagerTest.java | 0 .../src/com/android/systemui/shared/plugins/VersionInfoTest.java | 0 .../android/systemui/shared/regionsampling/RegionSamplerTest.kt | 0 .../systemui/shared/rotation/RotationButtonControllerTest.kt | 0 .../src/com/android/systemui/statusbar/BlurUtilsTest.kt | 0 .../src/com/android/systemui/statusbar/DragDownHelperTest.kt | 0 .../systemui/statusbar/KeyguardIndicationControllerBaseTest.java | 0 .../com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt | 0 .../statusbar/LockscreenShadeQsTransitionControllerTest.kt | 0 .../com/android/systemui/statusbar/NotificationEntryHelper.java | 0 .../com/android/systemui/statusbar/NotificationListenerTest.java | 0 .../systemui/statusbar/NotificationRemoteInputManagerTest.java | 0 .../systemui/statusbar/NotificationShadeDepthControllerTest.kt | 0 .../android/systemui/statusbar/NotificationUiAdjustmentTest.java | 0 .../com/android/systemui/statusbar/PulseExpansionHandlerTest.kt | 0 .../systemui/statusbar/RemoteInputNotificationRebuilderTest.java | 0 .../systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt | 0 .../com/android/systemui/statusbar/SmartReplyControllerTest.java | 0 .../src/com/android/systemui/statusbar/StatusBarStateEventTest.kt | 0 .../src/com/android/systemui/statusbar/VibratorHelperTest.kt | 0 .../statusbar/chips/ui/view/ChipBackgroundContainerTest.kt | 0 .../systemui/statusbar/chips/ui/view/ChipChronometerTest.kt | 0 .../com/android/systemui/statusbar/commandline/ParametersTest.kt | 0 .../systemui/statusbar/commandline/ParseableCommandTest.kt | 0 .../com/android/systemui/statusbar/commandline/ValueParserTest.kt | 0 .../statusbar/connectivity/AccessPointControllerImplTest.kt | 0 .../statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt | 0 .../systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt | 0 .../statusbar/connectivity/ui/MobileContextProviderTest.kt | 0 .../data/repository/KeyguardStatusBarRepositoryImplTest.kt | 0 .../statusbar/data/repository/StatusBarModeRepositoryImplTest.kt | 0 .../systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt | 0 .../systemui/statusbar/disableflags/DisableStateTrackerTest.kt | 0 .../disableflags/data/repository/DisableFlagsRepositoryTest.kt | 0 .../src/com/android/systemui/statusbar/events/FakeStatusEvent.kt | 0 .../statusbar/events/SystemEventChipAnimationControllerTest.kt | 0 .../systemui/statusbar/events/SystemEventCoordinatorTest.kt | 0 .../statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt | 0 .../statusbar/notification/DynamicChildBindControllerTest.java | 0 .../statusbar/notification/DynamicPrivacyControllerTest.java | 0 .../notification/NotificationWakeUpCoordinatorLoggerTest.kt | 0 .../statusbar/notification/NotificationWakeUpCoordinatorTest.kt | 0 .../notification/collection/HighPriorityProviderTest.java | 0 .../statusbar/notification/collection/NoManSimulator.java | 0 .../statusbar/notification/collection/NotifLiveDataImplTest.kt | 0 .../notification/collection/NotifLiveDataStoreImplTest.kt | 0 .../statusbar/notification/collection/NotifLiveDataStoreMocks.kt | 0 .../notification/collection/NotifPipelineChoreographerTest.kt | 0 .../statusbar/notification/collection/SectionStyleProviderTest.kt | 0 .../notification/collection/coalescer/GroupCoalescerTest.java | 0 .../collection/coordinator/ColorizedFgsCoordinatorTest.java | 0 .../collection/coordinator/DeviceProvisionedCoordinatorTest.java | 0 .../collection/coordinator/DismissibilityCoordinatorTest.kt | 0 .../notification/collection/coordinator/DreamCoordinatorTest.kt | 0 .../collection/coordinator/GroupCountCoordinatorTest.kt | 0 .../collection/coordinator/GroupWhenCoordinatorTest.kt | 0 .../notification/collection/coordinator/GutsCoordinatorTest.kt | 0 .../notification/collection/coordinator/HeadsUpCoordinatorTest.kt | 0 .../coordinator/HideNotifsForOtherUsersCoordinatorTest.java | 0 .../collection/coordinator/KeyguardCoordinatorTest.kt | 0 .../notification/collection/coordinator/MediaCoordinatorTest.java | 0 .../coordinator/NotificationStatsLoggerCoordinatorTest.kt | 0 .../collection/coordinator/PreparationCoordinatorTest.java | 0 .../collection/coordinator/RankingCoordinatorTest.java | 0 .../collection/coordinator/RemoteInputCoordinatorTest.kt | 0 .../collection/coordinator/RowAlertTimeCoordinatorTest.kt | 0 .../collection/coordinator/SensitiveContentCoordinatorTest.kt | 0 .../collection/coordinator/SmartspaceDedupingCoordinatorTest.kt | 0 .../collection/inflation/NotifUiAdjustmentProviderTest.kt | 0 .../notification/collection/listbuilder/SemiStableSortTest.kt | 0 .../collection/listbuilder/ShadeListBuilderHelperTest.kt | 0 .../notifcollection/NotifCollectionInconsistencyTrackerTest.kt | 0 .../notifcollection/SelfTrackingLifetimeExtenderTest.kt | 0 .../collection/provider/VisualStabilityProviderTest.kt | 0 .../notification/collection/render/FakeNodeController.kt | 0 .../notification/collection/render/NodeSpecBuilderTest.kt | 0 .../notification/collection/render/RenderStageManagerTest.kt | 0 .../notification/collection/render/ShadeViewDifferTest.kt | 0 .../domain/interactor/NotificationAlertsInteractorTest.kt | 0 .../interactor/NotificationLaunchAnimationInteractorTest.kt | 0 .../domain/interactor/NotificationsKeyguardInteractorTest.kt | 0 .../domain/interactor/RenderNotificationsListInteractorTest.kt | 0 .../icon/domain/interactor/NotificationIconsInteractorTest.kt | 0 .../NotificationIconContainerAlwaysOnDisplayViewModelTest.kt | 0 .../notification/interruption/HeadsUpViewBinderTest.java | 0 .../interruption/KeyguardNotificationVisibilityProviderTest.java | 0 .../interruption/VisualInterruptionDecisionProviderTestBase.kt | 0 .../interruption/VisualInterruptionDecisionProviderTestUtil.kt | 0 .../statusbar/notification/logging/ExpansionStateLoggerTest.java | 0 .../notification/logging/NotificationPanelLoggerFake.java | 0 .../statusbar/notification/row/ActivatableNotificationViewTest.kt | 0 .../notification/row/ExpandableNotificationRowControllerTest.kt | 0 .../systemui/statusbar/notification/row/FeedbackInfoTest.java | 0 .../statusbar/notification/row/HeadsUpStyleProviderImplTest.kt | 0 .../statusbar/notification/row/NotifBindPipelineTest.java | 0 .../statusbar/notification/row/NotifInflationErrorManagerTest.kt | 0 .../statusbar/notification/row/NotifRemoteViewCacheImplTest.java | 0 .../systemui/statusbar/notification/row/NotificationGutsTest.kt | 0 .../systemui/statusbar/notification/row/NotificationInfoTest.java | 0 .../notification/row/NotificationInlineImageResolverTest.java | 0 .../statusbar/notification/row/NotificationMenuRowTest.java | 0 .../statusbar/notification/row/NotificationSnoozeTest.java | 0 .../statusbar/notification/row/PartialConversationInfoTest.java | 0 .../statusbar/notification/row/RowContentBindStageTest.java | 0 .../row/ui/viewmodel/ActivatableNotificationViewModelTest.kt | 0 .../row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt | 0 .../statusbar/notification/shared/TestActiveNotificationModel.kt | 0 .../shelf/domain/interactor/NotificationShelfInteractorTest.kt | 0 .../shelf/ui/viewmodel/NotificationShelfViewModelTest.kt | 0 .../systemui/statusbar/notification/stack/AmbientStateTest.kt | 0 .../stack/DisplaySwitchNotificationsHiderTrackerTest.kt | 0 .../statusbar/notification/stack/MediaContainerViewTest.kt | 0 .../statusbar/notification/stack/NotificationShelfTest.kt | 0 .../notification/stack/NotificationStackSizeCalculatorTest.kt | 0 .../statusbar/notification/stack/NotificationSwipeHelperTest.java | 0 .../statusbar/notification/stack/StackScrollAlgorithmTest.kt | 0 .../statusbar/notification/stack/StackStateAnimatorTest.kt | 0 .../systemui/statusbar/notification/stack/ViewStateTest.kt | 0 .../stack/domain/interactor/HideNotificationsInteractorTest.kt | 0 .../stack/domain/interactor/NotificationStackInteractorTest.kt | 0 .../stack/ui/viewmodel/NotificationLoggerViewModelTest.kt | 0 .../systemui/statusbar/phone/BiometricsUnlockControllerTest.java | 0 .../statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java | 0 .../systemui/statusbar/phone/ConfigurationControllerImplTest.kt | 0 .../com/android/systemui/statusbar/phone/DozeParametersTest.java | 0 .../android/systemui/statusbar/phone/DozeScrimControllerTest.java | 0 .../systemui/statusbar/phone/KeyguardBypassControllerTest.kt | 0 .../android/systemui/statusbar/phone/KeyguardDismissUtilTest.java | 0 .../systemui/statusbar/phone/KeyguardIndicationTextViewTest.java | 0 .../statusbar/phone/KeyguardStatusBarViewControllerTest.java | 0 .../systemui/statusbar/phone/KeyguardStatusBarViewTest.java | 0 .../statusbar/phone/LegacyLightsOutNotifControllerTest.java | 0 .../systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt | 0 .../systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt | 0 .../android/systemui/statusbar/phone/LightBarControllerTest.java | 0 .../statusbar/phone/LightBarTransitionsControllerTest.java | 0 .../systemui/statusbar/phone/ManagedProfileControllerImplTest.kt | 0 .../systemui/statusbar/phone/NotificationGroupTestHelper.java | 0 .../systemui/statusbar/phone/NotificationIconContainerTest.kt | 0 .../systemui/statusbar/phone/NotificationTapHelperTest.java | 0 .../android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt | 0 .../statusbar/phone/StatusBarNotificationPresenterTest.java | 0 .../statusbar/phone/StatusBarRemoteInputCallbackTest.java | 0 .../statusbar/phone/StatusBarTouchableRegionManagerTest.kt | 0 .../systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt | 0 .../systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt | 0 .../statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt | 0 .../statusbar/phone/domain/interactor/LightsOutInteractorTest.kt | 0 .../phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt | 0 .../statusbar/phone/fragment/StatusBarVisibilityModelTest.kt | 0 .../phone/ongoingcall/OngoingCallControllerViaListenerTest.kt | 0 .../phone/ongoingcall/OngoingCallControllerViaRepoTest.kt | 0 .../ongoingcall/data/repository/OngoingCallRepositoryTest.kt | 0 .../com/android/systemui/statusbar/phone/ui/IconManagerTest.kt | 0 .../statusbar/phone/ui/StatusBarIconControllerImplTest.kt | 0 .../systemui/statusbar/phone/ui/StatusBarIconControllerTest.java | 0 .../systemui/statusbar/phone/ui/StatusBarIconListTest.java | 0 .../airplane/data/repository/AirplaneModeRepositoryImplTest.kt | 0 .../statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt | 0 .../mobile/data/repository/prod/MobileTelephonyHelpers.kt | 0 .../systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt | 0 .../pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt | 0 .../satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt | 0 .../satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt | 0 .../satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt | 0 .../satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt | 0 .../pipeline/shared/data/model/DefaultConnectionModelTest.kt | 0 .../statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt | 0 .../shared/ui/view/SingleBindableStatusBarIconViewTest.kt | 0 .../shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt | 0 .../systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt | 0 .../systemui/statusbar/policy/BlockingQueueIntentReceiver.java | 0 .../systemui/statusbar/policy/BluetoothControllerImplTest.java | 0 .../android/systemui/statusbar/policy/CastControllerImplTest.java | 0 .../src/com/android/systemui/statusbar/policy/ClockTest.kt | 0 .../systemui/statusbar/policy/DevicePostureControllerImplTest.kt | 0 .../statusbar/policy/DeviceProvisionedControllerImplTest.kt | 0 .../systemui/statusbar/policy/ExtensionControllerImplTest.java | 0 .../systemui/statusbar/policy/HotspotControllerImplTest.java | 0 .../statusbar/policy/KeyguardQsUserSwitchControllerTest.kt | 0 .../systemui/statusbar/policy/KeyguardStateControllerTest.java | 0 .../systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt | 0 .../statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt | 0 .../com/android/systemui/statusbar/policy/SafetyControllerTest.kt | 0 .../systemui/statusbar/policy/SmartReplyConstantsTest.java | 0 .../systemui/statusbar/policy/ZenModeControllerImplTest.java | 0 .../statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt | 0 .../statusbar/policy/bluetooth/FakeBluetoothRepository.kt | 0 .../data/repository/DeviceProvisioningRepositoryImplTest.kt | 0 .../statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt | 0 .../statusbar/window/StatusBarWindowStateControllerTest.kt | 0 .../src/com/android/systemui/stylus/FixedCapacityBatteryState.kt | 0 .../systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt | 0 .../systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt | 0 .../systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt | 0 .../android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt | 0 .../android/systemui/surfaceeffects/ripple/RippleShaderTest.kt | 0 .../com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt | 0 .../systemui/surfaceeffects/shaders/SolidColorShaderTest.kt | 0 .../android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt | 0 .../turbulencenoise/TurbulenceNoiseControllerTest.kt | 0 .../surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt | 0 .../surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt | 0 268 files changed, 0 insertions(+), 0 deletions(-) rename packages/SystemUI/{tests => multivalentTests}/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt (100%) rename packages/SystemUI/tests/{utils => }/src/com/android/keyguard/TestScopeProvider.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenrecord/RecordingServiceTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/FakeImageCapture.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/RecyclerViewActivity.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/ScreenshotDataTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/policy/TestUserIds.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/scrim/ScrimViewTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/ConstraintChangeTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/ConstraintChangesTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/PulsingGestureListenerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/ShadeControllerImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/condition/ConditionMonitorTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/condition/ConditionTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/condition/FakeCondition.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/plugins/PluginManagerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/plugins/VersionInfoTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/BlurUtilsTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/DragDownHelperTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt (100%) rename packages/SystemUI/tests/{utils => }/src/com/android/systemui/statusbar/NotificationEntryHelper.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/NotificationListenerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/SmartReplyControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/VibratorHelperTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/commandline/ParametersTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/DozeParametersTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/ClockTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt (100%) rename packages/SystemUI/{multivalentTests => tests}/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt (100%) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt similarity index 100% rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt rename to packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt diff --git a/packages/SystemUI/tests/utils/src/com/android/keyguard/TestScopeProvider.kt b/packages/SystemUI/tests/src/com/android/keyguard/TestScopeProvider.kt similarity index 100% rename from packages/SystemUI/tests/utils/src/com/android/keyguard/TestScopeProvider.kt rename to packages/SystemUI/tests/src/com/android/keyguard/TestScopeProvider.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/RecordingServiceTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/RecordingServiceTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/RecordingServiceTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenrecord/RecordingServiceTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/ActionIntentExecutorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/AnnouncementResolverTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/DraggableConstraintLayoutTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/FakeImageCapture.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/FakeImageCapture.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/FakeImageCapture.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/FakeImageCapture.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/FakeScreenshotPolicy.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/RecyclerViewActivity.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/RecyclerViewActivity.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/RecyclerViewActivity.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/RecyclerViewActivity.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotActionsControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDetectionControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/SmartActionsReceiverTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/TakeScreenshotExecutorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsScreenshotHelperServiceTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsServiceTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/data/model/DisplayContentScenarios.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/data/repository/ProfileTypeRepositoryKosmos.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/message/ProfileMessageControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/NewRootTaskInfo.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/PolicyRequestProcessorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/PrivateProfilePolicyTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/TestUserIds.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/TestUserIds.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/TestUserIds.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/TestUserIds.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/policy/WorkProfilePolicyTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/FakeSessionTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/ScrollCaptureFrameworkSmokeTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/scroll/ScrollViewActivity.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/screenshot/ui/viewmodel/ScreenshotViewModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scrim/ScrimViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/scrim/ScrimViewTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/scrim/ScrimViewTest.java rename to packages/SystemUI/tests/src/com/android/systemui/scrim/ScrimViewTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/settings/brightness/BrightnessControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ConstraintChangeTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/ConstraintChangeTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ConstraintChangeTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/ConstraintChangeTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ConstraintChangesTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/ConstraintChangesTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ConstraintChangesTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/ConstraintChangesTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelUnfoldAnimationControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java rename to packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQuickSettingsContainerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/PulsingGestureListenerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/PulsingGestureListenerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/PulsingGestureListenerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/PulsingGestureListenerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/QsBatteryModeControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java rename to packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeControllerImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/carrier/CellSignalStateTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java rename to packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/data/repository/ShadeRepositoryImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/transition/LinearLargeScreenShadeInterpolator.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shade/transition/ScrimShadeTransitionControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shared/animation/DisableSubpixelTextTransitionListenerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shared/animation/UnfoldConstantTranslateAnimatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shared/animation/UnfoldMoveFromCenterAnimatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shared/clocks/ClockRegistryTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java rename to packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionTest.java rename to packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/FakeCondition.java b/packages/SystemUI/tests/src/com/android/systemui/shared/condition/FakeCondition.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/FakeCondition.java rename to packages/SystemUI/tests/src/com/android/systemui/shared/condition/FakeCondition.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/plugins/PluginManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginManagerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/plugins/PluginManagerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginManagerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/plugins/VersionInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/VersionInfoTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/plugins/VersionInfoTest.java rename to packages/SystemUI/tests/src/com/android/systemui/shared/plugins/VersionInfoTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shared/regionsampling/RegionSamplerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/shared/rotation/RotationButtonControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/BlurUtilsTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/BlurUtilsTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/BlurUtilsTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/BlurUtilsTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/DragDownHelperTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/DragDownHelperTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/DragDownHelperTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/DragDownHelperTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/LSShadeTransitionLoggerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeQsTransitionControllerTest.kt diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/NotificationEntryHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryHelper.java similarity index 100% rename from packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/NotificationEntryHelper.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryHelper.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationListenerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationListenerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/PulseExpansionHandlerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/RemoteInputNotificationRebuilderTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/SingleShadeLockScreenOverScrollerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateEventTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/VibratorHelperTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/VibratorHelperTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/VibratorHelperTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/VibratorHelperTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/view/ChipBackgroundContainerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/chips/ui/view/ChipChronometerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ParametersTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ParametersTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ParametersTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ParametersTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ParseableCommandTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/commandline/ValueParserTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/MobileIconCarrierIdOverridesFake.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/NetworkTypeResIdCacheTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/data/repository/KeyguardStatusBarRepositoryImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepositoryImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/DisableFlagsLoggerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/DisableStateTrackerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/events/FakeStatusEvent.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NoManSimulator.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifLiveDataStoreMocks.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifPipelineChoreographerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DismissibilityCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DreamCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupCountCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GroupWhenCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HideNotifsForOtherUsersCoordinatorTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/MediaCoordinatorTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/NotificationStatsLoggerCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinatorTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAlertTimeCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/inflation/NotifUiAdjustmentProviderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/listbuilder/SemiStableSortTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderHelperTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionInconsistencyTrackerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProviderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/FakeNodeController.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/RenderStageManagerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/ShadeViewDifferTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationAlertsInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationLaunchAnimationInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsKeyguardInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestUtil.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLoggerFake.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/HeadsUpStyleProviderImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifBindPipelineTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifInflationErrorManagerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewCacheImplTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationSnoozeTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/ActivatableNotificationViewModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/NotificationViewFlipperViewModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shared/TestActiveNotificationModel.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shelf/domain/interactor/NotificationShelfInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/shelf/ui/viewmodel/NotificationShelfViewModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/MediaContainerViewTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationShelfTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ViewStateTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/HideNotificationsInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLoggerViewModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardDismissUtilTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextViewTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LegacyLightsOutNotifControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProviderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ManagedProfileControllerImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconContainerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManagerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusOverlayHoverListenerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/domain/interactor/LightsOutInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentLoggerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/StatusBarVisibilityModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaListenerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerViaRepoTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/data/repository/OngoingCallRepositoryTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/IconManagerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ui/StatusBarIconListTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepositoryImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/ethernet/domain/EthernetInteractorTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileTelephonyHelpers.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModelParameterizedTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/demo/DemoDeviceBasedSatelliteRepositoryTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/FakeDeviceBasedSatelliteRepository.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/FakeDeviceBasedSatelliteViewModel.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/data/model/DefaultConnectionModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/ModernStatusBarViewTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/view/SingleBindableStatusBarIconViewTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseUserSwitcherAdapterTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BlockingQueueIntentReceiver.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ClockTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ClockTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ClockTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ClockTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DevicePostureControllerImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherAdapterTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SafetyControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt b/packages/SystemUI/tests/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt rename to packages/SystemUI/tests/src/com/android/systemui/stylus/FixedCapacityBatteryState.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/glowboxeffect/GlowBoxEffectTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/loadingeffect/LoadingEffectTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/MultiRippleControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleShaderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/ripple/RippleViewTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/shaders/SolidColorShaderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/shaders/SparkleShaderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseControllerTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseShaderTest.kt diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt similarity index 100% rename from packages/SystemUI/multivalentTests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt rename to packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/turbulencenoise/TurbulenceNoiseViewTest.kt -- GitLab From d8a68830d0eb3e1a47604b01c7cb649ad6cd3392 Mon Sep 17 00:00:00 2001 From: Michael Mikhail Date: Tue, 10 Sep 2024 20:25:17 +0000 Subject: [PATCH 223/492] Add logs and set visibility to gone on animation end This CL adds logs and sets visibility of the ripple view to gone when animation ends. Flag: EXEMPT bugfix Bug: 363403530 Test: build and checked UI, no crashes. Change-Id: I869b19442c1f1e7562fa3f19b9fd297df3982287 --- .../receiver/MediaTttReceiverLogger.kt | 10 +++++ .../MediaTttReceiverRippleController.kt | 5 ++- .../receiver/ReceiverChipRippleView.kt | 45 ++++++++++++------- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverLogger.kt b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverLogger.kt index 1502df725a9c..078d534833d1 100644 --- a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverLogger.kt @@ -19,6 +19,7 @@ package com.android.systemui.media.taptotransfer.receiver import android.app.StatusBarManager import com.android.systemui.dagger.SysUISingleton import com.android.systemui.log.LogBuffer +import com.android.systemui.log.core.LogLevel import com.android.systemui.media.taptotransfer.common.MediaTttLoggerUtils import com.android.systemui.temporarydisplay.TemporaryViewLogger import javax.inject.Inject @@ -50,6 +51,15 @@ constructor( MediaTttLoggerUtils.logPackageNotFound(buffer, TAG, packageName) } + fun logRippleAnimationEnd(id: Int) { + buffer.log( + tag, + LogLevel.DEBUG, + { int1 = id }, + { "ripple animation for view with id: $int1 is ended" } + ) + } + companion object { private const val TAG = "MediaTttReceiver" } diff --git a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverRippleController.kt b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverRippleController.kt index fbd7fd3fe821..a232971c4e3f 100644 --- a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverRippleController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverRippleController.kt @@ -32,6 +32,7 @@ class MediaTttReceiverRippleController constructor( private val context: Context, private val windowManager: WindowManager, + private val mediaTttReceiverLogger: MediaTttReceiverLogger, ) { private var maxRippleWidth: Float = 0f @@ -90,12 +91,12 @@ constructor( /** Expands the ripple to cover the screen. */ fun expandToSuccessState(rippleView: ReceiverChipRippleView, onAnimationEnd: Runnable?) { layoutRipple(rippleView, isFullScreen = true) - rippleView.expandToFull(maxRippleHeight, onAnimationEnd) + rippleView.expandToFull(maxRippleHeight, mediaTttReceiverLogger, onAnimationEnd) } /** Collapses the ripple. */ fun collapseRipple(rippleView: ReceiverChipRippleView, onAnimationEnd: Runnable? = null) { - rippleView.collapseRipple(onAnimationEnd) + rippleView.collapseRipple(mediaTttReceiverLogger, onAnimationEnd) } private fun layoutRipple(rippleView: ReceiverChipRippleView, isFullScreen: Boolean = false) { diff --git a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt index 35018f190394..81059e31f3c1 100644 --- a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt +++ b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt @@ -24,9 +24,7 @@ import com.android.systemui.surfaceeffects.ripple.RippleShader import com.android.systemui.surfaceeffects.ripple.RippleView import kotlin.math.pow -/** - * An expanding ripple effect for the media tap-to-transfer receiver chip. - */ +/** An expanding ripple effect for the media tap-to-transfer receiver chip. */ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleView(context, attrs) { // Indicates whether the ripple started expanding. @@ -46,24 +44,34 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } /** Used to animate out the ripple. No-op if the ripple was never started via [startRipple]. */ - fun collapseRipple(onAnimationEnd: Runnable? = null) { + fun collapseRipple(logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null) { if (!isStarted) { return // Ignore if ripple is not started yet. } duration = DEFAULT_DURATION // Reset all listeners to animator. animator.removeAllListeners() - animator.addListener(object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator) { - onAnimationEnd?.run() - isStarted = false + animator.addListener( + object : AnimatorListenerAdapter() { + override fun onAnimationEnd(animation: Animator) { + animation?.let { + visibility = GONE + logger.logRippleAnimationEnd(id) + } + onAnimationEnd?.run() + isStarted = false + } } - }) + ) animator.reverse() } // Expands the ripple to cover full screen. - fun expandToFull(newHeight: Float, onAnimationEnd: Runnable? = null) { + fun expandToFull( + newHeight: Float, + logger: MediaTttReceiverLogger, + onAnimationEnd: Runnable? = null + ) { if (!isStarted) { return } @@ -85,13 +93,18 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi rippleShader.time = now.toFloat() invalidate() } - animator.addListener(object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator) { - animation?.let { visibility = GONE } - onAnimationEnd?.run() - isStarted = false + animator.addListener( + object : AnimatorListenerAdapter() { + override fun onAnimationEnd(animation: Animator) { + animation?.let { + visibility = GONE + logger.logRippleAnimationEnd(id) + } + onAnimationEnd?.run() + isStarted = false + } } - }) + ) animator.start() } -- GitLab From 6d11f4d16dc97d4bf70bf4d99242ca54b55a06bc Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Fri, 6 Sep 2024 13:18:04 -0700 Subject: [PATCH 224/492] Report double-quoted string literals in SQL statements This defines a system property `debug.sqlite.no_double_quoted_strs` that controls if double-quoted string literals are accepted in SQL statements. Set the property to 1 to treat double-quoted string literals as an error. Exceptions will be thrown. Set the property to 0 to accept double-quoted strings in compatibility mode. The default value is 0, which is the legacy Android behavior. See the following link for a discussion of the issue: https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted A developer can set the property to determine if an application has syntax errors. This does not change the default behavior of an Android system. This change does not fix the bug. It only provides debugging to help address the bug. Tested by setting the property to true and verifying that exceptions are thrown with the error "no such column". The tests below are run with the property not set (the default condition). Flag: EXEMPT bug-fix Bug: 364625688 Test: atest * FrameworksCoreTests:android.database * CtsDatabaseTestCases Change-Id: Ie4c4337995f85caa9432645b75b3cd13db873e1b --- .../database/sqlite/SQLiteDatabase.java | 38 +++++++++++-- .../android/database/sqlite/SQLiteDebug.java | 10 +++- .../jni/android_database_SQLiteConnection.cpp | 15 ++++++ .../database/sqlite/SQLiteDatabaseTest.java | 54 +++++++++++++++++++ 4 files changed, 111 insertions(+), 6 deletions(-) diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index f54be00c9e69..60fd0ce59209 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -236,15 +236,21 @@ public final class SQLiteDatabase extends SQLiteClosable { * * {@more} Note that the value of this flag is 0, so it is the default. */ - public static final int OPEN_READWRITE = 0x00000000; // update native code if changing + // LINT.IfChange + public static final int OPEN_READWRITE = 0x00000000; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) /** * Open flag: Flag for {@link #openDatabase} to open the database for reading only. * This is the only reliable way to open a database if the disk may be full. */ - public static final int OPEN_READONLY = 0x00000001; // update native code if changing + // LINT.IfChange + public static final int OPEN_READONLY = 0x00000001; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) - private static final int OPEN_READ_MASK = 0x00000001; // update native code if changing + // LINT.IfChange + private static final int OPEN_READ_MASK = 0x00000001; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) /** * Open flag: Flag for {@link #openDatabase} to open the database without support for @@ -254,13 +260,31 @@ public final class SQLiteDatabase extends SQLiteClosable { * You must be consistent when using this flag to use the setting the database was * created with. If this is set, {@link #setLocale} will do nothing. */ - public static final int NO_LOCALIZED_COLLATORS = 0x00000010; // update native code if changing + // LINT.IfChange + public static final int NO_LOCALIZED_COLLATORS = 0x00000010; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) + + /** + * Open flag: Flag for {@link #openDatabase} to open a database, disallowing double-quoted + * strings. + * + * This causes sqlite to reject SQL statements with double-quoted string literals. String + * literals must be enclosed in single quotes; double-quotes are reserved for identifiers like + * column names. + * See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted + * @hide + */ + // LINT.IfChange + public static final int NO_DOUBLE_QUOTED_STRS = 0x00000020; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) /** * Open flag: Flag for {@link #openDatabase} to create the database file if it does not * already exist. */ - public static final int CREATE_IF_NECESSARY = 0x10000000; // update native code if changing + // LINT.IfChange + public static final int CREATE_IF_NECESSARY = 0x10000000; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) /** * Open flag: Flag for {@link #openDatabase} to open the database file with @@ -490,6 +514,9 @@ public final class SQLiteDatabase extends SQLiteClosable { if (SQLiteCompatibilityWalFlags.isLegacyCompatibilityWalEnabled()) { mConfigurationLocked.openFlags |= ENABLE_LEGACY_COMPATIBILITY_WAL; } + if (SQLiteDebug.NoPreloadHolder.NO_DOUBLE_QUOTED_STRS) { + mConfigurationLocked.openFlags |= NO_DOUBLE_QUOTED_STRS; + } mConfigurationLocked.journalMode = journalMode; mConfigurationLocked.syncMode = syncMode; } @@ -3275,6 +3302,7 @@ public final class SQLiteDatabase extends SQLiteClosable { OPEN_READONLY, CREATE_IF_NECESSARY, NO_LOCALIZED_COLLATORS, + NO_DOUBLE_QUOTED_STRS, ENABLE_WRITE_AHEAD_LOGGING }) @Retention(RetentionPolicy.SOURCE) diff --git a/core/java/android/database/sqlite/SQLiteDebug.java b/core/java/android/database/sqlite/SQLiteDebug.java index 93d74b1fbdff..b648e053eea0 100644 --- a/core/java/android/database/sqlite/SQLiteDebug.java +++ b/core/java/android/database/sqlite/SQLiteDebug.java @@ -66,7 +66,6 @@ public final class SQLiteDebug { public static final boolean DEBUG_SQL_TIME = Log.isLoggable("SQLiteTime", Log.VERBOSE); - /** * True to enable database performance testing instrumentation. */ @@ -83,6 +82,15 @@ public final class SQLiteDebug { */ public static final boolean DEBUG_LOG_DETAILED = Build.IS_DEBUGGABLE && SystemProperties.getBoolean("db.log.detailed", false); + + /** + * Whether to accept double-quoted strings in SQL statements. Double-quoted strings are a + * syntax error but are accepted by sqlite in compatibility mode (the default). If the + * property is set to true, double-quoted strings will be treated by sqlite as a syntax + * error. + */ + public static final boolean NO_DOUBLE_QUOTED_STRS = + SystemProperties.getBoolean("debug.sqlite.no_double_quoted_strs", false); } private SQLiteDebug() { diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp index 7410468199b8..3370f386f4d2 100644 --- a/core/jni/android_database_SQLiteConnection.cpp +++ b/core/jni/android_database_SQLiteConnection.cpp @@ -70,11 +70,14 @@ struct SQLiteConnection { // Open flags. // Must be kept in sync with the constants defined in SQLiteDatabase.java. enum { + // LINT.IfChange OPEN_READWRITE = 0x00000000, OPEN_READONLY = 0x00000001, OPEN_READ_MASK = 0x00000001, NO_LOCALIZED_COLLATORS = 0x00000010, + NO_DOUBLE_QUOTED_STRS = 0x00000020, CREATE_IF_NECESSARY = 0x10000000, + // LINT.ThenChange(/core/java/android/database/sqlite/SQLiteDatabase.java) }; sqlite3* const db; @@ -156,6 +159,18 @@ static jlong nativeOpen(JNIEnv* env, jclass clazz, jstring pathStr, jint openFla } } + // Disallow double-quoted string literals if the proper flag is set. + if ((openFlags & SQLiteConnection::NO_DOUBLE_QUOTED_STRS) != 0) { + void *setting = 0; + int err = 0; + if ((err = sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DDL, 0, setting)) != SQLITE_OK) { + ALOGE("failed to configure SQLITE_DBCONFIG_DQS_DDL: %d", err); + } + if ((err = sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DML, 0, setting)) != SQLITE_OK) { + ALOGE("failed to configure SQLITE_DBCONFIG_DQS_DML: %d", err); + } + } + // Check that the database is really read/write when that is what we asked for. if ((sqliteFlags & SQLITE_OPEN_READWRITE) && sqlite3_db_readonly(db, NULL)) { throw_sqlite3_exception(env, db, "Could not open the database in read/write mode."); diff --git a/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java b/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java index 519f23b0deb6..00978a099f13 100644 --- a/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java +++ b/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java @@ -538,4 +538,58 @@ public class SQLiteDatabaseTest { assertEquals(1, db.mConnection.size()); } + + // Create and open the database, allowing or disallowing double-quoted strings. + private void createDatabase(boolean noDoubleQuotedStrs) throws Exception { + // The open-flags that do not change in this test. + int flags = SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.OPEN_READWRITE; + + // The flag to be tested. + int flagUnderTest = SQLiteDatabase.NO_DOUBLE_QUOTED_STRS; + + if (noDoubleQuotedStrs) { + flags |= flagUnderTest; + } else { + flags &= ~flagUnderTest; + } + mDatabase = SQLiteDatabase.openDatabase(mDatabaseFile.getPath(), null, flags, null); + } + + /** + * This test verifies that the NO_DOUBLE_QUOTED_STRS flag works as expected when opening a + * database. This does not test that the flag is initialized as expected from the system + * properties. + */ + @Test + public void testNoDoubleQuotedStrings() throws Exception { + closeAndDeleteDatabase(); + createDatabase(/* noDoubleQuotedStrs */ false); + + mDatabase.beginTransaction(); + try { + mDatabase.execSQL("CREATE TABLE t1 (t text);"); + // Insert a value in double-quotes. This is invalid but accepted. + mDatabase.execSQL("INSERT INTO t1 (t) VALUES (\"foo\")"); + } finally { + mDatabase.endTransaction(); + } + + closeAndDeleteDatabase(); + createDatabase(/* noDoubleQuotedStrs */ true); + + mDatabase.beginTransaction(); + try { + mDatabase.execSQL("CREATE TABLE t1 (t text);"); + try { + // Insert a value in double-quotes. This is invalid and must throw. + mDatabase.execSQL("INSERT INTO t1 (t) VALUES (\"foo\")"); + fail("expected an exception"); + } catch (SQLiteException e) { + assertTrue(e.toString().contains("no such column")); + } + } finally { + mDatabase.endTransaction(); + } + closeAndDeleteDatabase(); + } } -- GitLab From 14406149022cde05386523402c4edbc15ee00902 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Tue, 10 Sep 2024 20:39:39 +0000 Subject: [PATCH 225/492] Remove PointerIcon frame size checks for animated drawables PointerIcons are already only loaded from system server's UiThread. However, there are still some cases where system resources, such as display density, change asynchronously from different threads. It is difficult to synchronize resource updates and resource loading. After the introduction of Vector icons, the frame size of PointerIcons will depend on the display density, so we must assume that the density can change while loading icons. We should no longer enforce that all frames of an animated icon are the same size. The rest of the pipeline makes no assertions that all animation frames are the same size. Bug: 362296003 Bug: 362462770 Change-Id: If04ff8224e64c7efa57d10a5f149d52a7569ef9a Test: Presubmit Flag: EXEMPT bug fix --- core/java/android/view/PointerIcon.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/java/android/view/PointerIcon.java b/core/java/android/view/PointerIcon.java index 815fd1c49a38..dd950e83dd52 100644 --- a/core/java/android/view/PointerIcon.java +++ b/core/java/android/view/PointerIcon.java @@ -540,8 +540,6 @@ public final class PointerIcon implements Parcelable { // Assumes they have the exact duration. mDurationPerFrame = animationDrawable.getDuration(0); mBitmapFrames = new Bitmap[frames - 1]; - final int width = drawable.getIntrinsicWidth(); - final int height = drawable.getIntrinsicHeight(); final boolean isVectorAnimation = drawable instanceof VectorDrawable; mDrawNativeDropShadow = isVectorAnimation; for (int i = 1; i < frames; ++i) { @@ -556,9 +554,6 @@ public final class PointerIcon implements Parcelable { + "is a different type from the others. All frames should be the " + "same type."); } - // TODO(b/361232935): Check when bitmap size of the ith frame is different - // drawableFrame.getIntrinsicWidth() != width || - // drawableFrame.getIntrinsicHeight() != height if (isVectorAnimation) { drawableFrame = getBitmapDrawableFromVectorDrawable(resources, (VectorDrawable) drawableFrame, pointerScale); -- GitLab From cb8c7f5d38fe2812bb601c6e397c50d75bfac52c Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 10 Sep 2024 14:00:52 -0700 Subject: [PATCH 226/492] Clear the swipe PiP on legacy enter path We hit the case that auto-enter-pip is trigged in Launcher and no actual PiP transition is made. Which leads to a broken internal state and blocks exit PiP if a legacy-enter-pip is made after. Fixing this by clear the state on the legacy enter path. Flag: EXEMPT bugfix Bug: 365300020 Test: N/A added as a fail safe based on analyze Change-Id: I004f0654f0287f006422d43ebd44d92ec009c1fc --- .../Shell/src/com/android/wm/shell/pip/PipTransition.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java index 05d19846bfee..2138acc51eb2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java @@ -1102,6 +1102,8 @@ public class PipTransition extends PipTransitionController { return; } + // NOTE(b/365300020): Legacy enter PiP path, clear the swipe state. + mPipTransitionState.setInSwipePipToHomeTransition(false); final int enterAnimationType = mEnterAnimationType; if (enterAnimationType == ANIM_TYPE_ALPHA) { startTransaction.setAlpha(leash, 0f); -- GitLab From f8def36ad49bdf4b0d0c8c5f3c1c416bb08db8e7 Mon Sep 17 00:00:00 2001 From: Yuri Lin Date: Tue, 10 Sep 2024 17:10:35 -0400 Subject: [PATCH 227/492] Set scrollbars to none on EnableZenModeDialog description text. This is the text that says "Until 5:07PM" (for example) to demonstrate how long one would be turning DND on. For some reason, it was showing a scrollbar on the dialog that opens from Settings (but not Quick Settings). Bug: 349845540 Test: manual Flag: EXEMPT unflaggable Change-Id: I57cbd00a96818b1f7bc1a36660200fac1839335c --- packages/SettingsLib/res/layout/zen_mode_condition.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/SettingsLib/res/layout/zen_mode_condition.xml b/packages/SettingsLib/res/layout/zen_mode_condition.xml index 32221744e26f..805c81ff35dd 100644 --- a/packages/SettingsLib/res/layout/zen_mode_condition.xml +++ b/packages/SettingsLib/res/layout/zen_mode_condition.xml @@ -52,6 +52,7 @@ android:ellipsize="end" android:textAlignment="viewStart" android:maxLines="1" + android:scrollbars="none" android:textColor="?android:attr/textColorSecondary" android:textSize="14sp"/> -- GitLab From 5173ce85236334e0d9ac67e8a1a05eb797c3cd37 Mon Sep 17 00:00:00 2001 From: Alex Stetson Date: Tue, 10 Sep 2024 21:21:28 +0000 Subject: [PATCH 228/492] Ensure DisplayTracker callback is not GC Bug: 362696244 Test: build Flag: NONE bugfix (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6b2f4337738e669837a27213859c71eff2366cc0) Merged-In: I124563b1a4d8a147d0e4570650e88c5aa2c2c8aa Change-Id: I124563b1a4d8a147d0e4570650e88c5aa2c2c8aa --- .../systemui/statusbar/CommandQueue.java | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index c9126161c40f..fa3b09234589 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -62,6 +62,7 @@ import android.view.accessibility.Flags; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; +import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.os.SomeArgs; import com.android.internal.statusbar.IAddTileResultCallback; import com.android.internal.statusbar.IStatusBar; @@ -191,10 +192,10 @@ public class CommandQueue extends IStatusBar.Stub implements private static final String SHOW_IME_SWITCHER_KEY = "showImeSwitcherKey"; private final Object mLock = new Object(); - private ArrayList mCallbacks = new ArrayList<>(); - private Handler mHandler = new H(Looper.getMainLooper()); + private final ArrayList mCallbacks = new ArrayList<>(); + private final Handler mHandler = new H(Looper.getMainLooper()); /** A map of display id - disable flag pair */ - private SparseArray> mDisplayDisabled = new SparseArray<>(); + private final SparseArray> mDisplayDisabled = new SparseArray<>(); /** * The last ID of the display where IME window for which we received setImeWindowStatus * event. @@ -205,6 +206,21 @@ public class CommandQueue extends IStatusBar.Stub implements private final @Nullable DumpHandler mDumpHandler; private final @Nullable Lazy mPowerInteractor; + @KeepForWeakReference + private final DisplayTracker.Callback mDisplayTrackerCallback = new DisplayTracker.Callback() { + @Override + public void onDisplayRemoved(int displayId) { + synchronized (mLock) { + mDisplayDisabled.remove(displayId); + } + // This callback is registered with {@link #mHandler} that already posts to run on + // main thread, so it is safe to dispatch directly. + for (int i = mCallbacks.size() - 1; i >= 0; i--) { + mCallbacks.get(i).onDisplayRemoved(displayId); + } + } + }; + /** * These methods are called back on the main thread. */ @@ -574,19 +590,8 @@ public class CommandQueue extends IStatusBar.Stub implements mDisplayTracker = displayTracker; mRegistry = registry; mDumpHandler = dumpHandler; - mDisplayTracker.addDisplayChangeCallback(new DisplayTracker.Callback() { - @Override - public void onDisplayRemoved(int displayId) { - synchronized (mLock) { - mDisplayDisabled.remove(displayId); - } - // This callback is registered with {@link #mHandler} that already posts to run on - // main thread, so it is safe to dispatch directly. - for (int i = mCallbacks.size() - 1; i >= 0; i--) { - mCallbacks.get(i).onDisplayRemoved(displayId); - } - } - }, new HandlerExecutor(mHandler)); + mDisplayTracker.addDisplayChangeCallback(mDisplayTrackerCallback, + new HandlerExecutor(mHandler)); // We always have default display. setDisabled(mDisplayTracker.getDefaultDisplayId(), DISABLE_NONE, DISABLE2_NONE); mPowerInteractor = powerInteractor; -- GitLab From 5d95931b9672e43173722ce2a7b98b126c566c9b Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 10 Sep 2024 15:04:53 -0700 Subject: [PATCH 229/492] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: Ic9015f47aa7e438afebd52cff96469554fd7c329 --- core/res/res/values-am/strings.xml | 3 +-- core/res/res/values-as/strings.xml | 5 ++--- core/res/res/values-b+sr+Latn/strings.xml | 3 +-- core/res/res/values-be/strings.xml | 3 +-- core/res/res/values-cs/strings.xml | 3 +-- core/res/res/values-en-rCA/strings.xml | 3 +-- core/res/res/values-en-rXC/strings.xml | 3 +-- core/res/res/values-es/strings.xml | 5 ++--- core/res/res/values-fa/strings.xml | 3 +-- core/res/res/values-gu/strings.xml | 3 +-- core/res/res/values-hi/strings.xml | 3 +-- core/res/res/values-is/strings.xml | 3 +-- core/res/res/values-ja/strings.xml | 7 +++---- core/res/res/values-ka/strings.xml | 3 +-- core/res/res/values-km/strings.xml | 3 +-- core/res/res/values-kn/strings.xml | 3 +-- core/res/res/values-ky/strings.xml | 3 +-- core/res/res/values-lo/strings.xml | 3 +-- core/res/res/values-ml/strings.xml | 3 +-- core/res/res/values-mr/strings.xml | 3 +-- core/res/res/values-ms/strings.xml | 3 +-- core/res/res/values-my/strings.xml | 3 +-- core/res/res/values-ne/strings.xml | 3 +-- core/res/res/values-nl/strings.xml | 5 ++--- core/res/res/values-pt-rPT/strings.xml | 3 +-- core/res/res/values-ru/strings.xml | 3 +-- core/res/res/values-sk/strings.xml | 3 +-- core/res/res/values-sl/strings.xml | 3 +-- core/res/res/values-sr/strings.xml | 3 +-- core/res/res/values-ta/strings.xml | 3 +-- core/res/res/values-te/strings.xml | 3 +-- core/res/res/values-th/strings.xml | 3 +-- core/res/res/values-tl/strings.xml | 3 +-- core/res/res/values-ur/strings.xml | 3 +-- 34 files changed, 39 insertions(+), 73 deletions(-) diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml index 2873785e9387..a7b6661a42e5 100644 --- a/core/res/res/values-am/strings.xml +++ b/core/res/res/values-am/strings.xml @@ -1746,8 +1746,7 @@ "አንድ መተግበሪያ የፍቃድ ጥያቄውን እያደበዘዘ ነው ስለዚህ የእርስዎ ምላሽ ሊረጋገጥ አይችልም።" "አንድ ባህሪን መጠቀም ለመጀመር መታ ያድርጉት፦" "በተደራሽነት አዝራር የሚጠቀሙባቸው ባሕሪያት ይምረጡ" - - + "በድምፅ ቁልፍ አቋራጭ የሚጠቀሙባቸው ባህሪያት ይምረጡ" "%s ጠፍቷል" "አቋራጮችን አርትዕ ያድርጉ" "ተከናውኗል" diff --git a/core/res/res/values-as/strings.xml b/core/res/res/values-as/strings.xml index bc1dba27ff5f..c5ad8bab39d0 100644 --- a/core/res/res/values-as/strings.xml +++ b/core/res/res/values-as/strings.xml @@ -1356,7 +1356,7 @@ "ভিপিএন" "অজ্ঞাত প্ৰকাৰৰ নেটৱৰ্ক" - "স্বীকাৰ কৰক" + "গ্ৰহণ কৰক" "প্ৰত্যাখ্যান কৰক" "বর্ণ লিখক" "এছএমএছ বার্তাবোৰ পঠিয়াই থকা হৈছে" @@ -1746,8 +1746,7 @@ "এটা এপে অনুমতিৰ অনুৰোধটো অস্পষ্ট কৰি আছে আৰু সেয়েহে আপোনাৰ সঁহাৰিটো সত্যাপন কৰিব নোৱাৰি।" "কোনো এটা সুবিধা ব্যৱহাৰ কৰিবলৈ সেইটোত টিপক:" "সাধ্য-সুবিধা বুটামটোৰ জৰিয়তে ব্যৱহাৰ কৰিবলৈ সুবিধাসমূহ বাছনি কৰক" - - + "ভলিউম কীৰ শ্বৰ্টকাটটোৰ জৰিয়তে ব্যৱহাৰ কৰিবলৈ সুবিধাসমূহ বাছনি কৰক" "%s বন্ধ কৰা হৈছে" "শ্বৰ্টকাটসমূহ সম্পাদনা কৰক" "কৰা হ’ল" diff --git a/core/res/res/values-b+sr+Latn/strings.xml b/core/res/res/values-b+sr+Latn/strings.xml index b83eca56023f..8f0f4b2259c8 100644 --- a/core/res/res/values-b+sr+Latn/strings.xml +++ b/core/res/res/values-b+sr+Latn/strings.xml @@ -1747,8 +1747,7 @@ "Aplikacija krije zahtev za dozvolu, pa odgovor ne može da se verifikuje." "Dodirnite neku funkciju da biste počeli da je koristite:" "Odaberite funkcije koje ćete koristiti sa dugmetom Pristupačnost" - - + "Odaberite funkcije koje će se koristiti sa prečicom za tastere za jačinu zvuka" "Usluga %s je isključena" "Izmenite prečice" "Gotovo" diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml index 596457066268..7a49bf348acf 100644 --- a/core/res/res/values-be/strings.xml +++ b/core/res/res/values-be/strings.xml @@ -1748,8 +1748,7 @@ "Праграма хавае запыт дазволу, таму ваш адказ немагчыма спраўдзіць." "Каб пачаць выкарыстоўваць функцыю, націсніце на яе:" "Выберыце функцыі, якія будзеце выкарыстоўваць з кнопкай спецыяльных магчымасцей" - - + "Выберыце функцыі для выкарыстання з клавішамі гучнасці" "Сэрвіс \"%s\" выключаны" "Змяніць ярлыкі" "Гатова" diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml index b9ceede3c8be..69e6483a03f4 100644 --- a/core/res/res/values-cs/strings.xml +++ b/core/res/res/values-cs/strings.xml @@ -1748,8 +1748,7 @@ "Žádost o oprávnění skrývá nějaká aplikace, proto vaši odpověď nelze ověřit." "Chcete-li některou funkci začít používat, klepněte na ni:" "Vyberte funkce, které budete používat s tlačítkem přístupnosti" - - + "Vyberte funkce, které budete používat se zkratkou tlačítek hlasitosti" "Služba %s byla vypnuta" "Upravit zkratky" "Hotovo" diff --git a/core/res/res/values-en-rCA/strings.xml b/core/res/res/values-en-rCA/strings.xml index 19547f81d636..dad63334dc6c 100644 --- a/core/res/res/values-en-rCA/strings.xml +++ b/core/res/res/values-en-rCA/strings.xml @@ -1746,8 +1746,7 @@ "An app is obscuring the permission request so your response cannot be verified." "Tap a feature to start using it:" "Choose features to use with the accessibility button" - - + "Choose features to use with the volume keys shortcut" "%s has been turned off" "Edit shortcuts" "Done" diff --git a/core/res/res/values-en-rXC/strings.xml b/core/res/res/values-en-rXC/strings.xml index c1eade14fbc6..0bcbed786d44 100644 --- a/core/res/res/values-en-rXC/strings.xml +++ b/core/res/res/values-en-rXC/strings.xml @@ -1746,8 +1746,7 @@ "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‎‏‏‏‏‏‎‏‏‏‎‎‎‎‎‏‎‏‎‏‎‏‏‎‏‎‏‏‏‎‏‏‏‎‎‏‎‎‏‏‎‎‎‏‏‎‏‎‎‏‏‏‏‏‏‎‎‏‏‎An app is obscuring the permission request so your response cannot be verified.‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‎‎‏‏‎‏‎‎‏‏‎‏‏‏‏‏‎‏‏‏‏‏‏‏‏‎‏‏‏‎‏‏‏‎‎‎‎‎‏‏‏‏‎‏‎‏‎‎‎‎‎‏‎‎‎‏‏‎‎‎‎Tap a feature to start using it:‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‎‏‏‎‏‎‏‎‎‏‎‏‎‏‎‏‏‏‏‏‎‎‏‎‏‏‏‏‎‎‏‏‏‏‎‎‎‎‎‏‎‏‎‎‎‎‎‎‎‏‎‏‏‏‎‎‏‎‏‎Choose features to use with the accessibility button‎‏‎‎‏‎" - - + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‏‏‏‏‎‎‏‎‏‎‎‏‏‏‎‎‎‎‏‏‎‏‎‎‎‏‏‎‏‏‏‏‏‎‏‎‎‏‎‎‎‏‎‏‏‎‎‎‏‎‏‎‏‏‏‎‏‏‎‎‎Choose features to use with the volume keys shortcut‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‏‏‏‏‎‏‎‏‏‏‏‏‎‏‎‎‎‏‏‏‎‎‎‏‏‏‎‎‏‏‎‎‎‏‎‎‏‎‏‎‏‎‏‎‏‏‏‎‏‏‏‎‎‏‎‎‏‏‏‎‎‏‎‎‏‏‎%s‎‏‎‎‏‏‏‎ has been turned off‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‏‎‏‏‎‏‎‏‎‎‎‎‏‎‎‎‏‎‎‏‎‎‎‎‏‎‎‏‏‎‎‎‎‎‏‎‎‎‏‎‏‏‏‎‎‏‎‏‎‎‎‎‏‎‎‎‎‏‏‏‎Edit shortcuts‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‎‏‎‏‏‏‎‏‎‎‎‏‏‎‎‏‏‎‏‎‏‏‎‎‎‏‏‏‎‎‎‎‎‏‎‏‎‏‎‏‎‎‎‏‎‏‎‎‏‎‎‏‏‎‏‏‏‎‎‎Done‎‏‎‎‏‎" diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml index ff7d912255cb..e50d5faea41b 100644 --- a/core/res/res/values-es/strings.xml +++ b/core/res/res/values-es/strings.xml @@ -1747,8 +1747,7 @@ "Una aplicación está ocultando la solicitud de permiso, por lo que no se puede verificar tu respuesta." "Toca una función para empezar a usarla:" "Selecciona qué funciones usar con el botón de accesibilidad" - - + "Selecciona qué funciones usar con el acceso directo de teclas de volumen" "Se ha desactivado %s" "Editar accesos directos" "Hecho" @@ -1758,7 +1757,7 @@ "Corrección de color" "Modo Una mano" "Atenuación extra" - "Dispositivos auditivos" + "Audífonos" "Al mantener pulsadas las teclas de volumen, se ha activado %1$s." "Se han mantenido pulsadas las teclas de volumen. Se ha desactivado %1$s." "Suelta las teclas de volumen. Para activar %1$s, mantén pulsadas las dos teclas de volumen de nuevo durante 3 segundos." diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml index 5e474cde8a09..0c46ed93a602 100644 --- a/core/res/res/values-fa/strings.xml +++ b/core/res/res/values-fa/strings.xml @@ -1746,8 +1746,7 @@ "پاسخ شما تأیید نشد زیرا یک برنامه درخواست اجازه را مسدود کرده است." "برای استفاده از ویژگی، روی آن تک‌ضرب بزنید:" "انتخاب ویژگی‌های موردنظر برای استفاده با دکمه دسترس‌پذیری" - - + "انتخاب کنید کدام ویژگی‌ها با میان‌بر کلیدهای میزان صدا استفاده شود" "%s خاموش شده است" "ویرایش میان‌برها" "تمام" diff --git a/core/res/res/values-gu/strings.xml b/core/res/res/values-gu/strings.xml index 2810b5e40107..2ac70ab79c3b 100644 --- a/core/res/res/values-gu/strings.xml +++ b/core/res/res/values-gu/strings.xml @@ -1746,8 +1746,7 @@ "કોઈ ઍપ પરવાનગીની વિનંતીને ઢાંકી રહી છે, તેથી તમારા પ્રતિસાદની ચકાસણી કરી શકાતી નથી." "સુવિધાનો ઉપયોગ શરૂ કરવા તેના પર ટૅપ કરો:" "ઍક્સેસિબિલિટી બટન વડે તમે ઉપયોગમાં લેવા માગો છો તે સુવિધાઓ પસંદ કરો" - - + "વૉલ્યૂમ કી શૉર્ટકટ વડે તમે ઉપયોગમાં લેવા માગો છો તે સુવિધાઓ પસંદ કરો" "%s બંધ કરવામાં આવ્યું છે" "શૉર્ટકટમાં ફેરફાર કરો" "થઈ ગયું" diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml index 700e91ad8eb8..5f1bb9a74d27 100644 --- a/core/res/res/values-hi/strings.xml +++ b/core/res/res/values-hi/strings.xml @@ -1746,8 +1746,7 @@ "ऐप्लिकेशन की वजह से, अनुमति का अनुरोध समझने में परेशानी हो रही है. इसलिए, आपके जवाब की पुष्टि नहीं की जा सकी." "किसी सुविधा का इस्तेमाल करने के लिए, उस पर टैप करें:" "सुलभता बटन पर टैप करके, इस्तेमाल करने के लिए सुविधाएं चुनें" - - + "वे सुविधाएं चुनें जिन्हें आवाज़ बटनों के शॉर्टकट के ज़रिए इस्तेमाल करना है" "%s को बंद कर दिया गया है" "शॉर्टकट में बदलाव करें" "हो गया" diff --git a/core/res/res/values-is/strings.xml b/core/res/res/values-is/strings.xml index 3eb2e4bd0a2c..057b830d4fb7 100644 --- a/core/res/res/values-is/strings.xml +++ b/core/res/res/values-is/strings.xml @@ -1746,8 +1746,7 @@ "Forrit er að fela heimildarbeiðnina svo ekki er hægt að staðfesta svarið þitt." "Ýttu á eiginleika til að byrja að nota hann:" "Veldu eiginleika sem á að nota með aðgengishnappinum" - - + "Veldu eiginleika sem á að nota með flýtileið hljóðstyrkstakka" "Slökkt hefur verið á %s" "Breyta flýtileiðum" "Lokið" diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml index bcff8138c103..0705b36d9450 100644 --- a/core/res/res/values-ja/strings.xml +++ b/core/res/res/values-ja/strings.xml @@ -1400,10 +1400,10 @@ "USB テザリング ON" "USB MIDI モード ON" "ウェブカメラとしてデバイスを接続しました" - "USB アクセサリが接続されました" + "USB アクセサリーが接続されました" "タップしてその他のオプションを表示します。" "接続されているデバイスを充電しています。タップすると、他の項目が表示されます。" - "アナログのオーディオ アクセサリを検出" + "アナログのオーディオ アクセサリーを検出" "接続したデバイスはこのスマートフォンと互換性がありません。タップすると、詳細を確認できます。" "USB デバッグが接続されました" "無効にするにはここをタップしてください" @@ -1746,8 +1746,7 @@ "権限のリクエストを遮っているアプリがあるため、同意の回答を確認できません。" "使用を開始する機能をタップ:" "ユーザー補助機能ボタンで使用する機能の選択" - - + "音量ボタンのショートカットで使用する機能の選択" "%s はオフになっています" "ショートカットの編集" "完了" diff --git a/core/res/res/values-ka/strings.xml b/core/res/res/values-ka/strings.xml index 0adebb002c05..bac23337e0d1 100644 --- a/core/res/res/values-ka/strings.xml +++ b/core/res/res/values-ka/strings.xml @@ -1746,8 +1746,7 @@ "აპი მალავს ნებართვის მოთხოვნას, ასე რომ, თქვენი პასუხი ვერ დადასტურდება." "შეეხეთ ფუნქციას მისი გამოყენების დასაწყებად:" "აირჩიეთ ფუნქციები, რომელთა გამოყენებაც გსურთ მარტივი წვდომის ღილაკით" - - + "ხმის კლავიშების მალსახმობების მეშვეობით გამოსაყენებელი ფუნქციების არჩევა" "%s გამორთულია" "მალსახმობების რედაქტირება" "მზადაა" diff --git a/core/res/res/values-km/strings.xml b/core/res/res/values-km/strings.xml index f3dd775defef..1f931c6644e3 100644 --- a/core/res/res/values-km/strings.xml +++ b/core/res/res/values-km/strings.xml @@ -1746,8 +1746,7 @@ "កម្មវិធីមួយកំពុងបិទបាំងសំណើសុំការអនុញ្ញាត ដូច្នេះមិនអាចផ្ទៀងផ្ទាត់ការឆ្លើយតបរបស់អ្នកបានទេ។" "ចុចមុខងារណាមួយ ដើម្បចាប់ផ្ដើមប្រើ៖" "ជ្រើសរើស​មុខងារ ដើម្បីប្រើ​ជាមួយ​ប៊ូតុង​ភាពងាយស្រួល" - - + "ជ្រើសរើស​មុខងារ ដើម្បីប្រើ​ជាមួយផ្លូវកាត់គ្រាប់ចុច​កម្រិតសំឡេង" "បានបិទ %s" "កែ​ផ្លូវកាត់" "រួចរាល់" diff --git a/core/res/res/values-kn/strings.xml b/core/res/res/values-kn/strings.xml index a772e32c1221..941a1b2572ce 100644 --- a/core/res/res/values-kn/strings.xml +++ b/core/res/res/values-kn/strings.xml @@ -1746,8 +1746,7 @@ "ಆ್ಯಪ್‌ವೊಂದು ಅನುಮತಿ ವಿನಂತಿಯನ್ನು ಮರೆಮಾಚುತ್ತಿರುವ ಕಾರಣ ನಿಮ್ಮ ಪ್ರತಿಕ್ರಿಯೆಯನ್ನು ಪರಿಶೀಲಿಸಲು ಸಾಧ್ಯವಿಲ್ಲ." "ವೈಶಿಷ್ಟ್ದ ಬಳಸುವುದನ್ನು ಪ್ರಾರಂಭಿಸಲು ಅದನ್ನು ಟ್ಯಾಪ್ ಮಾಡಿ:" "ಆ್ಯಕ್ಸೆಸಿಬಿಲಿಟಿ ಬಟನ್ ಜೊತೆಗೆ ಬಳಸಲು ವೈಶಿಷ್ಟ್ಯಗಳನ್ನು ಆಯ್ಕೆಮಾಡಿ" - - + "ವಾಲ್ಯೂಮ್ ಕೀ ಶಾರ್ಟ್‌ಕಟ್ ಜೊತೆಗೆ ಬಳಸಲು ಫೀಚರ್‌ಗಳನ್ನು ಆಯ್ಕೆಮಾಡಿ" "%s ಅನ್ನು ಆಫ್ ಮಾಡಲಾಗಿದೆ" "ಶಾರ್ಟ್‌ಕಟ್‌‍ಗಳನ್ನು ಎಡಿಟ್ ಮಾಡಿ" "ಪೂರ್ಣಗೊಂಡಿದೆ" diff --git a/core/res/res/values-ky/strings.xml b/core/res/res/values-ky/strings.xml index 4c2ee5f88d99..43fd6a78cc73 100644 --- a/core/res/res/values-ky/strings.xml +++ b/core/res/res/values-ky/strings.xml @@ -1746,8 +1746,7 @@ "Колдонмо уруксат суроону жашырып койгондуктан, жообуңузду ырастоо мүмкүн эмес." "Функцияны колдонуп баштоо үчүн аны таптап коюңуз:" "Атайын мүмкүнчүлүктөр баскычы менен колдонгуңуз келген функцияларды тандаңыз" - - + "Үн баскычтары менен кайсы функцияларды иштеткиңиз келет?" "%s өчүрүлдү" "Кыска жолдорду түзөтүү" "Бүттү" diff --git a/core/res/res/values-lo/strings.xml b/core/res/res/values-lo/strings.xml index b62750311caa..dc15e9afc0cf 100644 --- a/core/res/res/values-lo/strings.xml +++ b/core/res/res/values-lo/strings.xml @@ -1746,8 +1746,7 @@ "ແອັບໜຶ່ງກຳລັງປິດບັງຄຳຮ້ອງຂໍການອະນຸຍາດ ດັ່ງນັ້ນຈຶ່ງບໍ່ສາມາດຢັ້ງຢືນຄຳຕອບຂອງທ່ານໄດ້." "ແຕະໃສ່ຄຸນສົມບັດໃດໜຶ່ງເພື່ອເລີ່ມການນຳໃຊ້ມັນ:" "ເລືອກຄຸນສົມບັດເພື່ອໃຊ້ກັບປຸ່ມການຊ່ວຍເຂົ້າເຖິງ" - - + "ເລືອກຄຸນສົມບັດທີ່ຈະໃຊ້ກັບທາງລັດຂອງປຸ່ມລະດັບສຽງ" "ປິດ %s ໄວ້ແລ້ວ" "ແກ້ໄຂທາງລັດ" "ແລ້ວໆ" diff --git a/core/res/res/values-ml/strings.xml b/core/res/res/values-ml/strings.xml index 2b1c52ff0825..6d60696f40e9 100644 --- a/core/res/res/values-ml/strings.xml +++ b/core/res/res/values-ml/strings.xml @@ -1746,8 +1746,7 @@ "ഒരു ആപ്പ്, അനുമതി അഭ്യർത്ഥന മറയ്‌ക്കുന്നതിനാൽ നിങ്ങളുടെ പ്രതികരണം പരിശോധിച്ചുറപ്പിക്കാനാകില്ല." "ഉപയോഗിച്ച് തുടങ്ങാൻ ഫീച്ചർ ടാപ്പ് ചെയ്യുക:" "ഉപയോഗസഹായി ബട്ടണിന്റെ സഹായത്തോടെ, ഉപയോഗിക്കാൻ ഫീച്ചറുകൾ തിരഞ്ഞെടുക്കുക" - - + "വോളിയം കീകളുടെ കുറുക്കുവഴികൾക്കൊപ്പം ഉപയോഗിക്കേണ്ട ഫീച്ചറുകൾ തിരഞ്ഞെടുക്കുക" "%s ഓഫാക്കിയിരിക്കുന്നു" "കുറുക്കുവഴികൾ തിരുത്തുക" "പൂർത്തിയാക്കി" diff --git a/core/res/res/values-mr/strings.xml b/core/res/res/values-mr/strings.xml index 67c3b980d700..30403cf0984f 100644 --- a/core/res/res/values-mr/strings.xml +++ b/core/res/res/values-mr/strings.xml @@ -1746,8 +1746,7 @@ "परवानगी मागणारी विनंती अ‍ॅपमुळे अस्पष्‍ट होत असल्‍याने, तुमच्या प्रतिसादाची पडताळणी केली जाऊ शकत नाही." "वैशिष्ट्य वापरणे सुरू करण्यासाठी त्यावर टॅप करा:" "अ‍ॅक्सेसिबिलिटी बटणासोबत वापरायची असलेली ॲप्स निवडा" - - + "व्‍हॉल्‍यूम की शॉर्टकटसोबत वापरायची असलेली ॲप्स निवडा" "%s बंद केले आहे" "शॉर्टकट संपादित करा" "पूर्ण झाले" diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml index 5eac79316474..e17c62bb168e 100644 --- a/core/res/res/values-ms/strings.xml +++ b/core/res/res/values-ms/strings.xml @@ -1746,8 +1746,7 @@ "Apl menghalang permintaan kebenaran, maka jawapan anda tidak dapat disahkan." "Ketik ciri untuk mula menggunakan ciri itu:" "Pilih ciri untuk digunakan dengan butang kebolehaksesan" - - + "Pilih ciri untuk digunakan dengan pintasan kekunci kelantangan" "%s telah dimatikan" "Edit pintasan" "Selesai" diff --git a/core/res/res/values-my/strings.xml b/core/res/res/values-my/strings.xml index b09539c27bac..85fb0e9e27d7 100644 --- a/core/res/res/values-my/strings.xml +++ b/core/res/res/values-my/strings.xml @@ -1746,8 +1746,7 @@ "အက်ပ်တစ်ခုသည် ခွင့်ပြုချက်တောင်းဆိုမှုကို ပိတ်နေသဖြင့် သင့်တုံ့ပြန်မှုကို စိစစ်၍မရပါ။" "ဝန်ဆောင်မှုကို စတင်အသုံးပြုရန် တို့ပါ−" "အများသုံးနိုင်မှု ခလုတ်ဖြင့် အသုံးပြုရန် ဝန်ဆောင်မှုများကို ရွေးပါ" - - + "အသံထိန်းခလုတ်ဖြတ်လမ်းဖြင့် အသုံးပြုရန်အတွက် တူးလ်များကိုရွေးပါ" "%s ကို ပိတ်ထားသည်" "ဖြတ်လမ်းများကို တည်းဖြတ်ရန်" "ပြီးပြီ" diff --git a/core/res/res/values-ne/strings.xml b/core/res/res/values-ne/strings.xml index 9f3530a3e15d..36e3254135eb 100644 --- a/core/res/res/values-ne/strings.xml +++ b/core/res/res/values-ne/strings.xml @@ -1746,8 +1746,7 @@ "कुनै एपका कारण अनुमतिसम्बन्धी अनुरोध बुझ्न कठिनाइ भइरहेकाले तपाईंको जवाफको पुष्टि गर्न सकिएन।" "कुनै सुविधा प्रयोग गर्न थाल्न उक्त सुविधामा ट्याप गर्नुहोस्:" "पहुँचको बटनमार्फत प्रयोग गर्न चाहेका सुविधाहरू छनौट गर्नुहोस्" - - + "भोल्युम बटनको सर्टकटमार्फत प्रयोग गर्न चाहेका सुविधाहरू छनौट गर्नुहोस्" "%s निष्क्रिय पारिएको छ" "सर्टकटहरू सम्पादन गर्नुहोस्" "सम्पन्न भयो" diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml index 8209504a62f3..18773f6c1473 100644 --- a/core/res/res/values-nl/strings.xml +++ b/core/res/res/values-nl/strings.xml @@ -642,7 +642,7 @@ "Hiermee sta je de app toe locaties van je mediacollectie te bekijken." "Biometrische gegevens gebruiken" "Biometrische gegevens of schermvergrendeling gebruiken" - "Je identiteit verifiëren" + "Je identiteit bevestigen" "Gebruik je biometrische gegevens om door te gaan" "Gebruik je biometrische gegevens of schermvergrendeling om door te gaan" "Biometrische hardware niet beschikbaar" @@ -1746,8 +1746,7 @@ "Een app dekt het verzoek om rechten af, waardoor je reactie niet kan worden geverifieerd." "Tik op een functie om deze te gebruiken:" "Functies kiezen voor gebruik met de knop Toegankelijkheid" - - + "Functies kiezen voor gebruik met de snelkoppeling met volumeknoppen" "%s is uitgezet" "Snelkoppelingen bewerken" "Klaar" diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml index 71940ef78cbd..28c130c42fe4 100644 --- a/core/res/res/values-pt-rPT/strings.xml +++ b/core/res/res/values-pt-rPT/strings.xml @@ -1747,8 +1747,7 @@ "Uma app está a ocultar o pedido de autorização e, por isso, não é possível validar a sua resposta." "Toque numa funcionalidade para começar a utilizá-la:" "Escolha funcionalidades para utilizar com o botão Acessibilidade" - - + "Escolha funcionalidades para usar com o atalho de teclas de volume" "O serviço %s foi desativado." "Editar atalhos" "Concluído" diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml index 22501f2a01b1..3c374ef5de28 100644 --- a/core/res/res/values-ru/strings.xml +++ b/core/res/res/values-ru/strings.xml @@ -1748,8 +1748,7 @@ "Невозможно принять ваш ответ, поскольку запрос разрешения скрыт другим приложением." "Выберите, какую функцию использовать:" "Выберите функции, которые будут запускаться с помощью кнопки специальных возможностей" - - + "Выберите функции, которые вы хотите запускать кнопками регулировки громкости" "Сервис \"%s\" отключен." "Изменить ярлыки" "Готово" diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml index 3289bbc7416f..7185bcdb0de6 100644 --- a/core/res/res/values-sk/strings.xml +++ b/core/res/res/values-sk/strings.xml @@ -1748,8 +1748,7 @@ "Aplikácia zakrýva žiadosť o povolenie, takže vaša odpoveď sa nedá overiť." "Klepnutím na funkciu ju začnite používať:" "Výber funkcií, ktoré chcete používať tlačidlom dostupnosti" - - + "Vyberte funkcie, ktoré chcete používať so skratkou tlačidiel hlasitosti" "Služba %s bola vypnutá" "Upraviť skratky" "Hotovo" diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml index 99ce0469be55..e67bf9c910a3 100644 --- a/core/res/res/values-sl/strings.xml +++ b/core/res/res/values-sl/strings.xml @@ -1748,8 +1748,7 @@ "Aplikacija zakriva zahtevo za dovoljenje, zato ni mogoče potrditi vašega odgovora." "Če želite začeti uporabljati funkcijo, se je dotaknite:" "Izberite funkcije, ki jih želite uporabljati z gumbom za dostopnost" - - + "Izberite funkcije, ki jih želite uporabljati z bližnjico gumbov za glasnost" "Storitev %s je izklopljena" "Uredi bližnjice" "Končano" diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml index 0451b561347b..f5988c282e36 100644 --- a/core/res/res/values-sr/strings.xml +++ b/core/res/res/values-sr/strings.xml @@ -1747,8 +1747,7 @@ "Апликација крије захтев за дозволу, па одговор не може да се верификује." "Додирните неку функцију да бисте почели да је користите:" "Одаберите функције које ћете користити са дугметом Приступачност" - - + "Одаберите функције које ће се користити са пречицом за тастере за јачину звука" "Услуга %s је искључена" "Измените пречице" "Готово" diff --git a/core/res/res/values-ta/strings.xml b/core/res/res/values-ta/strings.xml index b1ce5149861d..626205e42483 100644 --- a/core/res/res/values-ta/strings.xml +++ b/core/res/res/values-ta/strings.xml @@ -1746,8 +1746,7 @@ "அணுகல் கோரிக்கையை ஓர் ஆப்ஸ் மறைப்பதால் உங்கள் பதிலைச் சரிபார்க்க முடியாது." "ஒரு அம்சத்தைப் பயன்படுத்த அதைத் தட்டவும்:" "அணுகல்தன்மை பட்டன் மூலம் பயன்படுத்த விரும்பும் அம்சங்களைத் தேர்வுசெய்யுங்கள்" - - + "ஒலியளவு விசைகளுக்கான ஷார்ட்கட்டுடன் பயன்படுத்துவதற்கான அம்சங்களைத் தேர்வுசெய்யுங்கள்" "%s ஆஃப் செய்யப்பட்டுள்ளது" "ஷார்ட்கட்களை மாற்று" "முடிந்தது" diff --git a/core/res/res/values-te/strings.xml b/core/res/res/values-te/strings.xml index 4b655d156a50..db19868b37dd 100644 --- a/core/res/res/values-te/strings.xml +++ b/core/res/res/values-te/strings.xml @@ -1746,8 +1746,7 @@ "ఒక యాప్ అనుమతి రిక్వెస్ట్‌కు అడ్డు తగులుతోంది కాబట్టి మీ సమాధానం వెరిఫై చేయడం సాధ్యం కాదు." "ఫీచర్‌ని ఉపయోగించడం ప్రారంభించడానికి, దాన్ని ట్యాప్ చేయండి:" "యాక్సెసిబిలిటీ బటన్‌తో ఉపయోగించడానికి ఫీచర్లను ఎంచుకోండి" - - + "వాల్యూమ్ కీల షార్ట్‌కట్‌తో ఉపయోగించడానికి ఫీచర్లను ఎంచుకోండి" "%s ఆఫ్ చేయబడింది" "షార్ట్‌కట్‌లను ఎడిట్ చేయండి" "పూర్తయింది" diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml index d979c340e216..b34cf59a2bb8 100644 --- a/core/res/res/values-th/strings.xml +++ b/core/res/res/values-th/strings.xml @@ -1746,8 +1746,7 @@ "มีแอปหนึ่งบดบังคำขอสิทธิ์ เราจึงยืนยันการตอบกลับของคุณไม่ได้" "แตะฟีเจอร์เพื่อเริ่มใช้" "เลือกฟีเจอร์ที่จะใช้กับปุ่มการช่วยเหลือพิเศษ" - - + "เลือกฟีเจอร์ที่จะใช้กับทางลัดปุ่มปรับระดับเสียง" "ปิด %s แล้ว" "แก้ไขทางลัด" "เสร็จ" diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml index fbbb32c1c8fa..b976f204e395 100644 --- a/core/res/res/values-tl/strings.xml +++ b/core/res/res/values-tl/strings.xml @@ -1746,8 +1746,7 @@ "May app na pumipigil sa kahilingan sa pahintulot kaya hindi ma-verify ang iyong sagot." "I-tap ang isang feature para simulan itong gamitin:" "Pumili ng mga feature na gagana sa pamamagitan ng button ng accessibility" - - + "Pumili ng mga feature na gagana sa pamamagitan ng shortcut ng mga volume key" "Na-off ang %s" "I-edit ang mga shortcut" "Tapos na" diff --git a/core/res/res/values-ur/strings.xml b/core/res/res/values-ur/strings.xml index d2f0898acd0c..fcfff0faa88c 100644 --- a/core/res/res/values-ur/strings.xml +++ b/core/res/res/values-ur/strings.xml @@ -1746,8 +1746,7 @@ "ایپ اجازت کی درخواست کو مبہم کر رہی ہے لہذا آپ کے جواب کی تصدیق نہیں کی جا سکتی۔" "ایک خصوصیت کا استعمال شروع کرنے کیلئے اسے تھپتھپائیں:" "ایکسیسبیلٹی بٹن کے ساتھ استعمال کرنے کیلئے خصوصیات منتخب کریں" - - + "والیوم کلیدوں کے شارٹ کٹ کے ساتھ استعمال کرنے کیلئے خصوصیات منتخب کریں" "%s کو آف کر دیا گیا ہے" "شارٹ کٹس میں ترمیم کریں" "ہو گیا" -- GitLab From 43b4b50daeed0ec0ff5f7e6f0337e07caf88fa2f Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Tue, 10 Sep 2024 22:08:19 +0000 Subject: [PATCH 230/492] Camera: Remove flag 'single_thread_executor' Flag: EXEMPT removal of flag 'single_thread_executor' Bug: 365555183 Test: Successful build Change-Id: Ib8cec8b270ddd06ed4c3cc6c3bf04ef7b9d51665 --- .../hardware/camera2/impl/CameraDeviceImpl.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java index c7dba6c83895..84072585d7f0 100644 --- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java @@ -364,16 +364,11 @@ public class CameraDeviceImpl extends CameraDevice throw new IllegalArgumentException("Null argument given"); } mCameraId = cameraId; - if (Flags.singleThreadExecutor()) { - mDeviceCallback = new ClientStateCallback(executor, callback); - if (Flags.singleThreadExecutorNaming()) { - mDeviceExecutor = Executors.newSingleThreadExecutor(sThreadFactory); - } else { - mDeviceExecutor = Executors.newSingleThreadExecutor(); - } + mDeviceCallback = new ClientStateCallback(executor, callback); + if (Flags.singleThreadExecutorNaming()) { + mDeviceExecutor = Executors.newSingleThreadExecutor(sThreadFactory); } else { - mDeviceCallback = callback; - mDeviceExecutor = executor; + mDeviceExecutor = Executors.newSingleThreadExecutor(); } mCharacteristics = characteristics; mCameraManager = manager; -- GitLab From b60681aee01a2591c8eff0f246fc740e1901dd8c Mon Sep 17 00:00:00 2001 From: Vaibhav Devmurari Date: Thu, 29 Aug 2024 11:20:43 +0000 Subject: [PATCH 231/492] Add KeyGestureEventHandler APIs Test: atest KeyGestureEventHandlerTest Bug: 358569822 Flag: EXEMPT hidden APIs added (the usage will be flagged) Change-Id: I6479583dc756ba47908ffd772ba148e1c2f60fb3 --- .../hardware/input/AidlKeyGestureEvent.aidl | 29 + .../android/hardware/input/IInputManager.aidl | 11 + .../input/IKeyGestureEventListener.aidl | 4 +- .../hardware/input/IKeyGestureHandler.aidl | 42 + .../android/hardware/input/InputManager.java | 58 ++ .../hardware/input/InputManagerGlobal.java | 109 ++- .../hardware/input/KeyGestureEvent.java | 883 +++++++++--------- .../KeyboardTouchpadEduInteractorTest.kt | 12 +- .../server/input/InputManagerService.java | 52 +- .../server/input/KeyGestureController.java | 236 ++++- .../input/KeyboardMetricsCollector.java | 15 +- .../input/KeyGestureEventHandlerTest.kt | 236 +++++ .../input/KeyGestureEventListenerTest.kt | 27 +- .../server/input/KeyGestureControllerTests.kt | 162 +++- 14 files changed, 1349 insertions(+), 527 deletions(-) create mode 100644 core/java/android/hardware/input/AidlKeyGestureEvent.aidl create mode 100644 core/java/android/hardware/input/IKeyGestureHandler.aidl create mode 100644 tests/Input/src/android/hardware/input/KeyGestureEventHandlerTest.kt diff --git a/core/java/android/hardware/input/AidlKeyGestureEvent.aidl b/core/java/android/hardware/input/AidlKeyGestureEvent.aidl new file mode 100644 index 000000000000..7cf8795085e3 --- /dev/null +++ b/core/java/android/hardware/input/AidlKeyGestureEvent.aidl @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.input; + +/** @hide */ +@JavaDerive(equals=true) +parcelable AidlKeyGestureEvent { + int deviceId; + int[] keycodes; + int modifierState; + int gestureType; + int action; + int displayId; + int flags; +} diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl index 2d96bbaae901..102f56e4672b 100644 --- a/core/java/android/hardware/input/IInputManager.aidl +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -26,6 +26,7 @@ import android.hardware.input.IInputDeviceBatteryState; import android.hardware.input.IKeyboardBacklightListener; import android.hardware.input.IKeyboardBacklightState; import android.hardware.input.IKeyGestureEventListener; +import android.hardware.input.IKeyGestureHandler; import android.hardware.input.IStickyModifierStateListener; import android.hardware.input.ITabletModeChangedListener; import android.hardware.input.KeyboardLayoutSelectionResult; @@ -250,4 +251,14 @@ interface IInputManager { @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.MANAGE_KEY_GESTURES)") void unregisterKeyGestureEventListener(IKeyGestureEventListener listener); + + @PermissionManuallyEnforced + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + + "android.Manifest.permission.MANAGE_KEY_GESTURES)") + void registerKeyGestureHandler(IKeyGestureHandler handler); + + @PermissionManuallyEnforced + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + + "android.Manifest.permission.MANAGE_KEY_GESTURES)") + void unregisterKeyGestureHandler(IKeyGestureHandler handler); } diff --git a/core/java/android/hardware/input/IKeyGestureEventListener.aidl b/core/java/android/hardware/input/IKeyGestureEventListener.aidl index 2c430f1a1c9d..6b5f83758a11 100644 --- a/core/java/android/hardware/input/IKeyGestureEventListener.aidl +++ b/core/java/android/hardware/input/IKeyGestureEventListener.aidl @@ -16,11 +16,13 @@ package android.hardware.input; +import android.hardware.input.AidlKeyGestureEvent; + /** @hide */ oneway interface IKeyGestureEventListener { /** * Called when a key gesture event occurs. */ - void onKeyGestureEvent(int deviceId, in int[] keycodes, int modifierState, int shortcut); + void onKeyGestureEvent(in AidlKeyGestureEvent event); } diff --git a/core/java/android/hardware/input/IKeyGestureHandler.aidl b/core/java/android/hardware/input/IKeyGestureHandler.aidl new file mode 100644 index 000000000000..509b9482154e --- /dev/null +++ b/core/java/android/hardware/input/IKeyGestureHandler.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.input; + +import android.hardware.input.AidlKeyGestureEvent; +import android.os.IBinder; + +/** @hide */ +interface IKeyGestureHandler { + + /** + * Called when a key gesture starts, ends, or is cancelled. If a handler returns {@code true}, + * it means they intend to handle the full gesture and should handle all the events pertaining + * to that gesture. + */ + boolean handleKeyGesture(in AidlKeyGestureEvent event, in IBinder focusedToken); + + /** + * Called to know if a particular gesture type is supported by the handler. + * + * TODO(b/358569822): Remove this call to reduce the binder calls to single call for + * handleKeyGesture. For this we need to remove dependency of multi-key gestures to identify if + * a key gesture is supported on first relevant key down. + * Also, for now we prioritize handlers in the system server process above external handlers to + * reduce IPC binder calls. + */ + boolean isKeyGestureSupported(int gestureType); +} diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index 04cfcd880f52..22728f7a5ad3 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -1405,6 +1405,33 @@ public final class InputManager { mGlobal.unregisterKeyGestureEventListener(listener); } + /** + * Registers a key gesture event handler for {@link KeyGestureEvent} handling. + * + * @param handler the {@link KeyGestureEventHandler} + * @throws IllegalArgumentException if {@code handler} has already been registered previously. + * @throws NullPointerException if {@code handler} or {@code executor} is null. + * @hide + * @see #unregisterKeyGestureEventHandler(KeyGestureEventHandler) + */ + @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES) + public void registerKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) + throws IllegalArgumentException { + mGlobal.registerKeyGestureEventHandler(handler); + } + + /** + * Unregisters a previously added key gesture event handler. + * + * @param handler the {@link KeyGestureEventHandler} + * @hide + * @see #registerKeyGestureEventHandler(KeyGestureEventHandler) + */ + @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES) + public void unregisterKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) { + mGlobal.unregisterKeyGestureEventHandler(handler); + } + /** * A callback used to be notified about battery state changes for an input device. The * {@link #onBatteryStateChanged(int, long, BatteryState)} method will be called once after the @@ -1522,4 +1549,35 @@ public final class InputManager { */ void onKeyGestureEvent(@NonNull KeyGestureEvent event); } + + /** + * A callback used to notify about key gesture event start, complete and cancel. Unlike + * {@see KeyGestureEventListener} which is to listen to successfully handled key gestures, this + * interface allows system components to register handler for handling key gestures. + * + * @see #registerKeyGestureEventHandler(KeyGestureEventHandler) + * @see #unregisterKeyGestureEventHandler(KeyGestureEventHandler) + * + *

    NOTE: All callbacks will occur on system main and input threads, so the caller needs + * to move time-consuming operations to appropriate handler threads. + * @hide + */ + public interface KeyGestureEventHandler { + /** + * Called when a key gesture event starts, is completed, or is cancelled. If a handler + * returns {@code true}, it implies that the handler intends to handle the key gesture and + * only this handler will receive the future events for this key gesture. + * + * @param event the gesture event + */ + boolean handleKeyGestureEvent(@NonNull KeyGestureEvent event, + @Nullable IBinder focusedToken); + + /** + * Called to identify if a particular gesture is of interest to a handler. + * + * NOTE: If no active handler supports certain gestures, the gestures will not be captured. + */ + boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType); + } } diff --git a/core/java/android/hardware/input/InputManagerGlobal.java b/core/java/android/hardware/input/InputManagerGlobal.java index 2a362381a003..5c11346df1c3 100644 --- a/core/java/android/hardware/input/InputManagerGlobal.java +++ b/core/java/android/hardware/input/InputManagerGlobal.java @@ -25,6 +25,7 @@ import android.hardware.BatteryState; import android.hardware.SensorManager; import android.hardware.input.InputManager.InputDeviceBatteryListener; import android.hardware.input.InputManager.InputDeviceListener; +import android.hardware.input.InputManager.KeyGestureEventHandler; import android.hardware.input.InputManager.KeyGestureEventListener; import android.hardware.input.InputManager.KeyboardBacklightListener; import android.hardware.input.InputManager.OnTabletModeChangedListener; @@ -119,6 +120,14 @@ public final class InputManagerGlobal { @Nullable private IKeyGestureEventListener mKeyGestureEventListener; + private final Object mKeyGestureEventHandlerLock = new Object(); + @GuardedBy("mKeyGestureEventHandlerLock") + @Nullable + private ArrayList mKeyGestureEventHandlers; + @GuardedBy("mKeyGestureEventHandlerLock") + @Nullable + private IKeyGestureHandler mKeyGestureHandler; + // InputDeviceSensorManager gets notified synchronously from the binder thread when input // devices change, so it must be synchronized with the input device listeners. @GuardedBy("mInputDeviceListeners") @@ -1080,18 +1089,14 @@ public final class InputManagerGlobal { } private class LocalKeyGestureEventListener extends IKeyGestureEventListener.Stub { - @Override - public void onKeyGestureEvent(int deviceId, int[] keycodes, int modifierState, - int gestureType) { + public void onKeyGestureEvent(@NonNull AidlKeyGestureEvent ev) { synchronized (mKeyGestureEventListenerLock) { if (mKeyGestureEventListeners == null) return; final int numListeners = mKeyGestureEventListeners.size(); + final KeyGestureEvent event = new KeyGestureEvent(ev); for (int i = 0; i < numListeners; i++) { - mKeyGestureEventListeners.get(i) - .onKeyGestureEvent( - new KeyGestureEvent(deviceId, keycodes, modifierState, - gestureType)); + mKeyGestureEventListeners.get(i).onKeyGestureEvent(event); } } } @@ -1154,6 +1159,96 @@ public final class InputManagerGlobal { } } + private class LocalKeyGestureHandler extends IKeyGestureHandler.Stub { + @Override + public boolean handleKeyGesture(@NonNull AidlKeyGestureEvent ev, IBinder focusedToken) { + synchronized (mKeyGestureEventHandlerLock) { + if (mKeyGestureEventHandlers == null) { + return false; + } + final int numHandlers = mKeyGestureEventHandlers.size(); + final KeyGestureEvent event = new KeyGestureEvent(ev); + for (int i = 0; i < numHandlers; i++) { + KeyGestureEventHandler handler = mKeyGestureEventHandlers.get(i); + if (handler.handleKeyGestureEvent(event, focusedToken)) { + return true; + } + } + } + return false; + } + + @Override + public boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType) { + synchronized (mKeyGestureEventHandlerLock) { + if (mKeyGestureEventHandlers == null) { + return false; + } + final int numHandlers = mKeyGestureEventHandlers.size(); + for (int i = 0; i < numHandlers; i++) { + KeyGestureEventHandler handler = mKeyGestureEventHandlers.get(i); + if (handler.isKeyGestureSupported(gestureType)) { + return true; + } + } + } + return false; + } + } + + /** + * @see InputManager#registerKeyGestureEventHandler(KeyGestureEventHandler) + */ + @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES) + void registerKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) + throws IllegalArgumentException { + Objects.requireNonNull(handler, "handler should not be null"); + + synchronized (mKeyGestureEventHandlerLock) { + if (mKeyGestureHandler == null) { + mKeyGestureEventHandlers = new ArrayList<>(); + mKeyGestureHandler = new LocalKeyGestureHandler(); + + try { + mIm.registerKeyGestureHandler(mKeyGestureHandler); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + final int numHandlers = mKeyGestureEventHandlers.size(); + for (int i = 0; i < numHandlers; i++) { + if (mKeyGestureEventHandlers.get(i) == handler) { + throw new IllegalArgumentException("Handler has already been registered!"); + } + } + mKeyGestureEventHandlers.add(handler); + } + } + + /** + * @see InputManager#unregisterKeyGestureEventHandler(KeyGestureEventHandler) + */ + @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES) + void unregisterKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) { + Objects.requireNonNull(handler, "handler should not be null"); + + synchronized (mKeyGestureEventHandlerLock) { + if (mKeyGestureEventHandlers == null) { + return; + } + mKeyGestureEventHandlers.removeIf(existingHandler -> existingHandler == handler); + if (mKeyGestureEventHandlers.isEmpty()) { + try { + mIm.unregisterKeyGestureHandler(mKeyGestureHandler); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + mKeyGestureEventHandlers = null; + mKeyGestureHandler = null; + } + } + } + /** * TODO(b/330517633): Cleanup the unsupported API */ diff --git a/core/java/android/hardware/input/KeyGestureEvent.java b/core/java/android/hardware/input/KeyGestureEvent.java index 7a8dd3395d21..c7ebc63a3d15 100644 --- a/core/java/android/hardware/input/KeyGestureEvent.java +++ b/core/java/android/hardware/input/KeyGestureEvent.java @@ -19,8 +19,11 @@ package android.hardware.input; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; +import android.view.Display; +import android.view.KeyCharacterMap; -import com.android.internal.util.DataClass; +import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.util.AnnotationValidations; import com.android.internal.util.FrameworkStatsLog; import java.lang.annotation.Retention; @@ -31,501 +34,511 @@ import java.lang.annotation.RetentionPolicy; * * @hide */ -@DataClass(genToString = true, genEqualsHashCode = true) -public class KeyGestureEvent { +public final class KeyGestureEvent { - private final int mDeviceId; @NonNull - private final int[] mKeycodes; - private final int mModifierState; - @KeyGestureType - private final int mKeyGestureType; - - - public static final int KEY_GESTURE_TYPE_UNSPECIFIED = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__UNSPECIFIED; - public static final int KEY_GESTURE_TYPE_HOME = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__HOME; - public static final int KEY_GESTURE_TYPE_RECENT_APPS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__RECENT_APPS; - public static final int KEY_GESTURE_TYPE_BACK = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BACK; - public static final int KEY_GESTURE_TYPE_APP_SWITCH = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__APP_SWITCH; - public static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_ASSISTANT; - public static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_VOICE_ASSISTANT; - public static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SYSTEM_SETTINGS; - public static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_NOTIFICATION_PANEL; - public static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_TASKBAR; - public static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TAKE_SCREENSHOT; - public static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_SHORTCUT_HELPER; - public static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_UP; - public static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_DOWN; - public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_UP; - public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_DOWN; - public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_TOGGLE; - public static final int KEY_GESTURE_TYPE_VOLUME_UP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_UP; - public static final int KEY_GESTURE_TYPE_VOLUME_DOWN = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_DOWN; - public static final int KEY_GESTURE_TYPE_VOLUME_MUTE = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_MUTE; - public static final int KEY_GESTURE_TYPE_ALL_APPS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ALL_APPS; - public static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SEARCH; - public static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LANGUAGE_SWITCH; - public static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ACCESSIBILITY_ALL_APPS; - public static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_CAPS_LOCK; - public static final int KEY_GESTURE_TYPE_SYSTEM_MUTE = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_MUTE; - public static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SPLIT_SCREEN_NAVIGATION; - public static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__CHANGE_SPLITSCREEN_FOCUS; - public static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TRIGGER_BUG_REPORT; - public static final int KEY_GESTURE_TYPE_LOCK_SCREEN = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LOCK_SCREEN; - public static final int KEY_GESTURE_TYPE_OPEN_NOTES = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_NOTES; - public static final int KEY_GESTURE_TYPE_TOGGLE_POWER = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_POWER; - public static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_NAVIGATION; - public static final int KEY_GESTURE_TYPE_SLEEP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SLEEP; - public static final int KEY_GESTURE_TYPE_WAKEUP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__WAKEUP; - public static final int KEY_GESTURE_TYPE_MEDIA_KEY = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MEDIA_KEY; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_BROWSER; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_EMAIL; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CONTACTS; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALENDAR; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALCULATOR; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MUSIC; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MAPS; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MESSAGING; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_GALLERY; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FILES; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_WEATHER; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FITNESS; - public static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_APPLICATION_BY_PACKAGE_NAME; - public static final int KEY_GESTURE_TYPE_DESKTOP_MODE = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__DESKTOP_MODE; - public static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MULTI_WINDOW_NAVIGATION; - - - - // Code below generated by codegen v1.0.23. - // - // DO NOT MODIFY! - // CHECKSTYLE:OFF Generated code - // - // To regenerate run: - // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/hardware/input/KeyGestureEvent.java - // - // To exclude the generated code from IntelliJ auto-formatting enable (one-time): - // Settings > Editor > Code Style > Formatter Control - //@formatter:off - + private AidlKeyGestureEvent mKeyGestureEvent; + + public static final int KEY_GESTURE_TYPE_UNSPECIFIED = 0; + public static final int KEY_GESTURE_TYPE_HOME = 1; + public static final int KEY_GESTURE_TYPE_RECENT_APPS = 2; + public static final int KEY_GESTURE_TYPE_BACK = 3; + public static final int KEY_GESTURE_TYPE_APP_SWITCH = 4; + public static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT = 5; + public static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT = 6; + public static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS = 7; + public static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL = 8; + public static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR = 9; + public static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT = 10; + public static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER = 11; + public static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP = 12; + public static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN = 13; + public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP = 14; + public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN = 15; + public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE = 16; + public static final int KEY_GESTURE_TYPE_VOLUME_UP = 17; + public static final int KEY_GESTURE_TYPE_VOLUME_DOWN = 18; + public static final int KEY_GESTURE_TYPE_VOLUME_MUTE = 19; + public static final int KEY_GESTURE_TYPE_ALL_APPS = 20; + public static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH = 21; + public static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH = 22; + public static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS = 23; + public static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK = 24; + public static final int KEY_GESTURE_TYPE_SYSTEM_MUTE = 25; + public static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION = 26; + public static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS = 27; + public static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT = 28; + public static final int KEY_GESTURE_TYPE_LOCK_SCREEN = 29; + public static final int KEY_GESTURE_TYPE_OPEN_NOTES = 30; + public static final int KEY_GESTURE_TYPE_TOGGLE_POWER = 31; + public static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION = 32; + public static final int KEY_GESTURE_TYPE_SLEEP = 33; + public static final int KEY_GESTURE_TYPE_WAKEUP = 34; + public static final int KEY_GESTURE_TYPE_MEDIA_KEY = 35; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER = 36; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL = 37; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS = 38; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR = 39; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR = 40; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC = 41; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS = 42; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING = 43; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY = 44; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES = 45; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER = 46; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS = 47; + public static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME = 48; + public static final int KEY_GESTURE_TYPE_DESKTOP_MODE = 49; + public static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION = 50; + + public static final int FLAG_CANCELLED = 1; + + // NOTE: Valid KeyGestureEvent streams: + // - GESTURE_START -> GESTURE_CANCEL + // - GESTURE_START -> GESTURE_COMPLETE + // - GESTURE_COMPLETE + + /** Key gesture started (e.g. Key down of the relevant key) */ + public static final int ACTION_GESTURE_START = 1; + /** Key gesture completed (e.g. Key up of the relevant key) */ + public static final int ACTION_GESTURE_COMPLETE = 2; @IntDef(prefix = "KEY_GESTURE_TYPE_", value = { - KEY_GESTURE_TYPE_UNSPECIFIED, - KEY_GESTURE_TYPE_HOME, - KEY_GESTURE_TYPE_RECENT_APPS, - KEY_GESTURE_TYPE_BACK, - KEY_GESTURE_TYPE_APP_SWITCH, - KEY_GESTURE_TYPE_LAUNCH_ASSISTANT, - KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT, - KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS, - KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL, - KEY_GESTURE_TYPE_TOGGLE_TASKBAR, - KEY_GESTURE_TYPE_TAKE_SCREENSHOT, - KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER, - KEY_GESTURE_TYPE_BRIGHTNESS_UP, - KEY_GESTURE_TYPE_BRIGHTNESS_DOWN, - KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP, - KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN, - KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE, - KEY_GESTURE_TYPE_VOLUME_UP, - KEY_GESTURE_TYPE_VOLUME_DOWN, - KEY_GESTURE_TYPE_VOLUME_MUTE, - KEY_GESTURE_TYPE_ALL_APPS, - KEY_GESTURE_TYPE_LAUNCH_SEARCH, - KEY_GESTURE_TYPE_LANGUAGE_SWITCH, - KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS, - KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK, - KEY_GESTURE_TYPE_SYSTEM_MUTE, - KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION, - KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS, - KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT, - KEY_GESTURE_TYPE_LOCK_SCREEN, - KEY_GESTURE_TYPE_OPEN_NOTES, - KEY_GESTURE_TYPE_TOGGLE_POWER, - KEY_GESTURE_TYPE_SYSTEM_NAVIGATION, - KEY_GESTURE_TYPE_SLEEP, - KEY_GESTURE_TYPE_WAKEUP, - KEY_GESTURE_TYPE_MEDIA_KEY, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS, - KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME, - KEY_GESTURE_TYPE_DESKTOP_MODE, - KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION + KEY_GESTURE_TYPE_UNSPECIFIED, + KEY_GESTURE_TYPE_HOME, + KEY_GESTURE_TYPE_RECENT_APPS, + KEY_GESTURE_TYPE_BACK, + KEY_GESTURE_TYPE_APP_SWITCH, + KEY_GESTURE_TYPE_LAUNCH_ASSISTANT, + KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT, + KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS, + KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL, + KEY_GESTURE_TYPE_TOGGLE_TASKBAR, + KEY_GESTURE_TYPE_TAKE_SCREENSHOT, + KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER, + KEY_GESTURE_TYPE_BRIGHTNESS_UP, + KEY_GESTURE_TYPE_BRIGHTNESS_DOWN, + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP, + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN, + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE, + KEY_GESTURE_TYPE_VOLUME_UP, + KEY_GESTURE_TYPE_VOLUME_DOWN, + KEY_GESTURE_TYPE_VOLUME_MUTE, + KEY_GESTURE_TYPE_ALL_APPS, + KEY_GESTURE_TYPE_LAUNCH_SEARCH, + KEY_GESTURE_TYPE_LANGUAGE_SWITCH, + KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS, + KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK, + KEY_GESTURE_TYPE_SYSTEM_MUTE, + KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION, + KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS, + KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT, + KEY_GESTURE_TYPE_LOCK_SCREEN, + KEY_GESTURE_TYPE_OPEN_NOTES, + KEY_GESTURE_TYPE_TOGGLE_POWER, + KEY_GESTURE_TYPE_SYSTEM_NAVIGATION, + KEY_GESTURE_TYPE_SLEEP, + KEY_GESTURE_TYPE_WAKEUP, + KEY_GESTURE_TYPE_MEDIA_KEY, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS, + KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME, + KEY_GESTURE_TYPE_DESKTOP_MODE, + KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION, }) @Retention(RetentionPolicy.SOURCE) - @DataClass.Generated.Member - public @interface KeyGestureType {} + public @interface KeyGestureType { + } + + public KeyGestureEvent(@NonNull AidlKeyGestureEvent keyGestureEvent) { + this.mKeyGestureEvent = keyGestureEvent; + } + + /** + * Key gesture event builder used to create a KeyGestureEvent for tests in Java. + * + * @hide + */ + public static class Builder { + private int mDeviceId = KeyCharacterMap.VIRTUAL_KEYBOARD; + private int[] mKeycodes = new int[0]; + private int mModifierState = 0; + @KeyGestureType + private int mKeyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_UNSPECIFIED; + private int mAction = KeyGestureEvent.ACTION_GESTURE_COMPLETE; + private int mDisplayId = Display.DEFAULT_DISPLAY; + private int mFlags = 0; + + /** + * @see KeyGestureEvent#getDeviceId() + */ + public Builder setDeviceId(int deviceId) { + mDeviceId = deviceId; + return this; + } + + /** + * @see KeyGestureEvent#getKeycodes() + */ + public Builder setKeycodes(@NonNull int[] keycodes) { + mKeycodes = keycodes; + return this; + } + + /** + * @see KeyGestureEvent#getModifierState() + */ + public Builder setModifierState(int modifierState) { + mModifierState = modifierState; + return this; + } + + /** + * @see KeyGestureEvent#getKeyGestureType() + */ + public Builder setKeyGestureType(@KeyGestureEvent.KeyGestureType int keyGestureType) { + mKeyGestureType = keyGestureType; + return this; + } + + /** + * @see KeyGestureEvent#getAction() + */ + public Builder setAction(int action) { + mAction = action; + return this; + } + + /** + * @see KeyGestureEvent#getDisplayId() + */ + public Builder setDisplayId(int displayId) { + mDisplayId = displayId; + return this; + } + + /** + * @see KeyGestureEvent#getFlags() + */ + public Builder setFlags(int flags) { + mFlags = flags; + return this; + } + + /** + * Build {@link KeyGestureEvent} + */ + public KeyGestureEvent build() { + AidlKeyGestureEvent event = new AidlKeyGestureEvent(); + event.deviceId = mDeviceId; + event.keycodes = mKeycodes; + event.modifierState = mModifierState; + event.gestureType = mKeyGestureType; + event.action = mAction; + event.displayId = mDisplayId; + event.flags = mFlags; + return new KeyGestureEvent(event); + } + } + + public int getDeviceId() { + return mKeyGestureEvent.deviceId; + } + + public @NonNull int[] getKeycodes() { + return mKeyGestureEvent.keycodes; + } + + public int getModifierState() { + return mKeyGestureEvent.modifierState; + } + + public @KeyGestureType int getKeyGestureType() { + return mKeyGestureEvent.gestureType; + } + + public int getAction() { + return mKeyGestureEvent.action; + } + + public int getDisplayId() { + return mKeyGestureEvent.displayId; + } - @DataClass.Generated.Member - public static String keyGestureTypeToString(@KeyGestureType int value) { + public int getFlags() { + return mKeyGestureEvent.flags; + } + + public boolean isCancelled() { + return (mKeyGestureEvent.flags & FLAG_CANCELLED) != 0; + } + + @Override + public String toString() { + return "KeyGestureEvent { " + + "deviceId = " + mKeyGestureEvent.deviceId + ", " + + "keycodes = " + java.util.Arrays.toString(mKeyGestureEvent.keycodes) + ", " + + "modifierState = " + mKeyGestureEvent.modifierState + ", " + + "keyGestureType = " + keyGestureTypeToString(mKeyGestureEvent.gestureType) + ", " + + "action = " + mKeyGestureEvent.action + ", " + + "displayId = " + mKeyGestureEvent.displayId + ", " + + "flags = " + mKeyGestureEvent.flags + + " }"; + } + + @Override + public boolean equals(@Nullable Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + KeyGestureEvent that = (KeyGestureEvent) o; + return mKeyGestureEvent.deviceId == that.mKeyGestureEvent.deviceId + && java.util.Arrays.equals(mKeyGestureEvent.keycodes, that.mKeyGestureEvent.keycodes) + && mKeyGestureEvent.modifierState == that.mKeyGestureEvent.modifierState + && mKeyGestureEvent.gestureType == that.mKeyGestureEvent.gestureType + && mKeyGestureEvent.action == that.mKeyGestureEvent.action + && mKeyGestureEvent.displayId == that.mKeyGestureEvent.displayId + && mKeyGestureEvent.flags == that.mKeyGestureEvent.flags; + } + + @Override + public int hashCode() { + int _hash = 1; + _hash = 31 * _hash + mKeyGestureEvent.deviceId; + _hash = 31 * _hash + java.util.Arrays.hashCode(mKeyGestureEvent.keycodes); + _hash = 31 * _hash + mKeyGestureEvent.modifierState; + _hash = 31 * _hash + mKeyGestureEvent.gestureType; + _hash = 31 * _hash + mKeyGestureEvent.action; + _hash = 31 * _hash + mKeyGestureEvent.displayId; + _hash = 31 * _hash + mKeyGestureEvent.flags; + return _hash; + } + + /** + * Convert KeyGestureEvent type to corresponding log event got KeyboardSystemsEvent + */ + public static int keyGestureTypeToLogEvent(@KeyGestureType int value) { switch (value) { - case KEY_GESTURE_TYPE_UNSPECIFIED: - return "KEY_GESTURE_TYPE_UNSPECIFIED"; case KEY_GESTURE_TYPE_HOME: - return "KEY_GESTURE_TYPE_HOME"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__HOME; case KEY_GESTURE_TYPE_RECENT_APPS: - return "KEY_GESTURE_TYPE_RECENT_APPS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__RECENT_APPS; case KEY_GESTURE_TYPE_BACK: - return "KEY_GESTURE_TYPE_BACK"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BACK; case KEY_GESTURE_TYPE_APP_SWITCH: - return "KEY_GESTURE_TYPE_APP_SWITCH"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__APP_SWITCH; case KEY_GESTURE_TYPE_LAUNCH_ASSISTANT: - return "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_ASSISTANT; case KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT: - return "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_VOICE_ASSISTANT; case KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS: - return "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SYSTEM_SETTINGS; case KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL: - return "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_NOTIFICATION_PANEL; case KEY_GESTURE_TYPE_TOGGLE_TASKBAR: - return "KEY_GESTURE_TYPE_TOGGLE_TASKBAR"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_TASKBAR; case KEY_GESTURE_TYPE_TAKE_SCREENSHOT: - return "KEY_GESTURE_TYPE_TAKE_SCREENSHOT"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TAKE_SCREENSHOT; case KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER: - return "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_SHORTCUT_HELPER; case KEY_GESTURE_TYPE_BRIGHTNESS_UP: - return "KEY_GESTURE_TYPE_BRIGHTNESS_UP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_UP; case KEY_GESTURE_TYPE_BRIGHTNESS_DOWN: - return "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_DOWN; case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP: - return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_UP; case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN: - return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_DOWN; case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE: - return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_TOGGLE; case KEY_GESTURE_TYPE_VOLUME_UP: - return "KEY_GESTURE_TYPE_VOLUME_UP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_UP; case KEY_GESTURE_TYPE_VOLUME_DOWN: - return "KEY_GESTURE_TYPE_VOLUME_DOWN"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_DOWN; case KEY_GESTURE_TYPE_VOLUME_MUTE: - return "KEY_GESTURE_TYPE_VOLUME_MUTE"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_MUTE; case KEY_GESTURE_TYPE_ALL_APPS: - return "KEY_GESTURE_TYPE_ALL_APPS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ALL_APPS; case KEY_GESTURE_TYPE_LAUNCH_SEARCH: - return "KEY_GESTURE_TYPE_LAUNCH_SEARCH"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SEARCH; case KEY_GESTURE_TYPE_LANGUAGE_SWITCH: - return "KEY_GESTURE_TYPE_LANGUAGE_SWITCH"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LANGUAGE_SWITCH; case KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS: - return "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ACCESSIBILITY_ALL_APPS; case KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK: - return "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_CAPS_LOCK; case KEY_GESTURE_TYPE_SYSTEM_MUTE: - return "KEY_GESTURE_TYPE_SYSTEM_MUTE"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_MUTE; case KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION: - return "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SPLIT_SCREEN_NAVIGATION; case KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS: - return "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__CHANGE_SPLITSCREEN_FOCUS; case KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT: - return "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TRIGGER_BUG_REPORT; case KEY_GESTURE_TYPE_LOCK_SCREEN: - return "KEY_GESTURE_TYPE_LOCK_SCREEN"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LOCK_SCREEN; case KEY_GESTURE_TYPE_OPEN_NOTES: - return "KEY_GESTURE_TYPE_OPEN_NOTES"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_NOTES; case KEY_GESTURE_TYPE_TOGGLE_POWER: - return "KEY_GESTURE_TYPE_TOGGLE_POWER"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_POWER; case KEY_GESTURE_TYPE_SYSTEM_NAVIGATION: - return "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_NAVIGATION; case KEY_GESTURE_TYPE_SLEEP: - return "KEY_GESTURE_TYPE_SLEEP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SLEEP; case KEY_GESTURE_TYPE_WAKEUP: - return "KEY_GESTURE_TYPE_WAKEUP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__WAKEUP; case KEY_GESTURE_TYPE_MEDIA_KEY: - return "KEY_GESTURE_TYPE_MEDIA_KEY"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MEDIA_KEY; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_BROWSER; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_EMAIL; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CONTACTS; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALENDAR; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALCULATOR; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MUSIC; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MAPS; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MESSAGING; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_GALLERY; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FILES; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_WEATHER; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FITNESS; case KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME: - return "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_APPLICATION_BY_PACKAGE_NAME; case KEY_GESTURE_TYPE_DESKTOP_MODE: - return "KEY_GESTURE_TYPE_DESKTOP_MODE"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__DESKTOP_MODE; case KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION: - return "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION"; - default: return Integer.toHexString(value); + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MULTI_WINDOW_NAVIGATION; + default: + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__UNSPECIFIED; } } - @DataClass.Generated.Member - public KeyGestureEvent( - int deviceId, - @NonNull int[] keycodes, - int modifierState, - @KeyGestureType int keyGestureType) { - this.mDeviceId = deviceId; - this.mKeycodes = keycodes; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mKeycodes); - this.mModifierState = modifierState; - this.mKeyGestureType = keyGestureType; - - if (!(mKeyGestureType == KEY_GESTURE_TYPE_UNSPECIFIED) - && !(mKeyGestureType == KEY_GESTURE_TYPE_HOME) - && !(mKeyGestureType == KEY_GESTURE_TYPE_RECENT_APPS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_BACK) - && !(mKeyGestureType == KEY_GESTURE_TYPE_APP_SWITCH) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_ASSISTANT) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_TASKBAR) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TAKE_SCREENSHOT) - && !(mKeyGestureType == KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER) - && !(mKeyGestureType == KEY_GESTURE_TYPE_BRIGHTNESS_UP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_BRIGHTNESS_DOWN) - && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN) - && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE) - && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_UP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_DOWN) - && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_MUTE) - && !(mKeyGestureType == KEY_GESTURE_TYPE_ALL_APPS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_SEARCH) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LANGUAGE_SWITCH) - && !(mKeyGestureType == KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK) - && !(mKeyGestureType == KEY_GESTURE_TYPE_SYSTEM_MUTE) - && !(mKeyGestureType == KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION) - && !(mKeyGestureType == KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LOCK_SCREEN) - && !(mKeyGestureType == KEY_GESTURE_TYPE_OPEN_NOTES) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_POWER) - && !(mKeyGestureType == KEY_GESTURE_TYPE_SYSTEM_NAVIGATION) - && !(mKeyGestureType == KEY_GESTURE_TYPE_SLEEP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_WAKEUP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_MEDIA_KEY) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME) - && !(mKeyGestureType == KEY_GESTURE_TYPE_DESKTOP_MODE) - && !(mKeyGestureType == KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION)) { - throw new java.lang.IllegalArgumentException( - "keyGestureType was " + mKeyGestureType + " but must be one of: " - + "KEY_GESTURE_TYPE_UNSPECIFIED(" + KEY_GESTURE_TYPE_UNSPECIFIED + "), " - + "KEY_GESTURE_TYPE_HOME(" + KEY_GESTURE_TYPE_HOME + "), " - + "KEY_GESTURE_TYPE_RECENT_APPS(" + KEY_GESTURE_TYPE_RECENT_APPS + "), " - + "KEY_GESTURE_TYPE_BACK(" + KEY_GESTURE_TYPE_BACK + "), " - + "KEY_GESTURE_TYPE_APP_SWITCH(" + KEY_GESTURE_TYPE_APP_SWITCH + "), " - + "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT(" + KEY_GESTURE_TYPE_LAUNCH_ASSISTANT + "), " - + "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT(" + KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT + "), " - + "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS(" + KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS + "), " - + "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL(" + KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL + "), " - + "KEY_GESTURE_TYPE_TOGGLE_TASKBAR(" + KEY_GESTURE_TYPE_TOGGLE_TASKBAR + "), " - + "KEY_GESTURE_TYPE_TAKE_SCREENSHOT(" + KEY_GESTURE_TYPE_TAKE_SCREENSHOT + "), " - + "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER(" + KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER + "), " - + "KEY_GESTURE_TYPE_BRIGHTNESS_UP(" + KEY_GESTURE_TYPE_BRIGHTNESS_UP + "), " - + "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN(" + KEY_GESTURE_TYPE_BRIGHTNESS_DOWN + "), " - + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP + "), " - + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN + "), " - + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE + "), " - + "KEY_GESTURE_TYPE_VOLUME_UP(" + KEY_GESTURE_TYPE_VOLUME_UP + "), " - + "KEY_GESTURE_TYPE_VOLUME_DOWN(" + KEY_GESTURE_TYPE_VOLUME_DOWN + "), " - + "KEY_GESTURE_TYPE_VOLUME_MUTE(" + KEY_GESTURE_TYPE_VOLUME_MUTE + "), " - + "KEY_GESTURE_TYPE_ALL_APPS(" + KEY_GESTURE_TYPE_ALL_APPS + "), " - + "KEY_GESTURE_TYPE_LAUNCH_SEARCH(" + KEY_GESTURE_TYPE_LAUNCH_SEARCH + "), " - + "KEY_GESTURE_TYPE_LANGUAGE_SWITCH(" + KEY_GESTURE_TYPE_LANGUAGE_SWITCH + "), " - + "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS(" + KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS + "), " - + "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK(" + KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK + "), " - + "KEY_GESTURE_TYPE_SYSTEM_MUTE(" + KEY_GESTURE_TYPE_SYSTEM_MUTE + "), " - + "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION(" + KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION + "), " - + "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS(" + KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS + "), " - + "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT(" + KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT + "), " - + "KEY_GESTURE_TYPE_LOCK_SCREEN(" + KEY_GESTURE_TYPE_LOCK_SCREEN + "), " - + "KEY_GESTURE_TYPE_OPEN_NOTES(" + KEY_GESTURE_TYPE_OPEN_NOTES + "), " - + "KEY_GESTURE_TYPE_TOGGLE_POWER(" + KEY_GESTURE_TYPE_TOGGLE_POWER + "), " - + "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION(" + KEY_GESTURE_TYPE_SYSTEM_NAVIGATION + "), " - + "KEY_GESTURE_TYPE_SLEEP(" + KEY_GESTURE_TYPE_SLEEP + "), " - + "KEY_GESTURE_TYPE_WAKEUP(" + KEY_GESTURE_TYPE_WAKEUP + "), " - + "KEY_GESTURE_TYPE_MEDIA_KEY(" + KEY_GESTURE_TYPE_MEDIA_KEY + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS + "), " - + "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME(" + KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME + "), " - + "KEY_GESTURE_TYPE_DESKTOP_MODE(" + KEY_GESTURE_TYPE_DESKTOP_MODE + "), " - + "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION(" + KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION + ")"); + private static String keyGestureTypeToString(@KeyGestureType int value) { + switch (value) { + case KEY_GESTURE_TYPE_UNSPECIFIED: + return "KEY_GESTURE_TYPE_UNSPECIFIED"; + case KEY_GESTURE_TYPE_HOME: + return "KEY_GESTURE_TYPE_HOME"; + case KEY_GESTURE_TYPE_RECENT_APPS: + return "KEY_GESTURE_TYPE_RECENT_APPS"; + case KEY_GESTURE_TYPE_BACK: + return "KEY_GESTURE_TYPE_BACK"; + case KEY_GESTURE_TYPE_APP_SWITCH: + return "KEY_GESTURE_TYPE_APP_SWITCH"; + case KEY_GESTURE_TYPE_LAUNCH_ASSISTANT: + return "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT"; + case KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT: + return "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT"; + case KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS: + return "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS"; + case KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL: + return "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL"; + case KEY_GESTURE_TYPE_TOGGLE_TASKBAR: + return "KEY_GESTURE_TYPE_TOGGLE_TASKBAR"; + case KEY_GESTURE_TYPE_TAKE_SCREENSHOT: + return "KEY_GESTURE_TYPE_TAKE_SCREENSHOT"; + case KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER: + return "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER"; + case KEY_GESTURE_TYPE_BRIGHTNESS_UP: + return "KEY_GESTURE_TYPE_BRIGHTNESS_UP"; + case KEY_GESTURE_TYPE_BRIGHTNESS_DOWN: + return "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN"; + case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP: + return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP"; + case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN: + return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN"; + case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE: + return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE"; + case KEY_GESTURE_TYPE_VOLUME_UP: + return "KEY_GESTURE_TYPE_VOLUME_UP"; + case KEY_GESTURE_TYPE_VOLUME_DOWN: + return "KEY_GESTURE_TYPE_VOLUME_DOWN"; + case KEY_GESTURE_TYPE_VOLUME_MUTE: + return "KEY_GESTURE_TYPE_VOLUME_MUTE"; + case KEY_GESTURE_TYPE_ALL_APPS: + return "KEY_GESTURE_TYPE_ALL_APPS"; + case KEY_GESTURE_TYPE_LAUNCH_SEARCH: + return "KEY_GESTURE_TYPE_LAUNCH_SEARCH"; + case KEY_GESTURE_TYPE_LANGUAGE_SWITCH: + return "KEY_GESTURE_TYPE_LANGUAGE_SWITCH"; + case KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS: + return "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS"; + case KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK: + return "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK"; + case KEY_GESTURE_TYPE_SYSTEM_MUTE: + return "KEY_GESTURE_TYPE_SYSTEM_MUTE"; + case KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION: + return "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION"; + case KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS: + return "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS"; + case KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT: + return "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT"; + case KEY_GESTURE_TYPE_LOCK_SCREEN: + return "KEY_GESTURE_TYPE_LOCK_SCREEN"; + case KEY_GESTURE_TYPE_OPEN_NOTES: + return "KEY_GESTURE_TYPE_OPEN_NOTES"; + case KEY_GESTURE_TYPE_TOGGLE_POWER: + return "KEY_GESTURE_TYPE_TOGGLE_POWER"; + case KEY_GESTURE_TYPE_SYSTEM_NAVIGATION: + return "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION"; + case KEY_GESTURE_TYPE_SLEEP: + return "KEY_GESTURE_TYPE_SLEEP"; + case KEY_GESTURE_TYPE_WAKEUP: + return "KEY_GESTURE_TYPE_WAKEUP"; + case KEY_GESTURE_TYPE_MEDIA_KEY: + return "KEY_GESTURE_TYPE_MEDIA_KEY"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS"; + case KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME: + return "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME"; + case KEY_GESTURE_TYPE_DESKTOP_MODE: + return "KEY_GESTURE_TYPE_DESKTOP_MODE"; + case KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION: + return "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION"; + default: + return Integer.toHexString(value); } - - - // onConstructed(); // You can define this method to get a callback - } - - @DataClass.Generated.Member - public int getDeviceId() { - return mDeviceId; } - - @DataClass.Generated.Member - public @NonNull int[] getKeycodes() { - return mKeycodes; - } - - @DataClass.Generated.Member - public int getModifierState() { - return mModifierState; - } - - @DataClass.Generated.Member - public @KeyGestureType int getKeyGestureType() { - return mKeyGestureType; - } - - @Override - @DataClass.Generated.Member - public String toString() { - // You can override field toString logic by defining methods like: - // String fieldNameToString() { ... } - - return "KeyGestureEvent { " + - "deviceId = " + mDeviceId + ", " + - "keycodes = " + java.util.Arrays.toString(mKeycodes) + ", " + - "modifierState = " + mModifierState + ", " + - "keyGestureType = " + keyGestureTypeToString(mKeyGestureType) + - " }"; - } - - @Override - @DataClass.Generated.Member - public boolean equals(@Nullable Object o) { - // You can override field equality logic by defining either of the methods like: - // boolean fieldNameEquals(KeyGestureEvent other) { ... } - // boolean fieldNameEquals(FieldType otherValue) { ... } - - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - @SuppressWarnings("unchecked") - KeyGestureEvent that = (KeyGestureEvent) o; - //noinspection PointlessBooleanExpression - return true - && mDeviceId == that.mDeviceId - && java.util.Arrays.equals(mKeycodes, that.mKeycodes) - && mModifierState == that.mModifierState - && mKeyGestureType == that.mKeyGestureType; - } - - @Override - @DataClass.Generated.Member - public int hashCode() { - // You can override field hashCode logic by defining methods like: - // int fieldNameHashCode() { ... } - - int _hash = 1; - _hash = 31 * _hash + mDeviceId; - _hash = 31 * _hash + java.util.Arrays.hashCode(mKeycodes); - _hash = 31 * _hash + mModifierState; - _hash = 31 * _hash + mKeyGestureType; - return _hash; - } - - @DataClass.Generated( - time = 1723409092192L, - codegenVersion = "1.0.23", - sourceFile = "frameworks/base/core/java/android/hardware/input/KeyGestureEvent.java", - inputSignatures = "private final int mDeviceId\nprivate final @android.annotation.NonNull int[] mKeycodes\nprivate final int mModifierState\nprivate final @android.hardware.input.KeyGestureEvent.KeyGestureType int mKeyGestureType\npublic static final int KEY_GESTURE_TYPE_UNSPECIFIED\npublic static final int KEY_GESTURE_TYPE_HOME\npublic static final int KEY_GESTURE_TYPE_RECENT_APPS\npublic static final int KEY_GESTURE_TYPE_BACK\npublic static final int KEY_GESTURE_TYPE_APP_SWITCH\npublic static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT\npublic static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT\npublic static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS\npublic static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL\npublic static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR\npublic static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT\npublic static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER\npublic static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP\npublic static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE\npublic static final int KEY_GESTURE_TYPE_VOLUME_UP\npublic static final int KEY_GESTURE_TYPE_VOLUME_DOWN\npublic static final int KEY_GESTURE_TYPE_VOLUME_MUTE\npublic static final int KEY_GESTURE_TYPE_ALL_APPS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH\npublic static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH\npublic static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS\npublic static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK\npublic static final int KEY_GESTURE_TYPE_SYSTEM_MUTE\npublic static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION\npublic static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS\npublic static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT\npublic static final int KEY_GESTURE_TYPE_LOCK_SCREEN\npublic static final int KEY_GESTURE_TYPE_OPEN_NOTES\npublic static final int KEY_GESTURE_TYPE_TOGGLE_POWER\npublic static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION\npublic static final int KEY_GESTURE_TYPE_SLEEP\npublic static final int KEY_GESTURE_TYPE_WAKEUP\npublic static final int KEY_GESTURE_TYPE_MEDIA_KEY\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME\npublic static final int KEY_GESTURE_TYPE_DESKTOP_MODE\npublic static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION\nclass KeyGestureEvent extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genToString=true, genEqualsHashCode=true)") - @Deprecated - private void __metadata() {} - - - //@formatter:on - // End of generated code - } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt index 25c533685ba7..64915fbf551f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt @@ -261,12 +261,12 @@ class KeyboardTouchpadEduInteractorTest : SysuiTestCase() { .registerKeyGestureEventListener(any(), listenerCaptor.capture()) val allAppsKeyGestureEvent = - KeyGestureEvent( - /* deviceId= */ 1, - IntArray(0), - KeyEvent.META_META_ON, - KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS - ) + KeyGestureEvent.Builder() + .setDeviceId(1) + .setModifierState(KeyEvent.META_META_ON) + .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS) + .setAction(KeyGestureEvent.ACTION_GESTURE_COMPLETE) + .build() listenerCaptor.value.onKeyGestureEvent(allAppsKeyGestureEvent) val model by diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 1285a61d08f2..5dc1dda3b5ab 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -52,6 +52,7 @@ import android.hardware.input.IInputDevicesChangedListener; import android.hardware.input.IInputManager; import android.hardware.input.IInputSensorEventListener; import android.hardware.input.IKeyGestureEventListener; +import android.hardware.input.IKeyGestureHandler; import android.hardware.input.IKeyboardBacklightListener; import android.hardware.input.IStickyModifierStateListener; import android.hardware.input.ITabletModeChangedListener; @@ -164,7 +165,6 @@ public class InputManagerService extends IInputManager.Stub private static final int MSG_DELIVER_INPUT_DEVICES_CHANGED = 1; private static final int MSG_RELOAD_DEVICE_ALIASES = 2; private static final int MSG_DELIVER_TABLET_MODE_CHANGED = 3; - private static final int MSG_KEY_GESTURE_COMPLETED = 4; private static final int DEFAULT_VIBRATION_MAGNITUDE = 192; private static final AdditionalDisplayInputProperties @@ -476,7 +476,7 @@ public class InputManagerService extends IInputManager.Stub injector.getLooper(), injector.getUEventManager()) : new KeyboardBacklightControllerInterface() {}; mStickyModifierStateController = new StickyModifierStateController(); - mKeyGestureController = new KeyGestureController(); + mKeyGestureController = new KeyGestureController(mContext, injector.getLooper()); mKeyboardLedController = new KeyboardLedController(mContext, injector.getLooper(), mNative); mKeyRemapper = new KeyRemapper(mContext, mNative, mDataStore, injector.getLooper()); @@ -2464,6 +2464,11 @@ public class InputManagerService extends IInputManager.Stub // Native callback. @SuppressWarnings("unused") private long interceptKeyBeforeDispatching(IBinder focus, KeyEvent event, int policyFlags) { + // TODO(b/358569822): Move shortcut trigger logic from PWM to KeyGestureController + long value = mKeyGestureController.interceptKeyBeforeDispatching(focus, event, policyFlags); + if (value != 0) { // If key is consumed (i.e. non-zero value) + return value; + } return mWindowManagerCallbacks.interceptKeyBeforeDispatching(focus, event, policyFlags); } @@ -2769,33 +2774,38 @@ public class InputManagerService extends IInputManager.Stub @Override @PermissionManuallyEnforced - public void registerKeyGestureEventListener( - @NonNull IKeyGestureEventListener listener) { + public void registerKeyGestureEventListener(@NonNull IKeyGestureEventListener listener) { enforceManageKeyGesturePermission(); Objects.requireNonNull(listener); - mKeyGestureController.registerKeyGestureEventListener(listener, - Binder.getCallingPid()); + mKeyGestureController.registerKeyGestureEventListener(listener, Binder.getCallingPid()); } @Override @PermissionManuallyEnforced - public void unregisterKeyGestureEventListener( - @NonNull IKeyGestureEventListener listener) { + public void unregisterKeyGestureEventListener(@NonNull IKeyGestureEventListener listener) { enforceManageKeyGesturePermission(); Objects.requireNonNull(listener); - mKeyGestureController.unregisterKeyGestureEventListener(listener, - Binder.getCallingPid()); + mKeyGestureController.unregisterKeyGestureEventListener(listener, Binder.getCallingPid()); } - private void handleKeyGestureCompleted(KeyGestureEvent event) { - InputDevice device = getInputDevice(event.getDeviceId()); - if (device == null || device.isVirtual()) { - return; - } - KeyboardMetricsCollector.logKeyboardSystemsEventReportedAtom(device, event); - mKeyGestureController.onKeyGestureEvent(event); + @Override + @PermissionManuallyEnforced + public void registerKeyGestureHandler(@NonNull IKeyGestureHandler handler) { + enforceManageKeyGesturePermission(); + + Objects.requireNonNull(handler); + mKeyGestureController.registerKeyGestureHandler(handler, Binder.getCallingPid()); + } + + @Override + @PermissionManuallyEnforced + public void unregisterKeyGestureHandler(@NonNull IKeyGestureHandler handler) { + enforceManageKeyGesturePermission(); + + Objects.requireNonNull(handler); + mKeyGestureController.unregisterKeyGestureHandler(handler, Binder.getCallingPid()); } /** @@ -2966,9 +2976,6 @@ public class InputManagerService extends IInputManager.Stub boolean inTabletMode = (boolean) args.arg1; deliverTabletModeChanged(whenNanos, inTabletMode); break; - case MSG_KEY_GESTURE_COMPLETED: - KeyGestureEvent event = (KeyGestureEvent) msg.obj; - handleKeyGestureCompleted(event); } } } @@ -3298,9 +3305,8 @@ public class InputManagerService extends IInputManager.Stub @Override public void notifyKeyGestureCompleted(int deviceId, int[] keycodes, int modifierState, @KeyGestureEvent.KeyGestureType int gestureType) { - mHandler.obtainMessage(MSG_KEY_GESTURE_COMPLETED, - new KeyGestureEvent(deviceId, keycodes, modifierState, - gestureType)).sendToTarget(); + mKeyGestureController.notifyKeyGestureCompleted(deviceId, keycodes, modifierState, + gestureType); } } diff --git a/services/core/java/com/android/server/input/KeyGestureController.java b/services/core/java/com/android/server/input/KeyGestureController.java index 674d3c448c86..bfdb1c1f4ea9 100644 --- a/services/core/java/com/android/server/input/KeyGestureController.java +++ b/services/core/java/com/android/server/input/KeyGestureController.java @@ -17,15 +17,32 @@ package com.android.server.input; import android.annotation.BinderThread; +import android.annotation.MainThread; +import android.annotation.Nullable; +import android.content.Context; +import android.hardware.input.AidlKeyGestureEvent; import android.hardware.input.IKeyGestureEventListener; +import android.hardware.input.IKeyGestureHandler; +import android.hardware.input.InputManager; import android.hardware.input.KeyGestureEvent; +import android.os.Handler; import android.os.IBinder; +import android.os.Looper; +import android.os.Message; +import android.os.Process; import android.os.RemoteException; import android.util.Log; import android.util.Slog; import android.util.SparseArray; +import android.view.Display; +import android.view.InputDevice; +import android.view.KeyEvent; import com.android.internal.annotations.GuardedBy; +import com.android.internal.annotations.VisibleForTesting; + +import java.util.Objects; +import java.util.TreeMap; /** * A thread-safe component of {@link InputManagerService} responsible for managing callbacks when a @@ -39,12 +56,101 @@ final class KeyGestureController { // 'adb shell setprop log.tag.KeyGestureController DEBUG' (requires restart) private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); + private static final int MSG_NOTIFY_KEY_GESTURE_EVENT = 1; + + private final Context mContext; + private final Handler mHandler; + private final int mSystemPid; + // List of currently registered key gesture event listeners keyed by process pid @GuardedBy("mKeyGestureEventListenerRecords") private final SparseArray mKeyGestureEventListenerRecords = new SparseArray<>(); - public void onKeyGestureEvent(KeyGestureEvent event) { + // List of currently registered key gesture event handler keyed by process pid. The map sorts + // in the order of preference of the handlers, and we prioritize handlers in system server + // over external handlers.. + @GuardedBy("mKeyGestureHandlerRecords") + private final TreeMap mKeyGestureHandlerRecords; + + KeyGestureController(Context context, Looper looper) { + mContext = context; + mHandler = new Handler(looper, this::handleMessage); + mSystemPid = Process.myPid(); + mKeyGestureHandlerRecords = new TreeMap<>((p1, p2) -> { + if (Objects.equals(p1, p2)) { + return 0; + } + if (p1 == mSystemPid) { + return -1; + } else if (p2 == mSystemPid) { + return 1; + } else { + return Integer.compare(p1, p2); + } + }); + } + + public int interceptKeyBeforeDispatching(IBinder focus, KeyEvent event, int policyFlags) { + // TODO(b/358569822): Handle shortcuts trigger logic here and pass it to appropriate + // KeyGestureHandler (PWM is one of the handlers) + return 0; + } + + @VisibleForTesting + boolean handleKeyGesture(int deviceId, int[] keycodes, int modifierState, + @KeyGestureEvent.KeyGestureType int gestureType, int action, int displayId, + IBinder focusedToken, int flags) { + AidlKeyGestureEvent event = createKeyGestureEvent(deviceId, keycodes, + modifierState, gestureType, action, displayId, flags); + synchronized (mKeyGestureHandlerRecords) { + for (KeyGestureHandlerRecord handler : mKeyGestureHandlerRecords.values()) { + if (handler.handleKeyGesture(event, focusedToken)) { + Message msg = Message.obtain(mHandler, MSG_NOTIFY_KEY_GESTURE_EVENT, event); + mHandler.sendMessage(msg); + return true; + } + } + } + return false; + } + + private boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType) { + synchronized (mKeyGestureHandlerRecords) { + for (KeyGestureHandlerRecord handler : mKeyGestureHandlerRecords.values()) { + if (handler.isKeyGestureSupported(gestureType)) { + return true; + } + } + } + return false; + } + + public void notifyKeyGestureCompleted(int deviceId, int[] keycodes, int modifierState, + @KeyGestureEvent.KeyGestureType int gestureType) { + // TODO(b/358569822): Once we move the gesture detection logic to IMS, we ideally + // should not rely on PWM to tell us about the gesture start and end. + AidlKeyGestureEvent event = createKeyGestureEvent(deviceId, keycodes, modifierState, + gestureType, KeyGestureEvent.ACTION_GESTURE_COMPLETE, Display.DEFAULT_DISPLAY, 0); + mHandler.obtainMessage(MSG_NOTIFY_KEY_GESTURE_EVENT, event).sendToTarget(); + } + + @MainThread + private void notifyKeyGestureEvent(AidlKeyGestureEvent event) { + InputDevice device = getInputDevice(event.deviceId); + if (device == null || device.isVirtual()) { + return; + } + if (event.action == KeyGestureEvent.ACTION_GESTURE_COMPLETE) { + KeyboardMetricsCollector.logKeyboardSystemsEventReportedAtom(device, event.keycodes, + event.modifierState, + KeyGestureEvent.keyGestureTypeToLogEvent(event.gestureType)); + } + notifyAllListeners(event); + } + + @MainThread + private void notifyAllListeners(AidlKeyGestureEvent event) { if (DEBUG) { Slog.d(TAG, "Key gesture event occurred, event = " + event); } @@ -56,17 +162,26 @@ final class KeyGestureController { } } + @MainThread + private boolean handleMessage(Message msg) { + switch (msg.what) { + case MSG_NOTIFY_KEY_GESTURE_EVENT: + AidlKeyGestureEvent event = (AidlKeyGestureEvent) msg.obj; + notifyKeyGestureEvent(event); + break; + } + return true; + } + /** Register the key gesture event listener for a process. */ @BinderThread - public void registerKeyGestureEventListener(IKeyGestureEventListener listener, - int pid) { + public void registerKeyGestureEventListener(IKeyGestureEventListener listener, int pid) { synchronized (mKeyGestureEventListenerRecords) { if (mKeyGestureEventListenerRecords.get(pid) != null) { throw new IllegalStateException("The calling process has already registered " + "a KeyGestureEventListener."); } - KeyGestureEventListenerRecord record = new KeyGestureEventListenerRecord( - pid, listener); + KeyGestureEventListenerRecord record = new KeyGestureEventListenerRecord(pid, listener); try { listener.asBinder().linkToDeath(record, 0); } catch (RemoteException ex) { @@ -78,8 +193,7 @@ final class KeyGestureController { /** Unregister the key gesture event listener for a process. */ @BinderThread - public void unregisterKeyGestureEventListener(IKeyGestureEventListener listener, - int pid) { + public void unregisterKeyGestureEventListener(IKeyGestureEventListener listener, int pid) { synchronized (mKeyGestureEventListenerRecords) { KeyGestureEventListenerRecord record = mKeyGestureEventListenerRecords.get(pid); @@ -120,10 +234,9 @@ final class KeyGestureController { onKeyGestureEventListenerDied(mPid); } - public void onKeyGestureEvent(KeyGestureEvent event) { + public void onKeyGestureEvent(AidlKeyGestureEvent event) { try { - mListener.onKeyGestureEvent(event.getDeviceId(), event.getKeycodes(), - event.getModifierState(), event.getKeyGestureType()); + mListener.onKeyGestureEvent(event); } catch (RemoteException ex) { Slog.w(TAG, "Failed to notify process " + mPid + " that key gesture event occurred, assuming it died.", ex); @@ -131,4 +244,107 @@ final class KeyGestureController { } } } + + /** Register the key gesture event handler for a process. */ + @BinderThread + public void registerKeyGestureHandler(IKeyGestureHandler handler, int pid) { + synchronized (mKeyGestureHandlerRecords) { + if (mKeyGestureHandlerRecords.get(pid) != null) { + throw new IllegalStateException("The calling process has already registered " + + "a KeyGestureHandler."); + } + KeyGestureHandlerRecord record = new KeyGestureHandlerRecord(pid, handler); + try { + handler.asBinder().linkToDeath(record, 0); + } catch (RemoteException ex) { + throw new RuntimeException(ex); + } + mKeyGestureHandlerRecords.put(pid, record); + } + } + + /** Unregister the key gesture event handler for a process. */ + @BinderThread + public void unregisterKeyGestureHandler(IKeyGestureHandler handler, int pid) { + synchronized (mKeyGestureHandlerRecords) { + KeyGestureHandlerRecord record = mKeyGestureHandlerRecords.get(pid); + if (record == null) { + throw new IllegalStateException("The calling process has no registered " + + "KeyGestureHandler."); + } + if (record.mKeyGestureHandler.asBinder() != handler.asBinder()) { + throw new IllegalStateException("The calling process has a different registered " + + "KeyGestureHandler."); + } + record.mKeyGestureHandler.asBinder().unlinkToDeath(record, 0); + mKeyGestureHandlerRecords.remove(pid); + } + } + + private void onKeyGestureHandlerDied(int pid) { + synchronized (mKeyGestureHandlerRecords) { + mKeyGestureHandlerRecords.remove(pid); + } + } + + // A record of a registered key gesture event listener from one process. + private class KeyGestureHandlerRecord implements IBinder.DeathRecipient { + public final int mPid; + public final IKeyGestureHandler mKeyGestureHandler; + + KeyGestureHandlerRecord(int pid, IKeyGestureHandler keyGestureHandler) { + mPid = pid; + mKeyGestureHandler = keyGestureHandler; + } + + @Override + public void binderDied() { + if (DEBUG) { + Slog.d(TAG, "Key gesture event handler for pid " + mPid + " died."); + } + onKeyGestureHandlerDied(mPid); + } + + public boolean handleKeyGesture(AidlKeyGestureEvent event, IBinder focusedToken) { + try { + return mKeyGestureHandler.handleKeyGesture(event, focusedToken); + } catch (RemoteException ex) { + Slog.w(TAG, "Failed to send key gesture to process " + mPid + + ", assuming it died.", ex); + binderDied(); + } + return false; + } + + public boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType) { + try { + return mKeyGestureHandler.isKeyGestureSupported(gestureType); + } catch (RemoteException ex) { + Slog.w(TAG, "Failed to identify if key gesture type is supported by the " + + "process " + mPid + ", assuming it died.", ex); + binderDied(); + } + return false; + } + } + + @Nullable + private InputDevice getInputDevice(int deviceId) { + InputManager inputManager = mContext.getSystemService(InputManager.class); + return inputManager != null ? inputManager.getInputDevice(deviceId) : null; + } + + private AidlKeyGestureEvent createKeyGestureEvent(int deviceId, int[] keycodes, + int modifierState, @KeyGestureEvent.KeyGestureType int gestureType, int action, + int displayId, int flags) { + AidlKeyGestureEvent event = new AidlKeyGestureEvent(); + event.deviceId = deviceId; + event.keycodes = keycodes; + event.modifierState = modifierState; + event.gestureType = gestureType; + event.action = action; + event.displayId = displayId; + event.flags = flags; + return event; + } } diff --git a/services/core/java/com/android/server/input/KeyboardMetricsCollector.java b/services/core/java/com/android/server/input/KeyboardMetricsCollector.java index 1daf4db699aa..609164a48687 100644 --- a/services/core/java/com/android/server/input/KeyboardMetricsCollector.java +++ b/services/core/java/com/android/server/input/KeyboardMetricsCollector.java @@ -24,7 +24,6 @@ import static android.hardware.input.KeyboardLayoutSelectionResult.layoutSelecti import android.annotation.NonNull; import android.annotation.Nullable; -import android.hardware.input.KeyGestureEvent; import android.hardware.input.KeyboardLayout; import android.hardware.input.KeyboardLayoutSelectionResult.LayoutSelectionCriteria; import android.icu.util.ULocale; @@ -41,6 +40,7 @@ import com.android.internal.os.KeyboardConfiguredProto.RepeatedKeyboardLayoutCon import com.android.internal.util.FrameworkStatsLog; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -60,23 +60,26 @@ public final class KeyboardMetricsCollector { @VisibleForTesting public static final String DEFAULT_LANGUAGE_TAG = "None"; + private static final int INVALID_SYSTEMS_EVENT = FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__UNSPECIFIED; + /** * Log keyboard system shortcuts for the proto * {@link com.android.os.input.KeyboardSystemsEventReported} * defined in "stats/atoms/input/input_extension_atoms.proto" */ public static void logKeyboardSystemsEventReportedAtom(@NonNull InputDevice inputDevice, - @NonNull KeyGestureEvent keyGestureEvent) { - if (inputDevice.isVirtual() || !inputDevice.isFullKeyboard()) { + int[] keycodes, int modifierState, int systemsEvent) { + if (systemsEvent == INVALID_SYSTEMS_EVENT || inputDevice.isVirtual() + || !inputDevice.isFullKeyboard()) { return; } FrameworkStatsLog.write(FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED, inputDevice.getVendorId(), inputDevice.getProductId(), - keyGestureEvent.getKeyGestureType(), keyGestureEvent.getKeycodes(), - keyGestureEvent.getModifierState(), inputDevice.getDeviceBus()); + systemsEvent, keycodes, modifierState, inputDevice.getDeviceBus()); if (DEBUG) { - Slog.d(TAG, "Logging Keyboard system event: " + keyGestureEvent); + Slog.d(TAG, "Logging Keyboard system event: " + modifierState + " + " + Arrays.toString( + keycodes) + " -> " + systemsEvent); } } diff --git a/tests/Input/src/android/hardware/input/KeyGestureEventHandlerTest.kt b/tests/Input/src/android/hardware/input/KeyGestureEventHandlerTest.kt new file mode 100644 index 000000000000..072341dcefae --- /dev/null +++ b/tests/Input/src/android/hardware/input/KeyGestureEventHandlerTest.kt @@ -0,0 +1,236 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.input + +import android.content.Context +import android.content.ContextWrapper +import android.os.Handler +import android.os.IBinder +import android.os.test.TestLooper +import android.platform.test.annotations.Presubmit +import android.platform.test.flag.junit.SetFlagsRule +import android.view.KeyEvent +import androidx.test.core.app.ApplicationProvider +import com.android.server.testutils.any +import org.junit.After +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.Mock +import org.mockito.Mockito +import org.mockito.Mockito.doAnswer +import org.mockito.Mockito.`when` +import org.mockito.junit.MockitoJUnitRunner +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull +import kotlin.test.fail + +/** + * Tests for [InputManager.KeyGestureEventHandler]. + * + * Build/Install/Run: + * atest InputTests:KeyGestureEventHandlerTest + */ +@Presubmit +@RunWith(MockitoJUnitRunner::class) +class KeyGestureEventHandlerTest { + + companion object { + const val DEVICE_ID = 1 + val HOME_GESTURE_EVENT = KeyGestureEvent.Builder() + .setDeviceId(DEVICE_ID) + .setKeycodes(intArrayOf(KeyEvent.KEYCODE_H)) + .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON) + .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_HOME) + .build() + val BACK_GESTURE_EVENT = KeyGestureEvent.Builder() + .setDeviceId(DEVICE_ID) + .setKeycodes(intArrayOf(KeyEvent.KEYCODE_DEL)) + .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON) + .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_BACK) + .build() + } + + @get:Rule + val rule = SetFlagsRule() + + private val testLooper = TestLooper() + private var registeredListener: IKeyGestureHandler? = null + private lateinit var context: Context + private lateinit var inputManager: InputManager + private lateinit var inputManagerGlobalSession: InputManagerGlobal.TestSession + + @Mock + private lateinit var iInputManagerMock: IInputManager + + @Before + fun setUp() { + context = Mockito.spy(ContextWrapper(ApplicationProvider.getApplicationContext())) + inputManagerGlobalSession = InputManagerGlobal.createTestSession(iInputManagerMock) + inputManager = InputManager(context) + `when`(context.getSystemService(Mockito.eq(Context.INPUT_SERVICE))) + .thenReturn(inputManager) + + // Handle key gesture handler registration. + doAnswer { + val listener = it.getArgument(0) as IKeyGestureHandler + if (registeredListener != null && + registeredListener!!.asBinder() != listener.asBinder()) { + // There can only be one registered key gesture handler per process. + fail("Trying to register a new listener when one already exists") + } + registeredListener = listener + null + }.`when`(iInputManagerMock).registerKeyGestureHandler(any()) + + // Handle key gesture handler being unregistered. + doAnswer { + val listener = it.getArgument(0) as IKeyGestureHandler + if (registeredListener == null || + registeredListener!!.asBinder() != listener.asBinder()) { + fail("Trying to unregister a listener that is not registered") + } + registeredListener = null + null + }.`when`(iInputManagerMock).unregisterKeyGestureHandler(any()) + } + + @After + fun tearDown() { + if (this::inputManagerGlobalSession.isInitialized) { + inputManagerGlobalSession.close() + } + } + + private fun handleKeyGestureEvent(event: KeyGestureEvent) { + val eventToSend = AidlKeyGestureEvent() + eventToSend.deviceId = event.deviceId + eventToSend.keycodes = event.keycodes + eventToSend.modifierState = event.modifierState + eventToSend.gestureType = event.keyGestureType + eventToSend.action = event.action + eventToSend.displayId = event.displayId + eventToSend.flags = event.flags + registeredListener!!.handleKeyGesture(eventToSend, null) + } + + @Test + fun testHandlerHasCorrectGestureNotified() { + var callbackCount = 0 + + // Add a key gesture event listener + inputManager.registerKeyGestureEventHandler(KeyGestureHandler { event, _ -> + assertEquals(HOME_GESTURE_EVENT, event) + callbackCount++ + true + }) + + // Request handling for key gesture event will notify the handler. + handleKeyGestureEvent(HOME_GESTURE_EVENT) + assertEquals(1, callbackCount) + } + + @Test + fun testAddingHandlersRegistersInternalCallbackHandler() { + // Set up two callbacks. + val callback1 = KeyGestureHandler { _, _ -> false } + val callback2 = KeyGestureHandler { _, _ -> false } + + assertNull(registeredListener) + + // Adding the handler should register the callback with InputManagerService. + inputManager.registerKeyGestureEventHandler(callback1) + assertNotNull(registeredListener) + + // Adding another handler should not register new internal listener. + val currListener = registeredListener + inputManager.registerKeyGestureEventHandler(callback2) + assertEquals(currListener, registeredListener) + } + + @Test + fun testRemovingHandlersUnregistersInternalCallbackHandler() { + // Set up two callbacks. + val callback1 = KeyGestureHandler { _, _ -> false } + val callback2 = KeyGestureHandler { _, _ -> false } + + inputManager.registerKeyGestureEventHandler(callback1) + inputManager.registerKeyGestureEventHandler(callback2) + + // Only removing all handlers should remove the internal callback + inputManager.unregisterKeyGestureEventHandler(callback1) + assertNotNull(registeredListener) + inputManager.unregisterKeyGestureEventHandler(callback2) + assertNull(registeredListener) + } + + @Test + fun testMultipleHandlers() { + // Set up two callbacks. + var callbackCount1 = 0 + var callbackCount2 = 0 + // Handler 1 captures all home gestures + val callback1 = KeyGestureHandler { event, _ -> + callbackCount1++ + event.keyGestureType == KeyGestureEvent.KEY_GESTURE_TYPE_HOME + } + // Handler 2 captures all gestures + val callback2 = KeyGestureHandler { _, _ -> + callbackCount2++ + true + } + + // Add both key gesture event handlers + inputManager.registerKeyGestureEventHandler(callback1) + inputManager.registerKeyGestureEventHandler(callback2) + + // Request handling for key gesture event, should notify callbacks in order. So, only the + // first handler should receive a callback since it captures the event. + handleKeyGestureEvent(HOME_GESTURE_EVENT) + assertEquals(1, callbackCount1) + assertEquals(0, callbackCount2) + + // Second handler should receive the event since the first handler doesn't capture the event + handleKeyGestureEvent(BACK_GESTURE_EVENT) + assertEquals(2, callbackCount1) + assertEquals(1, callbackCount2) + + inputManager.unregisterKeyGestureEventHandler(callback1) + // Request handling for key gesture event, should still trigger callback2 but not callback1. + handleKeyGestureEvent(HOME_GESTURE_EVENT) + assertEquals(2, callbackCount1) + assertEquals(2, callbackCount2) + } + + inner class KeyGestureHandler( + private var handler: (event: KeyGestureEvent, token: IBinder?) -> Boolean + ) : InputManager.KeyGestureEventHandler { + + override fun handleKeyGestureEvent( + event: KeyGestureEvent, + focusedToken: IBinder? + ): Boolean { + return handler(event, focusedToken) + } + + override fun isKeyGestureSupported(gestureType: Int): Boolean { + return true + } + } +} diff --git a/tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt b/tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt index 14aac6637d4f..ca9de6000a5a 100644 --- a/tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt +++ b/tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt @@ -53,12 +53,12 @@ class KeyGestureEventListenerTest { companion object { const val DEVICE_ID = 1 - val HOME_GESTURE_EVENT = KeyGestureEvent( - DEVICE_ID, - intArrayOf(KeyEvent.KEYCODE_H), - KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON, - KeyGestureEvent.KEY_GESTURE_TYPE_HOME - ) + val HOME_GESTURE_EVENT = KeyGestureEvent.Builder() + .setDeviceId(DEVICE_ID) + .setKeycodes(intArrayOf(KeyEvent.KEYCODE_H)) + .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON) + .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_HOME) + .build() } @get:Rule @@ -114,12 +114,15 @@ class KeyGestureEventListenerTest { } private fun notifyKeyGestureEvent(event: KeyGestureEvent) { - registeredListener!!.onKeyGestureEvent( - event.deviceId, - event.keycodes, - event.modifierState, - event.keyGestureType - ) + val eventToSend = AidlKeyGestureEvent() + eventToSend.deviceId = event.deviceId + eventToSend.keycodes = event.keycodes + eventToSend.modifierState = event.modifierState + eventToSend.gestureType = event.keyGestureType + eventToSend.action = event.action + eventToSend.displayId = event.displayId + eventToSend.flags = event.flags + registeredListener!!.onKeyGestureEvent(eventToSend) } @Test diff --git a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt index 3f611e0ead53..e12679742224 100644 --- a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt +++ b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt @@ -18,18 +18,28 @@ package com.android.server.input import android.content.Context import android.content.ContextWrapper +import android.hardware.input.IInputManager +import android.hardware.input.AidlKeyGestureEvent import android.hardware.input.IKeyGestureEventListener +import android.hardware.input.IKeyGestureHandler +import android.hardware.input.InputManager +import android.hardware.input.InputManagerGlobal import android.hardware.input.KeyGestureEvent +import android.os.IBinder +import android.os.Process +import android.os.test.TestLooper import android.platform.test.annotations.Presubmit +import android.view.InputDevice import android.view.KeyEvent import androidx.test.core.app.ApplicationProvider +import com.android.internal.util.FrameworkStatsLog +import com.android.modules.utils.testing.ExtendedMockitoRule import org.junit.Assert.assertEquals -import org.junit.Assert.assertNull import org.junit.Before import org.junit.Rule import org.junit.Test +import org.mockito.Mock import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit /** * Tests for {@link KeyGestureController}. @@ -41,26 +51,55 @@ import org.mockito.junit.MockitoJUnit class KeyGestureControllerTests { companion object { - val DEVICE_ID = 1 - val HOME_GESTURE_EVENT = KeyGestureEvent( - DEVICE_ID, - intArrayOf(KeyEvent.KEYCODE_H), - KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON, - KeyGestureEvent.KEY_GESTURE_TYPE_HOME - ) + const val DEVICE_ID = 1 + val HOME_GESTURE_COMPLETE_EVENT = KeyGestureEvent.Builder() + .setDeviceId(DEVICE_ID) + .setKeycodes(intArrayOf(KeyEvent.KEYCODE_H)) + .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON) + .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_HOME) + .setAction(KeyGestureEvent.ACTION_GESTURE_COMPLETE) + .build() } - @get:Rule - val rule = MockitoJUnit.rule()!! + @JvmField + @Rule + val extendedMockitoRule = ExtendedMockitoRule.Builder(this) + .mockStatic(FrameworkStatsLog::class.java).build()!! + + @Mock + private lateinit var iInputManager: IInputManager + private var currentPid = 0 private lateinit var keyGestureController: KeyGestureController private lateinit var context: Context - private var lastEvent: KeyGestureEvent? = null + private lateinit var inputManagerGlobalSession: InputManagerGlobal.TestSession + private lateinit var testLooper: TestLooper + private var events = mutableListOf() @Before fun setup() { context = Mockito.spy(ContextWrapper(ApplicationProvider.getApplicationContext())) - keyGestureController = KeyGestureController() + inputManagerGlobalSession = InputManagerGlobal.createTestSession(iInputManager) + setupInputDevices() + testLooper = TestLooper() + currentPid = Process.myPid() + keyGestureController = KeyGestureController(context, testLooper.looper) + } + + private fun setupInputDevices() { + val inputManager = InputManager(context) + Mockito.`when`(context.getSystemService(Mockito.eq(Context.INPUT_SERVICE))) + .thenReturn(inputManager) + + val keyboardDevice = InputDevice.Builder().setId(DEVICE_ID).build() + Mockito.`when`(iInputManager.inputDeviceIds).thenReturn(intArrayOf(DEVICE_ID)) + Mockito.`when`(iInputManager.getInputDevice(DEVICE_ID)).thenReturn(keyboardDevice) + } + + private fun notifyHomeGestureCompleted() { + keyGestureController.notifyKeyGestureCompleted(DEVICE_ID, intArrayOf(KeyEvent.KEYCODE_H), + KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON, + KeyGestureEvent.KEY_GESTURE_TYPE_HOME) } @Test @@ -69,28 +108,97 @@ class KeyGestureControllerTests { // Register key gesture event listener keyGestureController.registerKeyGestureEventListener(listener, 0) - keyGestureController.onKeyGestureEvent(HOME_GESTURE_EVENT) + notifyHomeGestureCompleted() + testLooper.dispatchAll() assertEquals( - "Listener should get callback on key gesture event", - HOME_GESTURE_EVENT, - lastEvent!! + "Listener should get callbacks on key gesture event completed", + 1, + events.size + ) + assertEquals( + "Listener should get callback for key gesture complete event", + HOME_GESTURE_COMPLETE_EVENT, + events[0] ) // Unregister listener - lastEvent = null + events.clear() keyGestureController.unregisterKeyGestureEventListener(listener, 0) - keyGestureController.onKeyGestureEvent(HOME_GESTURE_EVENT) - assertNull("Listener should not get callback after being unregistered", lastEvent) + notifyHomeGestureCompleted() + testLooper.dispatchAll() + assertEquals( + "Listener should not get callback after being unregistered", + 0, + events.size + ) + } + + @Test + fun testKeyGestureEvent_multipleGestureHandlers() { + // Set up two callbacks. + var callbackCount1 = 0 + var callbackCount2 = 0 + var selfCallback = 0 + val externalHandler1 = KeyGestureHandler { _, _ -> + callbackCount1++; + true + } + val externalHandler2 = KeyGestureHandler { _, _ -> + callbackCount2++; + true + } + val selfHandler = KeyGestureHandler { _, _ -> + selfCallback++; + false + } + + // Register key gesture handler: External process (last in priority) + keyGestureController.registerKeyGestureHandler(externalHandler1, currentPid + 1) + + // Register key gesture handler: External process (second in priority) + keyGestureController.registerKeyGestureHandler(externalHandler2, currentPid - 1) + + // Register key gesture handler: Self process (first in priority) + keyGestureController.registerKeyGestureHandler(selfHandler, currentPid) + + keyGestureController.handleKeyGesture(/* deviceId = */ 0, intArrayOf(KeyEvent.KEYCODE_HOME), + /* modifierState = */ 0, KeyGestureEvent.KEY_GESTURE_TYPE_HOME, + KeyGestureEvent.ACTION_GESTURE_COMPLETE, /* displayId */ 0, + /* focusedToken = */ null, /* flags = */ 0 + ) + + assertEquals( + "Self handler should get callbacks first", + 1, + selfCallback + ) + assertEquals( + "Higher priority handler should get callbacks first", + 1, + callbackCount2 + ) + assertEquals( + "Lower priority handler should not get callbacks if already handled", + 0, + callbackCount1 + ) } inner class KeyGestureEventListener : IKeyGestureEventListener.Stub() { - override fun onKeyGestureEvent( - deviceId: Int, - keycodes: IntArray, - modifierState: Int, - gestureType: Int - ) { - lastEvent = KeyGestureEvent(deviceId, keycodes, modifierState, gestureType) + override fun onKeyGestureEvent(event: AidlKeyGestureEvent) { + events.add(KeyGestureEvent(event)) + } + } + + inner class KeyGestureHandler( + private var handler: (event: AidlKeyGestureEvent, token: IBinder?) -> Boolean + ) : IKeyGestureHandler.Stub() { + override fun handleKeyGesture(event: AidlKeyGestureEvent, token: IBinder?): Boolean { + return handler(event, token) + } + + override fun isKeyGestureSupported(gestureType: Int): Boolean { + return true } } } \ No newline at end of file -- GitLab From 5cd621b30394f66edd5ffb217508c52b2c7bb7a9 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 10 Sep 2024 15:32:34 -0700 Subject: [PATCH 232/492] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I4b374a49bf2efdd5b4772f8080598a2480cfd880 --- libs/WindowManager/Shell/res/values-af/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-am/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ar/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-as/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-az/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-b+sr+Latn/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-be/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-bg/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-bn/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-bs/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ca/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-cs/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-da/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-de/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-el/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-en-rAU/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-en-rGB/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-en-rIN/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-et/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-eu/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-fa/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-fi/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-fr-rCA/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-gl/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-gu/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-hi/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-hr/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-hu/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-hy/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-in/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-is/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-iw/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ja/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ka/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-kk/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-km/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-kn/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ko/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ky/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-lo/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-lt/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-lv/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-mk/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ml/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-mn/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-mr/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ms/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-my/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-nb/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ne/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-nl/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-or/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-pa/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-pl/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-pt-rBR/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-pt-rPT/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-pt/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ro/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ru/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-si/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-sk/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-sl/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-sq/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-sr/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-sv/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-sw/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ta/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-te/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-th/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-tl/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-tr/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-uk/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-ur/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-uz/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-vi/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-zh-rCN/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-zh-rHK/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-zh-rTW/strings.xml | 3 +-- libs/WindowManager/Shell/res/values-zu/strings.xml | 3 +-- 79 files changed, 79 insertions(+), 158 deletions(-) diff --git a/libs/WindowManager/Shell/res/values-af/strings.xml b/libs/WindowManager/Shell/res/values-af/strings.xml index 0ed5a72af44c..4dbff346fbac 100644 --- a/libs/WindowManager/Shell/res/values-af/strings.xml +++ b/libs/WindowManager/Shell/res/values-af/strings.xml @@ -73,8 +73,7 @@ "vou %1$s in" "%1$s-instellings" "Maak borrel toe" - - + "Gaan na volskerm" "Moenie dat gesprek \'n borrel word nie" "Klets met borrels" "Nuwe gesprekke verskyn as swerwende ikone, of borrels Tik op borrel om dit oop te maak. Sleep om dit te skuif." diff --git a/libs/WindowManager/Shell/res/values-am/strings.xml b/libs/WindowManager/Shell/res/values-am/strings.xml index c4d9158caf46..d70a317bf36c 100644 --- a/libs/WindowManager/Shell/res/values-am/strings.xml +++ b/libs/WindowManager/Shell/res/values-am/strings.xml @@ -73,8 +73,7 @@ "%1$sን ሰብስብ" "የ%1$s ቅንብሮች" "አረፋን አሰናብት" - - + "ወደ ሙሉ ማያ ገፅ ያንቀሳቅሱ" "ውይይቶችን በአረፋ አታሳይ" "አረፋዎችን በመጠቀም ይወያዩ" "አዲስ ውይይቶች እንደ ተንሳፋፊ አዶዎች ወይም አረፋዎች ሆነው ይታያሉ። አረፋን ለመክፈት መታ ያድርጉ። ለመውሰድ ይጎትቱት።" diff --git a/libs/WindowManager/Shell/res/values-ar/strings.xml b/libs/WindowManager/Shell/res/values-ar/strings.xml index ced9ee95a178..cb316e914d2a 100644 --- a/libs/WindowManager/Shell/res/values-ar/strings.xml +++ b/libs/WindowManager/Shell/res/values-ar/strings.xml @@ -73,8 +73,7 @@ "تصغير %1$s" "إعدادات %1$s" "إغلاق فقاعة المحادثة" - - + "الانتقال إلى وضع ملء الشاشة" "عدم عرض المحادثة كفقاعة محادثة" "الدردشة باستخدام فقاعات المحادثات" "تظهر المحادثات الجديدة كرموز عائمة أو كفقاعات. انقر لفتح فقاعة المحادثة، واسحبها لتحريكها." diff --git a/libs/WindowManager/Shell/res/values-as/strings.xml b/libs/WindowManager/Shell/res/values-as/strings.xml index 273d043c4532..9f7fa7cfd0b9 100644 --- a/libs/WindowManager/Shell/res/values-as/strings.xml +++ b/libs/WindowManager/Shell/res/values-as/strings.xml @@ -73,8 +73,7 @@ "%1$s সংকোচন কৰক" "%1$s ছেটিং" "বাবল অগ্ৰাহ্য কৰক" - - + "পূৰ্ণ স্ক্ৰীনলৈ নিয়ক" "বাৰ্তালাপ বাবল নকৰিব" "Bubbles ব্যৱহাৰ কৰি চাট কৰক" "নতুন বাৰ্তালাপ উপঙি থকা চিহ্নসমূহ অথবা bubbles হিচাপে প্ৰদর্শিত হয়। Bubbles খুলিবলৈ টিপক। এইটো স্থানান্তৰ কৰিবলৈ টানি নিয়ক।" diff --git a/libs/WindowManager/Shell/res/values-az/strings.xml b/libs/WindowManager/Shell/res/values-az/strings.xml index 81bb544217d5..90962f0b5c79 100644 --- a/libs/WindowManager/Shell/res/values-az/strings.xml +++ b/libs/WindowManager/Shell/res/values-az/strings.xml @@ -73,8 +73,7 @@ "yığcamlaşdırın: %1$s" "%1$s ayarları" "Yumrucuğu ləğv edin" - - + "Tam ekrana keçin" "Söhbəti yumrucuqda göstərmə" "Yumrucuqlardan istifadə edərək söhbət edin" "Yeni söhbətlər üzən nişanlar və ya yumrucuqlar kimi görünür. Yumrucuğu açmaq üçün toxunun. Hərəkət etdirmək üçün sürüşdürün." diff --git a/libs/WindowManager/Shell/res/values-b+sr+Latn/strings.xml b/libs/WindowManager/Shell/res/values-b+sr+Latn/strings.xml index 898b8445d0e1..9c6ed6b95b80 100644 --- a/libs/WindowManager/Shell/res/values-b+sr+Latn/strings.xml +++ b/libs/WindowManager/Shell/res/values-b+sr+Latn/strings.xml @@ -73,8 +73,7 @@ "skupite oblačić %1$s" "Podešavanja za %1$s" "Odbaci oblačić" - - + "Prebaci na ceo ekran" "Ne koristi oblačiće za konverzaciju" "Ćaskajte u oblačićima" "Nove konverzacije se prikazuju kao plutajuće ikone ili oblačići. Dodirnite da biste otvorili oblačić. Prevucite da biste ga premestili." diff --git a/libs/WindowManager/Shell/res/values-be/strings.xml b/libs/WindowManager/Shell/res/values-be/strings.xml index c3407296a007..e8b24bdd7bd5 100644 --- a/libs/WindowManager/Shell/res/values-be/strings.xml +++ b/libs/WindowManager/Shell/res/values-be/strings.xml @@ -73,8 +73,7 @@ "%1$s: згарнуць" "Налады \"%1$s\"" "Адхіліць апавяшчэнне" - - + "Адкрыць у поўнаэкранным рэжыме" "Не паказваць размову ў выглядзе ўсплывальных апавяшчэнняў" "Усплывальныя чаты" "Новыя размовы будуць паказвацца як рухомыя значкі ці ўсплывальныя чаты. Націсніце, каб адкрыць усплывальны чат. Перацягніце яго, каб перамясціць." diff --git a/libs/WindowManager/Shell/res/values-bg/strings.xml b/libs/WindowManager/Shell/res/values-bg/strings.xml index 076a815a25ae..1f188f6ec6f9 100644 --- a/libs/WindowManager/Shell/res/values-bg/strings.xml +++ b/libs/WindowManager/Shell/res/values-bg/strings.xml @@ -73,8 +73,7 @@ "свиване на %1$s" "Настройки за %1$s" "Отхвърляне на балончетата" - - + "Преместване на цял екран" "Без балончета за разговора" "Чат с балончета" "Новите разговори се показват като плаващи икони, или балончета. Докоснете балонче, за да го отворите, или го плъзнете, за да го преместите." diff --git a/libs/WindowManager/Shell/res/values-bn/strings.xml b/libs/WindowManager/Shell/res/values-bn/strings.xml index b0d66967bbb4..b572038ada84 100644 --- a/libs/WindowManager/Shell/res/values-bn/strings.xml +++ b/libs/WindowManager/Shell/res/values-bn/strings.xml @@ -73,8 +73,7 @@ "%1$s আড়াল করুন" "%1$s সেটিংস" "বাবল খারিজ করুন" - - + "ফুল-স্ক্রিন ব্যবহার করুন" "কথোপকথন বাবল হিসেবে দেখাবে না" "বাবল ব্যবহার করে চ্যাট করুন" "নতুন কথোপকথন ভেসে থাকা আইকন বা বাবল হিসেবে দেখানো হয়। বাবল খুলতে ট্যাপ করুন। সেটি সরাতে ধরে টেনে আনুন।" diff --git a/libs/WindowManager/Shell/res/values-bs/strings.xml b/libs/WindowManager/Shell/res/values-bs/strings.xml index 0196e5e93a17..630b31b59520 100644 --- a/libs/WindowManager/Shell/res/values-bs/strings.xml +++ b/libs/WindowManager/Shell/res/values-bs/strings.xml @@ -73,8 +73,7 @@ "sužavanje oblačića %1$s" "Postavke aplikacije %1$s" "Odbaci oblačić" - - + "Prikaži preko cijelog ekrana" "Nemoj prikazivati razgovor u oblačićima" "Chatajte koristeći oblačiće" "Novi razgovori se prikazuju kao plutajuće ikone ili oblačići. Dodirnite da otvorite oblačić. Prevucite da ga premjestite." diff --git a/libs/WindowManager/Shell/res/values-ca/strings.xml b/libs/WindowManager/Shell/res/values-ca/strings.xml index fa4b627805c0..98ec381f9085 100644 --- a/libs/WindowManager/Shell/res/values-ca/strings.xml +++ b/libs/WindowManager/Shell/res/values-ca/strings.xml @@ -73,8 +73,7 @@ "replega %1$s" "Configuració de l\'aplicació %1$s" "Ignora la bombolla" - - + "Mou a pantalla completa" "No mostris la conversa com a bombolla" "Xateja amb bombolles" "Les converses noves es mostren com a icones flotants o bombolles. Toca per obrir una bombolla. Arrossega-la per moure-la." diff --git a/libs/WindowManager/Shell/res/values-cs/strings.xml b/libs/WindowManager/Shell/res/values-cs/strings.xml index 3956fcacbb50..08d5bb51edff 100644 --- a/libs/WindowManager/Shell/res/values-cs/strings.xml +++ b/libs/WindowManager/Shell/res/values-cs/strings.xml @@ -73,8 +73,7 @@ "sbalit %1$s" "Nastavení %1$s" "Zavřít bublinu" - - + "Přejít na celou obrazovku" "Nezobrazovat konverzaci v bublinách" "Chatujte pomocí bublin" "Nové konverzace se zobrazují jako plovoucí ikony, neboli bubliny. Klepnutím bublinu otevřete. Přetažením ji posunete." diff --git a/libs/WindowManager/Shell/res/values-da/strings.xml b/libs/WindowManager/Shell/res/values-da/strings.xml index afe4a1ab877c..ae1bb9afb1ad 100644 --- a/libs/WindowManager/Shell/res/values-da/strings.xml +++ b/libs/WindowManager/Shell/res/values-da/strings.xml @@ -73,8 +73,7 @@ "skjul %1$s" "Indstillinger for %1$s" "Afvis boble" - - + "Flyt til fuld skærm" "Vis ikke samtaler i bobler" "Chat ved hjælp af bobler" "Nye samtaler vises som svævende ikoner eller bobler. Tryk for at åbne boblen. Træk for at flytte den." diff --git a/libs/WindowManager/Shell/res/values-de/strings.xml b/libs/WindowManager/Shell/res/values-de/strings.xml index 1e503393eb8d..abbfa66be780 100644 --- a/libs/WindowManager/Shell/res/values-de/strings.xml +++ b/libs/WindowManager/Shell/res/values-de/strings.xml @@ -73,8 +73,7 @@ "%1$s minimieren" "Einstellungen für %1$s" "Bubble schließen" - - + "Vollbildmodus" "Unterhaltung nicht als Bubble anzeigen" "Bubbles zum Chatten verwenden" "Neue Unterhaltungen erscheinen als unverankerte Symbole, „Bubbles“ genannt. Wenn du eine Bubble öffnen möchtest, tippe sie an. Wenn du sie verschieben möchtest, zieh an ihr." diff --git a/libs/WindowManager/Shell/res/values-el/strings.xml b/libs/WindowManager/Shell/res/values-el/strings.xml index 5c3c6dedd632..0f762d37e7c2 100644 --- a/libs/WindowManager/Shell/res/values-el/strings.xml +++ b/libs/WindowManager/Shell/res/values-el/strings.xml @@ -73,8 +73,7 @@ "σύμπτυξη %1$s" "Ρυθμίσεις %1$s" "Παράβλ. για συννεφ." - - + "Μετακίνηση σε πλήρη οθόνη" "Να μην γίνει προβολή της συζήτησης σε συννεφάκια." "Συζητήστε χρησιμοποιώντας συννεφάκια." "Οι νέες συζητήσεις εμφανίζονται ως κινούμενα εικονίδια ή συννεφάκια. Πατήστε για να ανοίξετε το συννεφάκι. Σύρετε για να το μετακινήσετε." diff --git a/libs/WindowManager/Shell/res/values-en-rAU/strings.xml b/libs/WindowManager/Shell/res/values-en-rAU/strings.xml index 51c69e559f16..2314e6bc3ec0 100644 --- a/libs/WindowManager/Shell/res/values-en-rAU/strings.xml +++ b/libs/WindowManager/Shell/res/values-en-rAU/strings.xml @@ -73,8 +73,7 @@ "collapse %1$s" "%1$s settings" "Dismiss bubble" - - + "Move to fullscreen" "Don’t bubble conversation" "Chat using bubbles" "New conversations appear as floating icons, or bubbles. Tap to open bubble. Drag to move it." diff --git a/libs/WindowManager/Shell/res/values-en-rGB/strings.xml b/libs/WindowManager/Shell/res/values-en-rGB/strings.xml index 51c69e559f16..2314e6bc3ec0 100644 --- a/libs/WindowManager/Shell/res/values-en-rGB/strings.xml +++ b/libs/WindowManager/Shell/res/values-en-rGB/strings.xml @@ -73,8 +73,7 @@ "collapse %1$s" "%1$s settings" "Dismiss bubble" - - + "Move to fullscreen" "Don’t bubble conversation" "Chat using bubbles" "New conversations appear as floating icons, or bubbles. Tap to open bubble. Drag to move it." diff --git a/libs/WindowManager/Shell/res/values-en-rIN/strings.xml b/libs/WindowManager/Shell/res/values-en-rIN/strings.xml index 51c69e559f16..2314e6bc3ec0 100644 --- a/libs/WindowManager/Shell/res/values-en-rIN/strings.xml +++ b/libs/WindowManager/Shell/res/values-en-rIN/strings.xml @@ -73,8 +73,7 @@ "collapse %1$s" "%1$s settings" "Dismiss bubble" - - + "Move to fullscreen" "Don’t bubble conversation" "Chat using bubbles" "New conversations appear as floating icons, or bubbles. Tap to open bubble. Drag to move it." diff --git a/libs/WindowManager/Shell/res/values-et/strings.xml b/libs/WindowManager/Shell/res/values-et/strings.xml index d36a8d14e76b..cfaa0d317ddc 100644 --- a/libs/WindowManager/Shell/res/values-et/strings.xml +++ b/libs/WindowManager/Shell/res/values-et/strings.xml @@ -73,8 +73,7 @@ "ahenda %1$s" "Rakenduse %1$s seaded" "Sule mull" - - + "Lülitu täisekraanile" "Ära kuva vestlust mullina" "Vestelge mullide abil" "Uued vestlused kuvatakse hõljuvate ikoonidena ehk mullidena. Puudutage mulli avamiseks. Lohistage mulli, et seda liigutada." diff --git a/libs/WindowManager/Shell/res/values-eu/strings.xml b/libs/WindowManager/Shell/res/values-eu/strings.xml index 2ee086e47429..509c97e21ddb 100644 --- a/libs/WindowManager/Shell/res/values-eu/strings.xml +++ b/libs/WindowManager/Shell/res/values-eu/strings.xml @@ -73,8 +73,7 @@ "tolestu %1$s" "%1$s aplikazioaren ezarpenak" "Baztertu burbuila" - - + "Joan pantaila osora" "Ez erakutsi elkarrizketak burbuila gisa" "Txateatu burbuilen bidez" "Elkarrizketa berriak ikono gainerakor edo burbuila gisa agertzen dira. Sakatu burbuila irekitzeko. Arrasta ezazu mugitzeko." diff --git a/libs/WindowManager/Shell/res/values-fa/strings.xml b/libs/WindowManager/Shell/res/values-fa/strings.xml index f4cdd5f6672d..223b67130705 100644 --- a/libs/WindowManager/Shell/res/values-fa/strings.xml +++ b/libs/WindowManager/Shell/res/values-fa/strings.xml @@ -73,8 +73,7 @@ "جمع کردن %1$s" "تنظیمات %1$s" "رد کردن حبابک" - - + "رفتن به حالت تمام‌صفحه" "مکالمه در حباب نشان داده نشود" "گپ بااستفاده از حبابک‌ها" "مکالمه‌های جدید به‌صورت نمادهای شناور یا حبابک‌ها نشان داده می‌شوند. برای باز کردن حبابک‌ها تک‌ضرب بزنید. برای جابه‌جایی، آن را بکشید." diff --git a/libs/WindowManager/Shell/res/values-fi/strings.xml b/libs/WindowManager/Shell/res/values-fi/strings.xml index 6be2ee2f00b0..9083c4dae9c3 100644 --- a/libs/WindowManager/Shell/res/values-fi/strings.xml +++ b/libs/WindowManager/Shell/res/values-fi/strings.xml @@ -73,8 +73,7 @@ "tiivistä %1$s" "%1$s: asetukset" "Ohita kupla" - - + "Siirrä koko näytölle" "Älä näytä kuplia keskusteluista" "Chattaile kuplien avulla" "Uudet keskustelut näkyvät kelluvina kuvakkeina tai kuplina. Avaa kupla napauttamalla. Siirrä sitä vetämällä." diff --git a/libs/WindowManager/Shell/res/values-fr-rCA/strings.xml b/libs/WindowManager/Shell/res/values-fr-rCA/strings.xml index 54700990bf6c..2f284ad333cd 100644 --- a/libs/WindowManager/Shell/res/values-fr-rCA/strings.xml +++ b/libs/WindowManager/Shell/res/values-fr-rCA/strings.xml @@ -73,8 +73,7 @@ "réduire %1$s" "Paramètres %1$s" "Ignorer la bulle" - - + "Passez en plein écran" "Ne pas afficher les conversations dans des bulles" "Clavarder en utilisant des bulles" "Les nouvelles conversations s\'affichent sous forme d\'icônes flottantes (de bulles). Touchez une bulle pour l\'ouvrir. Faites-la glisser pour la déplacer." diff --git a/libs/WindowManager/Shell/res/values-gl/strings.xml b/libs/WindowManager/Shell/res/values-gl/strings.xml index 36ad52108337..5126aa29af95 100644 --- a/libs/WindowManager/Shell/res/values-gl/strings.xml +++ b/libs/WindowManager/Shell/res/values-gl/strings.xml @@ -73,8 +73,7 @@ "contraer %1$s" "Configuración de %1$s" "Ignorar burbulla" - - + "Cambiar á pantalla completa" "Non mostrar a conversa como burbulla" "Chatear usando burbullas" "As conversas novas aparecen como iconas flotantes ou burbullas. Toca para abrir a burbulla e arrastra para movela." diff --git a/libs/WindowManager/Shell/res/values-gu/strings.xml b/libs/WindowManager/Shell/res/values-gu/strings.xml index 868ef5b077ae..3418637283c1 100644 --- a/libs/WindowManager/Shell/res/values-gu/strings.xml +++ b/libs/WindowManager/Shell/res/values-gu/strings.xml @@ -73,8 +73,7 @@ "%1$s નાનું કરો" "%1$s સેટિંગ" "બબલને છોડી દો" - - + "પૂર્ણસ્ક્રીન પર ખસો" "વાતચીતને બબલ કરશો નહીં" "બબલનો ઉપયોગ કરીને ચૅટ કરો" "નવી વાતચીત ફ્લોટિંગ આઇકન અથવા બબલ જેવી દેખાશે. બબલને ખોલવા માટે ટૅપ કરો. તેને ખસેડવા માટે ખેંચો." diff --git a/libs/WindowManager/Shell/res/values-hi/strings.xml b/libs/WindowManager/Shell/res/values-hi/strings.xml index 31c7307688af..8eaa86fe2710 100644 --- a/libs/WindowManager/Shell/res/values-hi/strings.xml +++ b/libs/WindowManager/Shell/res/values-hi/strings.xml @@ -73,8 +73,7 @@ "%1$s को छोटा करें" "%1$s की सेटिंग" "बबल खारिज करें" - - + "फ़ुलस्क्रीन पर मूव करें" "बातचीत को बबल न करें" "बबल्स का इस्तेमाल करके चैट करें" "नई बातचीत फ़्लोटिंग आइकॉन या बबल्स की तरह दिखेंगी. बबल को खोलने के लिए टैप करें. इसे एक जगह से दूसरी जगह ले जाने के लिए खींचें और छोड़ें." diff --git a/libs/WindowManager/Shell/res/values-hr/strings.xml b/libs/WindowManager/Shell/res/values-hr/strings.xml index d99a65d89107..5427a9b357f1 100644 --- a/libs/WindowManager/Shell/res/values-hr/strings.xml +++ b/libs/WindowManager/Shell/res/values-hr/strings.xml @@ -73,8 +73,7 @@ "sažmite oblačić %1$s" "Postavke za %1$s" "Odbaci oblačić" - - + "Prebaci na cijeli zaslon" "Zaustavi razgovor u oblačićima" "Oblačići u chatu" "Novi razgovori pojavljuju se kao pomične ikone ili oblačići. Dodirnite za otvaranje oblačića. Povucite da biste ga premjestili." diff --git a/libs/WindowManager/Shell/res/values-hu/strings.xml b/libs/WindowManager/Shell/res/values-hu/strings.xml index bed760eb5ed7..5b337ea7b41a 100644 --- a/libs/WindowManager/Shell/res/values-hu/strings.xml +++ b/libs/WindowManager/Shell/res/values-hu/strings.xml @@ -73,8 +73,7 @@ "%1$s összecsukása" "%1$s beállításai" "Buborék elvetése" - - + "Áthelyezés teljes képernyőre" "Ne jelenjen meg a beszélgetés buborékban" "Buborékokat használó csevegés" "Az új beszélgetések lebegő ikonként, vagyis buborékként jelennek meg. A buborék megnyitásához koppintson rá. Áthelyezéshez húzza a kívánt helyre." diff --git a/libs/WindowManager/Shell/res/values-hy/strings.xml b/libs/WindowManager/Shell/res/values-hy/strings.xml index fcb725432286..ef38307dc920 100644 --- a/libs/WindowManager/Shell/res/values-hy/strings.xml +++ b/libs/WindowManager/Shell/res/values-hy/strings.xml @@ -73,8 +73,7 @@ "%1$s. ծալել" "%1$s – կարգավորումներ" "Փակել ամպիկը" - - + "Տեղափոխել լիաէկրան ռեժիմ" "Զրույցը չցուցադրել ամպիկի տեսքով" "Զրույցի ամպիկներ" "Նոր զրույցները կհայտնվեն լողացող պատկերակների կամ ամպիկների տեսքով։ Հպեք՝ ամպիկը բացելու համար։ Քաշեք՝ այն տեղափոխելու համար։" diff --git a/libs/WindowManager/Shell/res/values-in/strings.xml b/libs/WindowManager/Shell/res/values-in/strings.xml index 85a9bbf253a5..fcb3e7200403 100644 --- a/libs/WindowManager/Shell/res/values-in/strings.xml +++ b/libs/WindowManager/Shell/res/values-in/strings.xml @@ -73,8 +73,7 @@ "ciutkan %1$s" "Setelan %1$s" "Tutup balon" - - + "Pindahkan ke layar penuh" "Jangan gunakan percakapan balon" "Chat dalam tampilan balon" "Percakapan baru muncul sebagai ikon mengambang, atau balon. Ketuk untuk membuka balon. Tarik untuk memindahkannya." diff --git a/libs/WindowManager/Shell/res/values-is/strings.xml b/libs/WindowManager/Shell/res/values-is/strings.xml index 8041162f7b5c..9755083d853d 100644 --- a/libs/WindowManager/Shell/res/values-is/strings.xml +++ b/libs/WindowManager/Shell/res/values-is/strings.xml @@ -73,8 +73,7 @@ "minnka %1$s" "Stillingar %1$s" "Loka blöðru" - - + "Færa í allan skjáinn" "Ekki setja samtal í blöðru" "Spjalla með blöðrum" "Ný samtöl birtast sem fljótandi tákn eða blöðrur. Ýttu til að opna blöðru. Dragðu hana til að færa." diff --git a/libs/WindowManager/Shell/res/values-iw/strings.xml b/libs/WindowManager/Shell/res/values-iw/strings.xml index e1854fa16303..ddbb89ab2211 100644 --- a/libs/WindowManager/Shell/res/values-iw/strings.xml +++ b/libs/WindowManager/Shell/res/values-iw/strings.xml @@ -73,8 +73,7 @@ "כיווץ של %1$s" "הגדרות %1$s" "סגירת בועה" - - + "הצגה במסך מלא" "אין להציג בועות לשיחה" "לדבר בבועות" "שיחות חדשות מופיעות כסמלים צפים, או בועות. יש להקיש כדי לפתוח בועה. יש לגרור כדי להזיז אותה." diff --git a/libs/WindowManager/Shell/res/values-ja/strings.xml b/libs/WindowManager/Shell/res/values-ja/strings.xml index 1f1ddc71efa8..82848371d45d 100644 --- a/libs/WindowManager/Shell/res/values-ja/strings.xml +++ b/libs/WindowManager/Shell/res/values-ja/strings.xml @@ -73,8 +73,7 @@ "%1$sを閉じます" "%1$s の設定" "バブルを閉じる" - - + "全画面表示に移動する" "会話をバブルで表示しない" "チャットでバブルを使う" "新しい会話はフローティング アイコン(バブル)として表示されます。タップするとバブルが開きます。ドラッグしてバブルを移動できます。" diff --git a/libs/WindowManager/Shell/res/values-ka/strings.xml b/libs/WindowManager/Shell/res/values-ka/strings.xml index e201a2023d33..82828d81d61a 100644 --- a/libs/WindowManager/Shell/res/values-ka/strings.xml +++ b/libs/WindowManager/Shell/res/values-ka/strings.xml @@ -73,8 +73,7 @@ "%1$s-ის ჩაკეცვა" "%1$s-ის პარამეტრები" "ბუშტის დახურვა" - - + "სრულეკრანიან რეჟიმზე გადატანა" "აიკრძალოს საუბრის ბუშტები" "ჩეთი ბუშტების გამოყენებით" "ახალი საუბრები გამოჩნდება როგორც მოტივტივე ხატულები ან ბუშტები. შეეხეთ ბუშტის გასახსნელად. გადაიტანეთ ჩავლებით." diff --git a/libs/WindowManager/Shell/res/values-kk/strings.xml b/libs/WindowManager/Shell/res/values-kk/strings.xml index 1c335dd4714d..af4e4f33492d 100644 --- a/libs/WindowManager/Shell/res/values-kk/strings.xml +++ b/libs/WindowManager/Shell/res/values-kk/strings.xml @@ -73,8 +73,7 @@ "%1$s: жию" "%1$s параметрлері" "Қалқымалы хабарды жабу" - - + "Толық экранға ауысу" "Әңгіменің қалқыма хабары көрсетілмесін" "Қалқыма хабарлар арқылы сөйлесу" "Жаңа әңгімелер қалқыма белгішелер немесе хабарлар түрінде көрсетіледі. Қалқыма хабарды ашу үшін түртіңіз. Жылжыту үшін сүйреңіз." diff --git a/libs/WindowManager/Shell/res/values-km/strings.xml b/libs/WindowManager/Shell/res/values-km/strings.xml index d0cceee8aba5..c3a38006374b 100644 --- a/libs/WindowManager/Shell/res/values-km/strings.xml +++ b/libs/WindowManager/Shell/res/values-km/strings.xml @@ -73,8 +73,7 @@ "បង្រួម %1$s" "ការកំណត់ %1$s" "ច្រានចោល​ពពុះ" - - + "ផ្លាស់ទីទៅ​អេក្រង់​ពេញ" "កុំបង្ហាញ​ការសន្ទនា​ជាពពុះ" "ជជែក​ដោយប្រើ​ពពុះ" "ការសន្ទនាថ្មីៗ​បង្ហាញជា​​ពពុះ ឬរូបអណ្ដែត។ ចុច ដើម្បីបើក​ពពុះ។ អូស ដើម្បី​ផ្លាស់ទី​ពពុះនេះ។" diff --git a/libs/WindowManager/Shell/res/values-kn/strings.xml b/libs/WindowManager/Shell/res/values-kn/strings.xml index 63b5c68a96fc..aa8cec582a28 100644 --- a/libs/WindowManager/Shell/res/values-kn/strings.xml +++ b/libs/WindowManager/Shell/res/values-kn/strings.xml @@ -73,8 +73,7 @@ "%1$s ಅನ್ನು ಕುಗ್ಗಿಸಿ" "%1$s ಸೆಟ್ಟಿಂಗ್‌ಗಳು" "ಬಬಲ್ ವಜಾಗೊಳಿಸಿ" - - + "ಫುಲ್‌ಸ್ಕ್ರೀನ್‌ಗೆ ಸರಿಸಿ" "ಸಂಭಾಷಣೆಯನ್ನು ಬಬಲ್ ಮಾಡಬೇಡಿ" "ಬಬಲ್ಸ್ ಬಳಸಿ ಚಾಟ್ ಮಾಡಿ" "ಹೊಸ ಸಂಭಾಷಣೆಗಳು ತೇಲುವ ಐಕಾನ್‌ಗಳು ಅಥವಾ ಬಬಲ್ಸ್ ಆಗಿ ಗೋಚರಿಸುತ್ತವೆ. ಬಬಲ್ ತೆರೆಯಲು ಟ್ಯಾಪ್ ಮಾಡಿ. ಅದನ್ನು ಡ್ರ್ಯಾಗ್ ಮಾಡಲು ಎಳೆಯಿರಿ." diff --git a/libs/WindowManager/Shell/res/values-ko/strings.xml b/libs/WindowManager/Shell/res/values-ko/strings.xml index b5efd10ad19f..fc2a1b91760a 100644 --- a/libs/WindowManager/Shell/res/values-ko/strings.xml +++ b/libs/WindowManager/Shell/res/values-ko/strings.xml @@ -73,8 +73,7 @@ "%1$s 접기" "%1$s 설정" "대화창 닫기" - - + "전체 화면으로 이동" "대화를 대화창으로 표시하지 않기" "대화창으로 채팅하기" "새로운 대화가 플로팅 아이콘인 대화창으로 표시됩니다. 대화창을 열려면 탭하세요. 드래그하여 이동할 수 있습니다." diff --git a/libs/WindowManager/Shell/res/values-ky/strings.xml b/libs/WindowManager/Shell/res/values-ky/strings.xml index e001efe9296a..c294725e8ff9 100644 --- a/libs/WindowManager/Shell/res/values-ky/strings.xml +++ b/libs/WindowManager/Shell/res/values-ky/strings.xml @@ -73,8 +73,7 @@ "%1$s жыйыштыруу" "%1$s параметрлери" "Калкып чыкма билдирмени жабуу" - - + "Толук экранга өтүү" "Жазышууда калкып чыкма билдирмелер көрүнбөсүн" "Калкып чыкма билдирмелер аркылуу маектешүү" "Жаңы жазышуулар калкыма сүрөтчөлөр же калкып чыкма билдирмелер түрүндө көрүнөт. Калкып чыкма билдирмелерди ачуу үчүн тийип коюңуз. Жылдыруу үчүн сүйрөңүз." diff --git a/libs/WindowManager/Shell/res/values-lo/strings.xml b/libs/WindowManager/Shell/res/values-lo/strings.xml index 029c95b18ce9..7d2f999f4975 100644 --- a/libs/WindowManager/Shell/res/values-lo/strings.xml +++ b/libs/WindowManager/Shell/res/values-lo/strings.xml @@ -73,8 +73,7 @@ "ຫຍໍ້ %1$s ລົງ" "ການຕັ້ງຄ່າ %1$s" "ປິດຟອງໄວ້" - - + "ຍ້າຍໄປໂໝດເຕັມຈໍ" "ຢ່າໃຊ້ຟອງໃນການສົນທະນາ" "ສົນທະນາໂດຍໃຊ້ຟອງ" "ການສົນທະນາໃໝ່ຈະປາກົດເປັນໄອຄອນ ຫຼື ຟອງແບບລອຍ. ແຕະເພື່ອເປີດຟອງ. ລາກເພື່ອຍ້າຍມັນ." diff --git a/libs/WindowManager/Shell/res/values-lt/strings.xml b/libs/WindowManager/Shell/res/values-lt/strings.xml index 791ddcd48933..be446a6d3fba 100644 --- a/libs/WindowManager/Shell/res/values-lt/strings.xml +++ b/libs/WindowManager/Shell/res/values-lt/strings.xml @@ -73,8 +73,7 @@ "sutraukti „%1$s“" "„%1$s“ nustatymai" "Atsisakyti burbulo" - - + "Pereiti į viso ekrano režimą" "Nerodyti pokalbio burbule" "Pokalbis naudojant burbulus" "Nauji pokalbiai rodomi kaip slankiosios piktogramos arba burbulai. Palieskite, kad atidarytumėte burbulą. Vilkite, kad perkeltumėte." diff --git a/libs/WindowManager/Shell/res/values-lv/strings.xml b/libs/WindowManager/Shell/res/values-lv/strings.xml index 8a86687ebe8e..ed0c05e0a393 100644 --- a/libs/WindowManager/Shell/res/values-lv/strings.xml +++ b/libs/WindowManager/Shell/res/values-lv/strings.xml @@ -73,8 +73,7 @@ "Sakļaut “%1$s”" "Lietotnes %1$s iestatījumi" "Nerādīt burbuli" - - + "Pārvietot uz pilnekrāna režīmu" "Nerādīt sarunu burbuļos" "Tērzēšana, izmantojot burbuļus" "Jaunas sarunas tiek rādītas kā peldošas ikonas vai burbuļi. Pieskarieties, lai atvērtu burbuli. Velciet, lai to pārvietotu." diff --git a/libs/WindowManager/Shell/res/values-mk/strings.xml b/libs/WindowManager/Shell/res/values-mk/strings.xml index 3a6b2f0a1e4f..9b24b7fa567a 100644 --- a/libs/WindowManager/Shell/res/values-mk/strings.xml +++ b/libs/WindowManager/Shell/res/values-mk/strings.xml @@ -73,8 +73,7 @@ "собери %1$s" "Поставки за %1$s" "Отфрли балонче" - - + "Префрлете на цел екран" "Не прикажувај го разговорот во балончиња" "Разговор во балончиња" "Новите разговори ќе се појавуваат како лебдечки икони или балончиња. Допрете за отворање на балончето. Повлечете за да го преместите." diff --git a/libs/WindowManager/Shell/res/values-ml/strings.xml b/libs/WindowManager/Shell/res/values-ml/strings.xml index 26e4a4661d89..ac67f8d62339 100644 --- a/libs/WindowManager/Shell/res/values-ml/strings.xml +++ b/libs/WindowManager/Shell/res/values-ml/strings.xml @@ -73,8 +73,7 @@ "%1$s ചുരുക്കുക" "%1$s ക്രമീകരണം" "ബബിൾ ഡിസ്മിസ് ചെയ്യൂ" - - + "പൂർണ്ണസ്‌ക്രീനിലേക്ക് നീങ്ങുക" "സംഭാഷണം ബബിൾ ചെയ്യരുത്" "ബബിളുകൾ ഉപയോഗിച്ച് ചാറ്റ് ചെയ്യുക" "പുതിയ സംഭാഷണങ്ങൾ ഫ്ലോട്ടിംഗ് ഐക്കണുകളോ ബബിളുകളോ ആയി ദൃശ്യമാവുന്നു. ബബിൾ തുറക്കാൻ ടാപ്പ് ചെയ്യൂ. ഇത് നീക്കാൻ വലിച്ചിടുക." diff --git a/libs/WindowManager/Shell/res/values-mn/strings.xml b/libs/WindowManager/Shell/res/values-mn/strings.xml index 505a4ad66c96..6d5deb3a1a32 100644 --- a/libs/WindowManager/Shell/res/values-mn/strings.xml +++ b/libs/WindowManager/Shell/res/values-mn/strings.xml @@ -73,8 +73,7 @@ "%1$s-г хураах" "%1$s-н тохиргоо" "Бөмбөлгийг хаах" - - + "Бүтэн дэлгэц рүү очих" "Харилцан яриаг бүү бөмбөлөг болго" "Бөмбөлөг ашиглан чатлаарай" "Шинэ харилцан яриа нь хөвөгч дүрс тэмдэг эсвэл бөмбөлөг хэлбэрээр харагддаг. Бөмбөлгийг нээхийн тулд товшино уу. Түүнийг зөөхийн тулд чирнэ үү." diff --git a/libs/WindowManager/Shell/res/values-mr/strings.xml b/libs/WindowManager/Shell/res/values-mr/strings.xml index cc35f11fa308..49747f21902c 100644 --- a/libs/WindowManager/Shell/res/values-mr/strings.xml +++ b/libs/WindowManager/Shell/res/values-mr/strings.xml @@ -73,8 +73,7 @@ "%1$s कोलॅप्स करा" "%1$s सेटिंग्ज" "बबल डिसमिस करा" - - + "फुलस्क्रीनवर हलवा" "संभाषणाला बबल करू नका" "बबल वापरून चॅट करा" "नवीन संभाषणे फ्लोटिंग आयकन किंवा बबल म्हणून दिसतात. बबल उघडण्यासाठी टॅप करा. हे हलवण्यासाठी ड्रॅग करा." diff --git a/libs/WindowManager/Shell/res/values-ms/strings.xml b/libs/WindowManager/Shell/res/values-ms/strings.xml index 61d66144cb0c..dec389327c3c 100644 --- a/libs/WindowManager/Shell/res/values-ms/strings.xml +++ b/libs/WindowManager/Shell/res/values-ms/strings.xml @@ -73,8 +73,7 @@ "kuncupkan %1$s" "Tetapan %1$s" "Ketepikan gelembung" - - + "Alihkan kepada skrin penuh" "Jangan jadikan perbualan dalam bentuk gelembung" "Bersembang menggunakan gelembung" "Perbualan baharu muncul sebagai ikon terapung atau gelembung. Ketik untuk membuka gelembung. Seret untuk mengalihkan gelembung tersebut." diff --git a/libs/WindowManager/Shell/res/values-my/strings.xml b/libs/WindowManager/Shell/res/values-my/strings.xml index 7841e07aa949..908ef812ab53 100644 --- a/libs/WindowManager/Shell/res/values-my/strings.xml +++ b/libs/WindowManager/Shell/res/values-my/strings.xml @@ -73,8 +73,7 @@ "%1$s ကို ချုံ့ရန်" "%1$s ဆက်တင်များ" "ပူဖောင်းကွက် ပယ်ရန်" - - + "ဖန်သားပြင်အပြည့်သို့ ရွှေ့ရန်" "စကားဝိုင်းကို ပူဖောင်းကွက် မပြုလုပ်ပါနှင့်" "ပူဖောင်းကွက် သုံး၍ ချတ်လုပ်ခြင်း" "စကားဝိုင်းအသစ်များကို မျောနေသည့် သင်္ကေတများ သို့မဟုတ် ပူဖောင်းကွက်များအဖြစ် မြင်ရပါမည်။ ပူဖောင်းကွက်ကိုဖွင့်ရန် တို့ပါ။ ရွှေ့ရန် ၎င်းကို ဖိဆွဲပါ။" diff --git a/libs/WindowManager/Shell/res/values-nb/strings.xml b/libs/WindowManager/Shell/res/values-nb/strings.xml index ea2ae1ba1db4..01ca4ed6fbbb 100644 --- a/libs/WindowManager/Shell/res/values-nb/strings.xml +++ b/libs/WindowManager/Shell/res/values-nb/strings.xml @@ -73,8 +73,7 @@ "skjul %1$s" "%1$s-innstillinger" "Lukk boblen" - - + "Flytt til fullskjerm" "Ikke vis samtaler i bobler" "Chat med bobler" "Nye samtaler vises som flytende ikoner eller bobler. Trykk for å åpne en boble. Dra for å flytte den." diff --git a/libs/WindowManager/Shell/res/values-ne/strings.xml b/libs/WindowManager/Shell/res/values-ne/strings.xml index a3bd5eec6d5e..05ce071fd8e4 100644 --- a/libs/WindowManager/Shell/res/values-ne/strings.xml +++ b/libs/WindowManager/Shell/res/values-ne/strings.xml @@ -73,8 +73,7 @@ "%1$s कोल्याप्स गर्नुहोस्" "%1$s का सेटिङहरू" "बबल खारेज गर्नुहोस्" - - + "सारेर फुल स्क्रिनमा लैजानुहोस्" "वार्तालाप बबलको रूपमा नदेखाउनुहोस्" "बबलहरू प्रयोग गरी कुराकानी गर्नुहोस्" "नयाँ वार्तालापहरू तैरने आइकन वा बबलका रूपमा देखिन्छन्। बबल खोल्न ट्याप गर्नुहोस्। बबल सार्न सो बबललाई ड्र्याग गर्नुहोस्।" diff --git a/libs/WindowManager/Shell/res/values-nl/strings.xml b/libs/WindowManager/Shell/res/values-nl/strings.xml index ad2c60fe4517..9ec44440a697 100644 --- a/libs/WindowManager/Shell/res/values-nl/strings.xml +++ b/libs/WindowManager/Shell/res/values-nl/strings.xml @@ -73,8 +73,7 @@ "%1$s samenvouwen" "Instellingen voor %1$s" "Bubbel sluiten" - - + "Naar volledig scherm" "Gesprekken niet in bubbels tonen" "Chatten met bubbels" "Nieuwe gesprekken worden als zwevende iconen of bubbels getoond. Tik om een bubbel te openen. Sleep om een bubbel te verplaatsen." diff --git a/libs/WindowManager/Shell/res/values-or/strings.xml b/libs/WindowManager/Shell/res/values-or/strings.xml index 76f2715b54c9..7ee734215708 100644 --- a/libs/WindowManager/Shell/res/values-or/strings.xml +++ b/libs/WindowManager/Shell/res/values-or/strings.xml @@ -73,8 +73,7 @@ "%1$s ସଙ୍କୁଚିତ କରନ୍ତୁ" "%1$s ସେଟିଂସ୍" "ବବଲ୍ ଖାରଜ କରନ୍ତୁ" - - + "ପୂର୍ଣ୍ଣସ୍କ୍ରିନକୁ ମୁଭ କରନ୍ତୁ" "ବାର୍ତ୍ତାଳାପକୁ ବବଲ୍ କରନ୍ତୁ ନାହିଁ" "ବବଲଗୁଡ଼ିକୁ ବ୍ୟବହାର କରି ଚାଟ୍ କରନ୍ତୁ" "ନୂଆ ବାର୍ତ୍ତାଳାପଗୁଡ଼ିକ ଫ୍ଲୋଟିଂ ଆଇକନ୍ କିମ୍ବା ବବଲ୍ ଭାବେ ଦେଖାଯିବ। ବବଲ୍ ଖୋଲିବାକୁ ଟାପ୍ କରନ୍ତୁ। ଏହାକୁ ମୁଭ୍ କରିବାକୁ ଟାଣନ୍ତୁ।" diff --git a/libs/WindowManager/Shell/res/values-pa/strings.xml b/libs/WindowManager/Shell/res/values-pa/strings.xml index cd7fd4716c65..cc31e3c3cf6a 100644 --- a/libs/WindowManager/Shell/res/values-pa/strings.xml +++ b/libs/WindowManager/Shell/res/values-pa/strings.xml @@ -73,8 +73,7 @@ "%1$s ਨੂੰ ਸਮੇਟੋ" "%1$s ਸੈਟਿੰਗਾਂ" "ਬਬਲ ਨੂੰ ਖਾਰਜ ਕਰੋ" - - + "ਪੂਰੀ-ਸਕ੍ਰੀਨ \'ਤੇ ਜਾਓ" "ਗੱਲਬਾਤ \'ਤੇ ਬਬਲ ਨਾ ਲਾਓ" "ਬਬਲ ਵਰਤਦੇ ਹੋਏ ਚੈਟ ਕਰੋ" "ਨਵੀਆਂ ਗੱਲਾਂਬਾਤਾਂ ਫਲੋਟਿੰਗ ਪ੍ਰਤੀਕਾਂ ਜਾਂ ਬਬਲ ਦੇ ਰੂਪ ਵਿੱਚ ਦਿਸਦੀਆਂ ਹਨ। ਬਬਲ ਨੂੰ ਖੋਲ੍ਹਣ ਲਈ ਟੈਪ ਕਰੋ। ਇਸਨੂੰ ਲਿਜਾਣ ਲਈ ਘਸੀਟੋ।" diff --git a/libs/WindowManager/Shell/res/values-pl/strings.xml b/libs/WindowManager/Shell/res/values-pl/strings.xml index d33b6f15ba37..5dd14c972968 100644 --- a/libs/WindowManager/Shell/res/values-pl/strings.xml +++ b/libs/WindowManager/Shell/res/values-pl/strings.xml @@ -73,8 +73,7 @@ "zwiń dymek %1$s" "%1$s – ustawienia" "Zamknij dymek" - - + "Zmień tryb na pełnoekranowy" "Nie wyświetlaj rozmowy jako dymka" "Czatuj, korzystając z dymków" "Nowe rozmowy będą wyświetlane jako pływające ikony lub dymki. Kliknij, by otworzyć dymek. Przeciągnij, by go przenieść." diff --git a/libs/WindowManager/Shell/res/values-pt-rBR/strings.xml b/libs/WindowManager/Shell/res/values-pt-rBR/strings.xml index c7a00ff3257e..d9c3d44a1563 100644 --- a/libs/WindowManager/Shell/res/values-pt-rBR/strings.xml +++ b/libs/WindowManager/Shell/res/values-pt-rBR/strings.xml @@ -73,8 +73,7 @@ "fechar %1$s" "Configurações de %1$s" "Dispensar balão" - - + "Mude para tela cheia" "Não criar balões de conversa" "Converse usando balões" "Novas conversas aparecerão como ícones flutuantes, ou balões. Toque para abrir o balão. Arraste para movê-lo." diff --git a/libs/WindowManager/Shell/res/values-pt-rPT/strings.xml b/libs/WindowManager/Shell/res/values-pt-rPT/strings.xml index d14144705c56..1ace69998218 100644 --- a/libs/WindowManager/Shell/res/values-pt-rPT/strings.xml +++ b/libs/WindowManager/Shell/res/values-pt-rPT/strings.xml @@ -73,8 +73,7 @@ "reduzir %1$s" "Definições de %1$s" "Ignorar balão" - - + "Mudar para ecrã inteiro" "Não apresentar a conversa em balões" "Converse no chat através de balões" "As novas conversas aparecem como ícones flutuantes ou balões. Toque para abrir o balão. Arraste para o mover." diff --git a/libs/WindowManager/Shell/res/values-pt/strings.xml b/libs/WindowManager/Shell/res/values-pt/strings.xml index c7a00ff3257e..d9c3d44a1563 100644 --- a/libs/WindowManager/Shell/res/values-pt/strings.xml +++ b/libs/WindowManager/Shell/res/values-pt/strings.xml @@ -73,8 +73,7 @@ "fechar %1$s" "Configurações de %1$s" "Dispensar balão" - - + "Mude para tela cheia" "Não criar balões de conversa" "Converse usando balões" "Novas conversas aparecerão como ícones flutuantes, ou balões. Toque para abrir o balão. Arraste para movê-lo." diff --git a/libs/WindowManager/Shell/res/values-ro/strings.xml b/libs/WindowManager/Shell/res/values-ro/strings.xml index 9bc76602e1d3..ffaea971229c 100644 --- a/libs/WindowManager/Shell/res/values-ro/strings.xml +++ b/libs/WindowManager/Shell/res/values-ro/strings.xml @@ -73,8 +73,7 @@ "restrânge %1$s" "Setări %1$s" "Închide balonul" - - + "Treci la ecran complet" "Nu afișa conversația în balon" "Chat cu baloane" "Conversațiile noi apar ca pictograme flotante sau baloane. Atinge pentru a deschide balonul. Trage pentru a-l muta." diff --git a/libs/WindowManager/Shell/res/values-ru/strings.xml b/libs/WindowManager/Shell/res/values-ru/strings.xml index 044e3b02d439..6231e3e82eca 100644 --- a/libs/WindowManager/Shell/res/values-ru/strings.xml +++ b/libs/WindowManager/Shell/res/values-ru/strings.xml @@ -73,8 +73,7 @@ "Свернуть %1$s" "%1$s: настройки" "Скрыть всплывающий чат" - - + "Перейти в полноэкранный режим" "Не показывать всплывающий чат для разговора" "Всплывающие чаты" "Новые разговоры будут появляться в виде плавающих значков, или всплывающих чатов. Чтобы открыть чат, нажмите на него, а чтобы переместить – перетащите." diff --git a/libs/WindowManager/Shell/res/values-si/strings.xml b/libs/WindowManager/Shell/res/values-si/strings.xml index da2541e2ec14..824bd8d2998f 100644 --- a/libs/WindowManager/Shell/res/values-si/strings.xml +++ b/libs/WindowManager/Shell/res/values-si/strings.xml @@ -73,8 +73,7 @@ "%1$s හකුළන්න" "%1$s සැකසීම්" "බුබුලු ඉවත ලන්න" - - + "පූර්ණ තිරය වෙත ගෙන යන්න" "සංවාදය බුබුලු නොදමන්න" "බුබුලු භාවිතයෙන් කතාබහ කරන්න" "නව සංවාද පාවෙන අයිකන හෝ බුබුලු ලෙස දිස් වේ. බුබුල විවෘත කිරීමට තට්ටු කරන්න. එය ගෙන යාමට අදින්න." diff --git a/libs/WindowManager/Shell/res/values-sk/strings.xml b/libs/WindowManager/Shell/res/values-sk/strings.xml index 394a4cad292b..4a1508d98717 100644 --- a/libs/WindowManager/Shell/res/values-sk/strings.xml +++ b/libs/WindowManager/Shell/res/values-sk/strings.xml @@ -73,8 +73,7 @@ "zbaliť %1$s" "Nastavenia aplikácie %1$s" "Zavrieť bublinu" - - + "Presunúť na celú obrazovku" "Nezobrazovať konverzáciu ako bublinu" "Čet pomocou bublín" "Nové konverzácie sa zobrazujú ako plávajúce ikony či bubliny. Bublinu otvoríte klepnutím. Premiestnite ju presunutím." diff --git a/libs/WindowManager/Shell/res/values-sl/strings.xml b/libs/WindowManager/Shell/res/values-sl/strings.xml index a90c2c216ef4..dd2f9f0291ff 100644 --- a/libs/WindowManager/Shell/res/values-sl/strings.xml +++ b/libs/WindowManager/Shell/res/values-sl/strings.xml @@ -73,8 +73,7 @@ "strnitev oblačka %1$s" "Nastavitve za %1$s" "Opusti oblaček" - - + "Premik na celozaslonski način" "Pogovora ne prikaži v oblačku" "Klepet z oblački" "Novi pogovori so prikazani kot lebdeče ikone ali oblački. Če želite odpreti oblaček, se ga dotaknite. Če ga želite premakniti, ga povlecite." diff --git a/libs/WindowManager/Shell/res/values-sq/strings.xml b/libs/WindowManager/Shell/res/values-sq/strings.xml index 706e75fc53aa..322525bf97c5 100644 --- a/libs/WindowManager/Shell/res/values-sq/strings.xml +++ b/libs/WindowManager/Shell/res/values-sq/strings.xml @@ -73,8 +73,7 @@ "palos %1$s" "Cilësimet e %1$s" "Hiqe flluskën" - - + "Kalo në ekran të plotë" "Mos e vendos bisedën në flluskë" "Bisedo duke përdorur flluskat" "Bisedat e reja shfaqen si ikona pluskuese ose flluska. Trokit për të hapur flluskën. Zvarrit për ta zhvendosur." diff --git a/libs/WindowManager/Shell/res/values-sr/strings.xml b/libs/WindowManager/Shell/res/values-sr/strings.xml index 539a00a20346..87ae78e63b74 100644 --- a/libs/WindowManager/Shell/res/values-sr/strings.xml +++ b/libs/WindowManager/Shell/res/values-sr/strings.xml @@ -73,8 +73,7 @@ "скупите облачић %1$s" "Подешавања за %1$s" "Одбаци облачић" - - + "Пребаци на цео екран" "Не користи облачиће за конверзацију" "Ћаскајте у облачићима" "Нове конверзације се приказују као плутајуће иконе или облачићи. Додирните да бисте отворили облачић. Превуците да бисте га преместили." diff --git a/libs/WindowManager/Shell/res/values-sv/strings.xml b/libs/WindowManager/Shell/res/values-sv/strings.xml index 549eb109f662..6942e957f9cd 100644 --- a/libs/WindowManager/Shell/res/values-sv/strings.xml +++ b/libs/WindowManager/Shell/res/values-sv/strings.xml @@ -73,8 +73,7 @@ "komprimera %1$s" "Inställningar för %1$s" "Stäng bubbla" - - + "Flytta till helskärm" "Visa inte konversationen i bubblor" "Chatta med bubblor" "Nya konversationer visas som flytande ikoner, så kallade bubblor. Tryck på bubblan om du vill öppna den. Dra den om du vill flytta den." diff --git a/libs/WindowManager/Shell/res/values-sw/strings.xml b/libs/WindowManager/Shell/res/values-sw/strings.xml index 9c3469081706..30d68707edc4 100644 --- a/libs/WindowManager/Shell/res/values-sw/strings.xml +++ b/libs/WindowManager/Shell/res/values-sw/strings.xml @@ -73,8 +73,7 @@ "kunja %1$s" "Mipangilio ya %1$s" "Ondoa kiputo" - - + "Hamishia kwenye skrini nzima" "Usiweke viputo kwenye mazungumzo" "Piga gumzo ukitumia viputo" "Mazungumzo mapya huonekena kama aikoni au viputo vinavyoelea. Gusa ili ufungue kiputo. Buruta ili ukisogeze." diff --git a/libs/WindowManager/Shell/res/values-ta/strings.xml b/libs/WindowManager/Shell/res/values-ta/strings.xml index 7e996f332bc2..9e51416d4c3c 100644 --- a/libs/WindowManager/Shell/res/values-ta/strings.xml +++ b/libs/WindowManager/Shell/res/values-ta/strings.xml @@ -73,8 +73,7 @@ "%1$s ஐச் சுருக்கும்" "%1$s அமைப்புகள்" "குமிழை அகற்று" - - + "முழுத்திரைக்கு மாற்று" "உரையாடலைக் குமிழாக்காதே" "குமிழ்களைப் பயன்படுத்தி அரட்டையடியுங்கள்" "புதிய உரையாடல்கள் மிதக்கும் ஐகான்களாகவோ குமிழ்களாகவோ தோன்றும். குமிழைத் திறக்க தட்டவும். நகர்த்த இழுக்கவும்." diff --git a/libs/WindowManager/Shell/res/values-te/strings.xml b/libs/WindowManager/Shell/res/values-te/strings.xml index 984cea87bbf0..be770ca1c514 100644 --- a/libs/WindowManager/Shell/res/values-te/strings.xml +++ b/libs/WindowManager/Shell/res/values-te/strings.xml @@ -73,8 +73,7 @@ "%1$s‌ను కుదించండి" "%1$s సెట్టింగ్‌లు" "బబుల్‌ను విస్మరించు" - - + "ఫుల్ స్క్రీన్‌కు వెళ్లండి" "సంభాషణను బబుల్ చేయవద్దు" "బబుల్స్‌ను ఉపయోగించి చాట్ చేయండి" "కొత్త సంభాషణలు తేలియాడే చిహ్నాలుగా లేదా బబుల్స్ లాగా కనిపిస్తాయి. బబుల్‌ని తెరవడానికి నొక్కండి. తరలించడానికి లాగండి." diff --git a/libs/WindowManager/Shell/res/values-th/strings.xml b/libs/WindowManager/Shell/res/values-th/strings.xml index 3460b0768ad0..e7975ac7d77d 100644 --- a/libs/WindowManager/Shell/res/values-th/strings.xml +++ b/libs/WindowManager/Shell/res/values-th/strings.xml @@ -73,8 +73,7 @@ "ยุบ %1$s" "การตั้งค่า %1$s" "ปิดบับเบิล" - - + "เปลี่ยนเป็นแบบเต็มหน้าจอ" "ไม่ต้องแสดงการสนทนาเป็นบับเบิล" "แชทโดยใช้บับเบิล" "การสนทนาใหม่ๆ จะปรากฏเป็นไอคอนแบบลอยหรือบับเบิล แตะเพื่อเปิดบับเบิล ลากเพื่อย้ายที่" diff --git a/libs/WindowManager/Shell/res/values-tl/strings.xml b/libs/WindowManager/Shell/res/values-tl/strings.xml index dc309129ef2e..72d09263ebbc 100644 --- a/libs/WindowManager/Shell/res/values-tl/strings.xml +++ b/libs/WindowManager/Shell/res/values-tl/strings.xml @@ -73,8 +73,7 @@ "i-collapse ang %1$s" "Mga setting ng %1$s" "I-dismiss ang bubble" - - + "Lumipat sa fullscreen" "Huwag ipakita sa bubble ang mga pag-uusap" "Mag-chat gamit ang bubbles" "Lumalabas bilang mga nakalutang na icon o bubble ang mga bagong pag-uusap. I-tap para buksan ang bubble. I-drag para ilipat ito." diff --git a/libs/WindowManager/Shell/res/values-tr/strings.xml b/libs/WindowManager/Shell/res/values-tr/strings.xml index e9e21739cb61..2b02f472484c 100644 --- a/libs/WindowManager/Shell/res/values-tr/strings.xml +++ b/libs/WindowManager/Shell/res/values-tr/strings.xml @@ -73,8 +73,7 @@ "daralt: %1$s" "%1$s ayarları" "Baloncuğu kapat" - - + "Tam ekrana taşı" "Görüşmeyi baloncuk olarak görüntüleme" "Baloncukları kullanarak sohbet edin" "Yeni görüşmeler kayan simgeler veya baloncuk olarak görünür. Açmak için baloncuğa dokunun. Baloncuğu taşımak için sürükleyin." diff --git a/libs/WindowManager/Shell/res/values-uk/strings.xml b/libs/WindowManager/Shell/res/values-uk/strings.xml index e1b6e3505c04..47126acc1213 100644 --- a/libs/WindowManager/Shell/res/values-uk/strings.xml +++ b/libs/WindowManager/Shell/res/values-uk/strings.xml @@ -73,8 +73,7 @@ "згорнути \"%1$s\"" "Налаштування параметра \"%1$s\"" "Закрити підказку" - - + "Перейти в повноекранний режим" "Не показувати спливаючі чати для розмов" "Спливаючий чат" "Нові повідомлення чату з\'являються у вигляді спливаючих значків. Щоб відкрити чат, натисніть його, а щоб перемістити – перетягніть." diff --git a/libs/WindowManager/Shell/res/values-ur/strings.xml b/libs/WindowManager/Shell/res/values-ur/strings.xml index 0508e6d9a7e3..859288f003e7 100644 --- a/libs/WindowManager/Shell/res/values-ur/strings.xml +++ b/libs/WindowManager/Shell/res/values-ur/strings.xml @@ -73,8 +73,7 @@ "%1$s کو سکیڑیں" "%1$s ترتیبات" "بلبلہ برخاست کریں" - - + "مکمل اسکرین پر منتقل کریں" "گفتگو بلبلہ نہ کریں" "بلبلے کے ذریعے چیٹ کریں" "نئی گفتگوئیں فلوٹنگ آئیکن یا بلبلے کے طور پر ظاہر ہوں گی۔ بلبلہ کھولنے کے لیے تھپتھپائیں۔ اسے منتقل کرنے کے لیے گھسیٹیں۔" diff --git a/libs/WindowManager/Shell/res/values-uz/strings.xml b/libs/WindowManager/Shell/res/values-uz/strings.xml index 5de3b7bf52aa..625fc8ef7635 100644 --- a/libs/WindowManager/Shell/res/values-uz/strings.xml +++ b/libs/WindowManager/Shell/res/values-uz/strings.xml @@ -73,8 +73,7 @@ "%1$sni yopish" "%1$s sozlamalari" "Bulutchani yopish" - - + "Butun ekranga koʻchirish" "Suhbatlar bulutchalar shaklida chiqmasin" "Bulutchalar yordamida subhatlashish" "Yangi xabarlar qalqib chiquvchi belgilar yoki bulutchalar kabi chiqadi. Xabarni ochish uchun bildirishnoma ustiga bosing. Xabarni qayta joylash uchun bildirishnomani suring." diff --git a/libs/WindowManager/Shell/res/values-vi/strings.xml b/libs/WindowManager/Shell/res/values-vi/strings.xml index 9b2f8988fcca..2e643ddc41ca 100644 --- a/libs/WindowManager/Shell/res/values-vi/strings.xml +++ b/libs/WindowManager/Shell/res/values-vi/strings.xml @@ -73,8 +73,7 @@ "thu gọn %1$s" "Cài đặt %1$s" "Đóng bong bóng" - - + "Chuyển sang toàn màn hình" "Dừng sử dụng bong bóng cho cuộc trò chuyện" "Trò chuyện bằng bong bóng trò chuyện" "Các cuộc trò chuyện mới sẽ xuất hiện dưới dạng biểu tượng nổi hoặc bong bóng trò chuyện. Nhấn để mở bong bóng trò chuyện. Kéo để di chuyển bong bóng trò chuyện." diff --git a/libs/WindowManager/Shell/res/values-zh-rCN/strings.xml b/libs/WindowManager/Shell/res/values-zh-rCN/strings.xml index b45b76e876f2..f023f53e3f28 100644 --- a/libs/WindowManager/Shell/res/values-zh-rCN/strings.xml +++ b/libs/WindowManager/Shell/res/values-zh-rCN/strings.xml @@ -73,8 +73,7 @@ "收起“%1$s”" "%1$s设置" "关闭消息气泡" - - + "移至全屏" "不以消息气泡形式显示对话" "使用消息气泡聊天" "新对话会以浮动图标或消息气泡形式显示。点按即可打开消息气泡。拖动即可移动消息气泡。" diff --git a/libs/WindowManager/Shell/res/values-zh-rHK/strings.xml b/libs/WindowManager/Shell/res/values-zh-rHK/strings.xml index ae776b8c9b12..5c2ef045947a 100644 --- a/libs/WindowManager/Shell/res/values-zh-rHK/strings.xml +++ b/libs/WindowManager/Shell/res/values-zh-rHK/strings.xml @@ -73,8 +73,7 @@ "收埋%1$s" "「%1$s」設定" "關閉小視窗氣泡" - - + "移至全螢幕" "不要透過小視窗顯示對話" "使用小視窗進行即時通訊" "新對話會以浮動圖示 (小視窗) 顯示。輕按即可開啟小視窗。拖曳即可移動小視窗。" diff --git a/libs/WindowManager/Shell/res/values-zh-rTW/strings.xml b/libs/WindowManager/Shell/res/values-zh-rTW/strings.xml index 5bfc6b843aad..a362d5b5519e 100644 --- a/libs/WindowManager/Shell/res/values-zh-rTW/strings.xml +++ b/libs/WindowManager/Shell/res/values-zh-rTW/strings.xml @@ -73,8 +73,7 @@ "收合「%1$s」" "「%1$s」設定" "關閉對話框" - - + "移至全螢幕" "不要以對話框形式顯示對話" "透過對話框來聊天" "新的對話會以浮動圖示或對話框形式顯示。輕觸即可開啟對話框,拖曳則可移動對話框。" diff --git a/libs/WindowManager/Shell/res/values-zu/strings.xml b/libs/WindowManager/Shell/res/values-zu/strings.xml index 0598d62dcbb6..3a3f4313b1ae 100644 --- a/libs/WindowManager/Shell/res/values-zu/strings.xml +++ b/libs/WindowManager/Shell/res/values-zu/strings.xml @@ -73,8 +73,7 @@ "goqa %1$s" "%1$s izilungiselelo" "Cashisa ibhamuza" - - + "Hambisa esikrinini esigcwele" "Ungayibhamuzi ingxoxo" "Xoxa usebenzisa amabhamuza" "Izingxoxo ezintsha zivela njengezithonjana ezintantayo, noma amabhamuza. Thepha ukuze uvule ibhamuza. Hudula ukuze ulihambise." -- GitLab From 19618c7b82cd69204d72280d022f72f895fa630e Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 10 Sep 2024 15:34:12 -0700 Subject: [PATCH 233/492] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I17a1eee680599c03297c7454c536f525096f3803 --- packages/CompanionDeviceManager/res/values-es-rUS/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/CompanionDeviceManager/res/values-es-rUS/strings.xml b/packages/CompanionDeviceManager/res/values-es-rUS/strings.xml index 4df836511a94..63d57c40aa5a 100644 --- a/packages/CompanionDeviceManager/res/values-es-rUS/strings.xml +++ b/packages/CompanionDeviceManager/res/values-es-rUS/strings.xml @@ -52,7 +52,7 @@ "Contactos" "Calendario" "Micrófono" - "Registros de llamadas" + "Llamadas" "Dispositivos cercanos" "Cambiar la salida multimedia" "Fotos y contenido multimedia" -- GitLab From 67fde754ef58abf017978bcb031988c822c6f76a Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Thu, 5 Sep 2024 22:09:52 -0700 Subject: [PATCH 234/492] Minor cleanup of SnapTarget This CL removes a unused field on the SnapTarget class, taskPosition, in preparation for flexible split. Also streamlines 2 test cases on SplitLayoutTests in a way that I think makes more sense. Bug: 349828130 Test: Behavior is unchanged and continues to pass tests Flag: com.android.wm.shell.enable_flexible_split Change-Id: I0f12391b8037d5966b37ff94af38d455edb4d725 --- .../common/split/DividerSnapAlgorithm.java | 30 ++++++++----------- .../wm/shell/common/split/SplitLayout.java | 11 +++---- .../shell/common/split/SplitLayoutTests.java | 15 +++------- 3 files changed, 22 insertions(+), 34 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java index 8156a9c8d04a..f7f45ae36eda 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java @@ -235,7 +235,7 @@ public class DividerSnapAlgorithm { private SnapTarget snap(int position, boolean hardDismiss) { if (shouldApplyFreeSnapMode(position)) { - return new SnapTarget(position, position, SNAP_TO_NONE); + return new SnapTarget(position, SNAP_TO_NONE); } int minIndex = -1; float minDistance = Float.MAX_VALUE; @@ -263,7 +263,7 @@ public class DividerSnapAlgorithm { if (dockedSide == DOCKED_RIGHT) { startPos += mInsets.left; } - mTargets.add(new SnapTarget(startPos, startPos, SNAP_TO_START_AND_DISMISS, 0.35f)); + mTargets.add(new SnapTarget(startPos, SNAP_TO_START_AND_DISMISS, 0.35f)); switch (mSnapMode) { case SNAP_MODE_16_9: addRatio16_9Targets(isHorizontalDivision, dividerMax); @@ -278,7 +278,7 @@ public class DividerSnapAlgorithm { addMinimizedTarget(isHorizontalDivision, dockedSide); break; } - mTargets.add(new SnapTarget(dividerMax, dividerMax, SNAP_TO_END_AND_DISMISS, 0.35f)); + mTargets.add(new SnapTarget(dividerMax, SNAP_TO_END_AND_DISMISS, 0.35f)); } private void addNonDismissingTargets(boolean isHorizontalDivision, int topPosition, @@ -325,14 +325,14 @@ public class DividerSnapAlgorithm { */ private void maybeAddTarget(int position, int smallerSize, @SnapPosition int snapPosition) { if (smallerSize >= mMinimalSizeResizableTask) { - mTargets.add(new SnapTarget(position, position, snapPosition)); + mTargets.add(new SnapTarget(position, snapPosition)); } } private void addMiddleTarget(boolean isHorizontalDivision) { int position = DockedDividerUtils.calculateMiddlePosition(isHorizontalDivision, mInsets, mDisplayWidth, mDisplayHeight, mDividerSize); - mTargets.add(new SnapTarget(position, position, SNAP_TO_50_50)); + mTargets.add(new SnapTarget(position, SNAP_TO_50_50)); } private void addMinimizedTarget(boolean isHorizontalDivision, int dockedSide) { @@ -346,7 +346,7 @@ public class DividerSnapAlgorithm { position = mDisplayWidth - position - mInsets.right - mDividerSize; } } - mTargets.add(new SnapTarget(position, position, SNAP_TO_MINIMIZE)); + mTargets.add(new SnapTarget(position, SNAP_TO_MINIMIZE)); } public SnapTarget getMiddleTarget() { @@ -377,20 +377,15 @@ public class DividerSnapAlgorithm { } /** - * Represents a snap target for the divider. + * An object, calculated at boot time, representing a legal position for the split screen + * divider (i.e. the divider can be dragged to this spot). */ public static class SnapTarget { /** Position of this snap target. The right/bottom edge of the top/left task snaps here. */ public final int position; /** - * Like {@link #position}, but used to calculate the task bounds which might be different - * from the stack bounds. - */ - public final int taskPosition; - - /** - * An int describing the placement of the divider in this snap target. + * An int (enum) describing the placement of the divider in this snap target. */ public final @SnapPosition int snapPosition; @@ -402,14 +397,13 @@ public class DividerSnapAlgorithm { */ private final float distanceMultiplier; - public SnapTarget(int position, int taskPosition, @SnapPosition int snapPosition) { - this(position, taskPosition, snapPosition, 1f); + public SnapTarget(int position, @SnapPosition int snapPosition) { + this(position, snapPosition, 1f); } - public SnapTarget(int position, int taskPosition, @SnapPosition int snapPosition, + public SnapTarget(int position, @SnapPosition int snapPosition, float distanceMultiplier) { this.position = position; - this.taskPosition = taskPosition; this.snapPosition = snapPosition; this.distanceMultiplier = distanceMultiplier; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java index 2a934cba1b50..b8aa1b189f7e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java @@ -72,11 +72,12 @@ import com.android.wm.shell.common.DisplayImeController; import com.android.wm.shell.common.DisplayInsetsController; import com.android.wm.shell.common.DisplayLayout; import com.android.wm.shell.common.pip.PipUtils; +import com.android.wm.shell.common.split.DividerSnapAlgorithm.SnapTarget; +import com.android.wm.shell.protolog.ShellProtoLogGroup; import com.android.wm.shell.shared.animation.Interpolators; import com.android.wm.shell.shared.split.SplitScreenConstants.PersistentSnapPosition; import com.android.wm.shell.shared.split.SplitScreenConstants.SnapPosition; import com.android.wm.shell.shared.split.SplitScreenConstants.SplitPosition; -import com.android.wm.shell.protolog.ShellProtoLogGroup; import com.android.wm.shell.splitscreen.StageTaskListener; import java.io.PrintWriter; @@ -543,7 +544,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange * to middle position if the provided SnapTarget is not supported. */ public void setDivideRatio(@PersistentSnapPosition int snapPosition) { - final DividerSnapAlgorithm.SnapTarget snapTarget = mDividerSnapAlgorithm.findSnapTarget( + final SnapTarget snapTarget = mDividerSnapAlgorithm.findSnapTarget( snapPosition); setDividerPosition(snapTarget != null @@ -577,7 +578,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange * Sets new divider position and updates bounds correspondingly. Notifies listener if the new * target indicates dismissing split. */ - public void snapToTarget(int currentPosition, DividerSnapAlgorithm.SnapTarget snapTarget) { + public void snapToTarget(int currentPosition, SnapTarget snapTarget) { switch (snapTarget.snapPosition) { case SNAP_TO_START_AND_DISMISS: flingDividerPosition(currentPosition, snapTarget.position, FLING_RESIZE_DURATION, @@ -613,10 +614,10 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange } /** - * Returns {@link DividerSnapAlgorithm.SnapTarget} which matches passing position and velocity. + * Returns {@link SnapTarget} which matches passing position and velocity. * If hardDismiss is set to {@code true}, it will be harder to reach dismiss target. */ - public DividerSnapAlgorithm.SnapTarget findSnapTarget(int position, float velocity, + public SnapTarget findSnapTarget(int position, float velocity, boolean hardDismiss) { return mDividerSnapAlgorithm.calculateSnapTarget(position, velocity, hardDismiss); } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java index 09fcd8b02010..82b3a7de521b 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java @@ -20,8 +20,6 @@ import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static com.android.wm.shell.shared.split.SplitScreenConstants.SNAP_TO_50_50; -import static com.android.wm.shell.shared.split.SplitScreenConstants.SNAP_TO_END_AND_DISMISS; -import static com.android.wm.shell.shared.split.SplitScreenConstants.SNAP_TO_START_AND_DISMISS; import static com.google.common.truth.Truth.assertThat; @@ -150,8 +148,8 @@ public class SplitLayoutTests extends ShellTestCase { @UiThreadTest public void testSnapToDismissStart() { // verify it callbacks properly when the snap target indicates dismissing split. - DividerSnapAlgorithm.SnapTarget snapTarget = getSnapTarget(0 /* position */, - SNAP_TO_START_AND_DISMISS); + DividerSnapAlgorithm.SnapTarget snapTarget = + mSplitLayout.mDividerSnapAlgorithm.getDismissStartTarget(); mSplitLayout.snapToTarget(mSplitLayout.getDividerPosition(), snapTarget); waitDividerFlingFinished(); @@ -162,8 +160,8 @@ public class SplitLayoutTests extends ShellTestCase { @UiThreadTest public void testSnapToDismissEnd() { // verify it callbacks properly when the snap target indicates dismissing split. - DividerSnapAlgorithm.SnapTarget snapTarget = getSnapTarget(0 /* position */, - SNAP_TO_END_AND_DISMISS); + DividerSnapAlgorithm.SnapTarget snapTarget = + mSplitLayout.mDividerSnapAlgorithm.getDismissEndTarget(); mSplitLayout.snapToTarget(mSplitLayout.getDividerPosition(), snapTarget); waitDividerFlingFinished(); @@ -203,9 +201,4 @@ public class SplitLayoutTests extends ShellTestCase { new Rect(0, 0, 1080, 2160)); return configuration; } - - private static DividerSnapAlgorithm.SnapTarget getSnapTarget(int position, int flag) { - return new DividerSnapAlgorithm.SnapTarget( - position /* position */, position /* taskPosition */, flag); - } } -- GitLab From 0b67db722ae77ed7d99c0c717aa49b048c91121b Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 10 Sep 2024 15:57:02 -0700 Subject: [PATCH 235/492] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I655e1c55fabe814d3dae0ead73a4e27bb7c16337 --- packages/PrintSpooler/res/values-or/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/PrintSpooler/res/values-or/strings.xml b/packages/PrintSpooler/res/values-or/strings.xml index a29f320cabdd..4aca0a49aee5 100644 --- a/packages/PrintSpooler/res/values-or/strings.xml +++ b/packages/PrintSpooler/res/values-or/strings.xml @@ -40,7 +40,7 @@ "ପ୍ରିଣ୍ଟ ଡାୟଲଗ୍‍" "%1$d/%2$d" "%2$dରୁ %1$d ପୃଷ୍ଠା" - "ସାରାଂଶ, କପୀ %1$s, କାଗଜ ଆକାର %2$s" + "ସାରାଂଶ, କପି %1$s, କାଗଜ ଆକାର %2$s" "ହ୍ୟାଣ୍ଡେଲ୍ ବଡ଼ କରନ୍ତୁ" "ହ୍ୟାଣ୍ଡେଲ୍ ଛୋଟ କରନ୍ତୁ" "ପ୍ରିଣ୍ଟ କରନ୍ତୁ" -- GitLab From db16dfe23fec85061e93d89629f00763eda631af Mon Sep 17 00:00:00 2001 From: Rachit Jain Date: Fri, 6 Sep 2024 12:01:23 -0700 Subject: [PATCH 236/492] Revert^4 "Revert "Add userId information in Transition#AnimationOptions"" - Currently, animations are applied based on the current user. - Add user Id information from the activity record and apply animation for the specific user. - Added correct user Id when using a embedded task fragment. - Add null checks for when AnimationOptions could be null. Bug: 361162241 Flag: EXEMPT (bug fix) Test: atest CtsWindowManagerDeviceAnimations:android.server.wm.animations.ActivityTransitionTests Test: atest --user-type secondary_user_on_secondary_display CtsWindowManagerDeviceAnimations:android.server.wm.animations.ActivityTransitionTests Test: atest TransitionTests ActivityEmbeddingAnimationRunnerTests ActivityEmbeddingControllerTests ShellTransitionTests Change-Id: I985c2e30d4a3603df9ee34ca4943aba7f0cb0f3b --- core/java/android/window/TransitionInfo.java | 12 +++ .../internal/policy/TransitionAnimation.java | 79 +++++++++++++++---- .../transition/DefaultTransitionHandler.java | 21 ++--- .../server/wm/ActivityClientController.java | 12 +-- .../com/android/server/wm/ActivityRecord.java | 5 +- .../com/android/server/wm/Transition.java | 16 ++-- .../server/wm/TransitionController.java | 6 +- .../android/server/wm/TransitionTests.java | 31 ++++---- 8 files changed, 125 insertions(+), 57 deletions(-) diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java index 1083f64513b1..ec79f94a6dd3 100644 --- a/core/java/android/window/TransitionInfo.java +++ b/core/java/android/window/TransitionInfo.java @@ -1141,6 +1141,7 @@ public final class TransitionInfo implements Parcelable { // Customize activity transition animation private CustomActivityTransition mCustomActivityOpenTransition; private CustomActivityTransition mCustomActivityCloseTransition; + private int mUserId; private AnimationOptions(int type) { mType = type; @@ -1159,6 +1160,7 @@ public final class TransitionInfo implements Parcelable { mAnimations = in.readInt(); mCustomActivityOpenTransition = in.readTypedObject(CustomActivityTransition.CREATOR); mCustomActivityCloseTransition = in.readTypedObject(CustomActivityTransition.CREATOR); + mUserId = in.readInt(); } /** Make basic customized animation for a package */ @@ -1283,6 +1285,14 @@ public final class TransitionInfo implements Parcelable { return options; } + public void setUserId(int userId) { + mUserId = userId; + } + + public int getUserId() { + return mUserId; + } + public int getType() { return mType; } @@ -1349,6 +1359,7 @@ public final class TransitionInfo implements Parcelable { dest.writeInt(mAnimations); dest.writeTypedObject(mCustomActivityOpenTransition, flags); dest.writeTypedObject(mCustomActivityCloseTransition, flags); + dest.writeInt(mUserId); } @NonNull @@ -1406,6 +1417,7 @@ public final class TransitionInfo implements Parcelable { if (mExitResId != DEFAULT_ANIMATION_RESOURCES_ID) { sb.append(" exitResId=").append(mExitResId); } + sb.append(" mUserId=").append(mUserId); sb.append('}'); return sb.toString(); } diff --git a/core/java/com/android/internal/policy/TransitionAnimation.java b/core/java/com/android/internal/policy/TransitionAnimation.java index 238e6f56153b..201f26760956 100644 --- a/core/java/com/android/internal/policy/TransitionAnimation.java +++ b/core/java/com/android/internal/policy/TransitionAnimation.java @@ -49,7 +49,7 @@ import android.hardware.HardwareBuffer; import android.media.Image; import android.media.ImageReader; import android.os.Handler; -import android.os.SystemProperties; +import android.os.UserHandle; import android.util.Slog; import android.view.InflateException; import android.view.SurfaceControl; @@ -187,23 +187,44 @@ public class TransitionAnimation { return createHiddenByKeyguardExit(mContext, mInterpolator, onWallpaper, toShade, subtle); } + /** Load keyguard unocclude animation for user. */ + @Nullable + public Animation loadKeyguardUnoccludeAnimation(int userId) { + return loadDefaultAnimationRes(com.android.internal.R.anim.wallpaper_open_exit, userId); + } + + /** Same as {@code loadKeyguardUnoccludeAnimation} for current user. */ @Nullable public Animation loadKeyguardUnoccludeAnimation() { - return loadDefaultAnimationRes(com.android.internal.R.anim.wallpaper_open_exit); + return loadKeyguardUnoccludeAnimation(UserHandle.USER_CURRENT); } + /** Load voice activity open animation for user. */ @Nullable - public Animation loadVoiceActivityOpenAnimation(boolean enter) { + public Animation loadVoiceActivityOpenAnimation(boolean enter, int userId) { return loadDefaultAnimationRes(enter ? com.android.internal.R.anim.voice_activity_open_enter - : com.android.internal.R.anim.voice_activity_open_exit); + : com.android.internal.R.anim.voice_activity_open_exit, userId); } + /** Same as {@code loadVoiceActivityOpenAnimation} for current user. */ @Nullable - public Animation loadVoiceActivityExitAnimation(boolean enter) { + public Animation loadVoiceActivityOpenAnimation(boolean enter) { + return loadVoiceActivityOpenAnimation(enter, UserHandle.USER_CURRENT); + } + + /** Load voice activity exit animation for user. */ + @Nullable + public Animation loadVoiceActivityExitAnimation(boolean enter, int userId) { return loadDefaultAnimationRes(enter ? com.android.internal.R.anim.voice_activity_close_enter - : com.android.internal.R.anim.voice_activity_close_exit); + : com.android.internal.R.anim.voice_activity_close_exit, userId); + } + + /** Same as {@code loadVoiceActivityExitAnimation} for current user. */ + @Nullable + public Animation loadVoiceActivityExitAnimation(boolean enter) { + return loadVoiceActivityExitAnimation(enter, UserHandle.USER_CURRENT); } @Nullable @@ -211,10 +232,17 @@ public class TransitionAnimation { return loadAnimationRes(packageName, resId); } + /** Load cross profile app enter animation for user. */ @Nullable - public Animation loadCrossProfileAppEnterAnimation() { + public Animation loadCrossProfileAppEnterAnimation(int userId) { return loadAnimationRes(DEFAULT_PACKAGE, - com.android.internal.R.anim.task_open_enter_cross_profile_apps); + com.android.internal.R.anim.task_open_enter_cross_profile_apps, userId); + } + + /** Same as {@code loadCrossProfileAppEnterAnimation} for current user. */ + @Nullable + public Animation loadCrossProfileAppEnterAnimation() { + return loadCrossProfileAppEnterAnimation(UserHandle.USER_CURRENT); } @Nullable @@ -230,11 +258,11 @@ public class TransitionAnimation { appRect.height(), 0, null); } - /** Load animation by resource Id from specific package. */ + /** Load animation by resource Id from specific package for user. */ @Nullable - public Animation loadAnimationRes(String packageName, int resId) { + public Animation loadAnimationRes(String packageName, int resId, int userId) { if (ResourceId.isValid(resId)) { - AttributeCache.Entry ent = getCachedAnimations(packageName, resId); + AttributeCache.Entry ent = getCachedAnimations(packageName, resId, userId); if (ent != null) { return loadAnimationSafely(ent.context, resId, mTag); } @@ -242,10 +270,22 @@ public class TransitionAnimation { return null; } - /** Load animation by resource Id from android package. */ + /** Same as {@code loadAnimationRes} for current user. */ + @Nullable + public Animation loadAnimationRes(String packageName, int resId) { + return loadAnimationRes(packageName, resId, UserHandle.USER_CURRENT); + } + + /** Load animation by resource Id from android package for user. */ + @Nullable + public Animation loadDefaultAnimationRes(int resId, int userId) { + return loadAnimationRes(DEFAULT_PACKAGE, resId, userId); + } + + /** Same as {@code loadDefaultAnimationRes} for current user. */ @Nullable public Animation loadDefaultAnimationRes(int resId) { - return loadAnimationRes(DEFAULT_PACKAGE, resId); + return loadAnimationRes(DEFAULT_PACKAGE, resId, UserHandle.USER_CURRENT); } /** Load animation by attribute Id from specific LayoutParams */ @@ -378,10 +418,10 @@ public class TransitionAnimation { } @Nullable - private AttributeCache.Entry getCachedAnimations(String packageName, int resId) { + private AttributeCache.Entry getCachedAnimations(String packageName, int resId, int userId) { if (mDebug) { - Slog.v(mTag, "Loading animations: package=" - + packageName + " resId=0x" + Integer.toHexString(resId)); + Slog.v(mTag, "Loading animations: package=" + packageName + " resId=0x" + + Integer.toHexString(resId) + " for user=" + userId); } if (packageName != null) { if ((resId & 0xFF000000) == 0x01000000) { @@ -392,11 +432,16 @@ public class TransitionAnimation { + packageName); } return AttributeCache.instance().get(packageName, resId, - com.android.internal.R.styleable.WindowAnimation); + com.android.internal.R.styleable.WindowAnimation, userId); } return null; } + @Nullable + private AttributeCache.Entry getCachedAnimations(String packageName, int resId) { + return getCachedAnimations(packageName, resId, UserHandle.USER_CURRENT); + } + /** Returns window animation style ID from {@link LayoutParams} or from system in some cases */ public int getAnimationStyleResId(@NonNull LayoutParams lp) { int resId = lp.windowAnimations; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java index 4fc6c4489f2b..069daccccb39 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java @@ -18,8 +18,8 @@ package com.android.wm.shell.transition; import static android.app.ActivityOptions.ANIM_CLIP_REVEAL; import static android.app.ActivityOptions.ANIM_CUSTOM; -import static android.app.ActivityOptions.ANIM_NONE; import static android.app.ActivityOptions.ANIM_FROM_STYLE; +import static android.app.ActivityOptions.ANIM_NONE; import static android.app.ActivityOptions.ANIM_OPEN_CROSS_PROFILE_APPS; import static android.app.ActivityOptions.ANIM_SCALE_UP; import static android.app.ActivityOptions.ANIM_SCENE_TRANSITION; @@ -473,7 +473,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { change.getLeash(), startTransaction); } else if (isOnlyTranslucent && TransitionUtil.isOpeningType(info.getType()) - && TransitionUtil.isClosingType(mode)) { + && TransitionUtil.isClosingType(mode)) { // If there is a closing translucent task in an OPENING transition, we will // actually select a CLOSING animation, so move the closing task into // the animating part of the z-order. @@ -759,6 +759,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { options = info.getAnimationOptions(); } final int overrideType = options != null ? options.getType() : ANIM_NONE; + final int userId = options != null ? options.getUserId() : UserHandle.USER_CURRENT; final Rect endBounds = TransitionUtil.isClosingType(changeMode) ? mRotator.getEndBoundsInStartRotation(change) : change.getEndAbsBounds(); @@ -767,12 +768,12 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { a = mTransitionAnimation.loadKeyguardExitAnimation(flags, (changeFlags & FLAG_SHOW_WALLPAPER) != 0); } else if (type == TRANSIT_KEYGUARD_UNOCCLUDE) { - a = mTransitionAnimation.loadKeyguardUnoccludeAnimation(); + a = mTransitionAnimation.loadKeyguardUnoccludeAnimation(userId); } else if ((changeFlags & FLAG_IS_VOICE_INTERACTION) != 0) { if (isOpeningType) { - a = mTransitionAnimation.loadVoiceActivityOpenAnimation(enter); + a = mTransitionAnimation.loadVoiceActivityOpenAnimation(enter, userId); } else { - a = mTransitionAnimation.loadVoiceActivityExitAnimation(enter); + a = mTransitionAnimation.loadVoiceActivityExitAnimation(enter, userId); } } else if (changeMode == TRANSIT_CHANGE) { // In the absence of a specific adapter, we just want to keep everything stationary. @@ -783,9 +784,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { } else if (overrideType == ANIM_CUSTOM && (!isTask || options.getOverrideTaskTransition())) { a = mTransitionAnimation.loadAnimationRes(options.getPackageName(), enter - ? options.getEnterResId() : options.getExitResId()); + ? options.getEnterResId() : options.getExitResId(), userId); } else if (overrideType == ANIM_OPEN_CROSS_PROFILE_APPS && enter) { - a = mTransitionAnimation.loadCrossProfileAppEnterAnimation(); + a = mTransitionAnimation.loadCrossProfileAppEnterAnimation(userId); } else if (overrideType == ANIM_CLIP_REVEAL) { a = mTransitionAnimation.createClipRevealAnimationLocked(type, wallpaperTransit, enter, endBounds, endBounds, options.getTransitionBounds()); @@ -905,9 +906,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { final Rect bounds = change.getEndAbsBounds(); // Show the right drawable depending on the user we're transitioning to. final Drawable thumbnailDrawable = change.hasFlags(FLAG_CROSS_PROFILE_OWNER_THUMBNAIL) - ? mContext.getDrawable(R.drawable.ic_account_circle) - : change.hasFlags(FLAG_CROSS_PROFILE_WORK_THUMBNAIL) - ? mEnterpriseThumbnailDrawable : null; + ? mContext.getDrawable(R.drawable.ic_account_circle) + : change.hasFlags(FLAG_CROSS_PROFILE_WORK_THUMBNAIL) + ? mEnterpriseThumbnailDrawable : null; if (thumbnailDrawable == null) { return; } diff --git a/services/core/java/com/android/server/wm/ActivityClientController.java b/services/core/java/com/android/server/wm/ActivityClientController.java index e27b2beb3d5a..c1e859ddcccf 100644 --- a/services/core/java/com/android/server/wm/ActivityClientController.java +++ b/services/core/java/com/android/server/wm/ActivityClientController.java @@ -864,8 +864,9 @@ class ActivityClientController extends IActivityClientController.Stub { if (transition != null) { if (changed) { // Always set as scene transition because it expects to be a jump-cut. - transition.setOverrideAnimation(TransitionInfo.AnimationOptions - .makeSceneTransitionAnimOptions(), null, null); + transition.setOverrideAnimation( + TransitionInfo.AnimationOptions.makeSceneTransitionAnimOptions(), r, + null, null); r.mTransitionController.requestStartTransition(transition, null /*startTask */, null /* remoteTransition */, null /* displayChange */); @@ -910,8 +911,9 @@ class ActivityClientController extends IActivityClientController.Stub { && under.returningOptions.getAnimationType() == ANIM_SCENE_TRANSITION) { // Pass along the scene-transition animation-type - transition.setOverrideAnimation(TransitionInfo.AnimationOptions - .makeSceneTransitionAnimOptions(), null, null); + transition.setOverrideAnimation(TransitionInfo + .AnimationOptions.makeSceneTransitionAnimOptions(), r, + null, null); } } else { transition.abort(); @@ -1508,7 +1510,7 @@ class ActivityClientController extends IActivityClientController.Stub { r.mOverrideTaskTransition); r.mTransitionController.setOverrideAnimation( TransitionInfo.AnimationOptions.makeCustomAnimOptions(packageName, - enterAnim, exitAnim, backgroundColor, r.mOverrideTaskTransition), + enterAnim, exitAnim, backgroundColor, r.mOverrideTaskTransition), r, null /* startCallback */, null /* finishCallback */); } } diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 99747e05e7f0..2df0b18e617f 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -5048,7 +5048,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // controller but don't clear the animation information from the options since they // need to be sent to the animating activity. mTransitionController.setOverrideAnimation( - AnimationOptions.makeSceneTransitionAnimOptions(), null, null); + AnimationOptions.makeSceneTransitionAnimOptions(), this, null, null); return; } applyOptionsAnimation(mPendingOptions, intent); @@ -5171,7 +5171,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } if (options != null) { - mTransitionController.setOverrideAnimation(options, startCallback, finishCallback); + mTransitionController.setOverrideAnimation(options, this, startCallback, + finishCallback); } } diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index e6226ab6786d..fbab5fe01592 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -953,10 +953,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { * Set animation options for collecting transition by ActivityRecord. * @param options AnimationOptions captured from ActivityOptions */ - void setOverrideAnimation(@Nullable AnimationOptions options, + void setOverrideAnimation(@Nullable AnimationOptions options, @NonNull ActivityRecord r, @Nullable IRemoteCallback startCallback, @Nullable IRemoteCallback finishCallback) { if (!isCollecting()) return; mOverrideOptions = options; + if (mOverrideOptions != null) { + mOverrideOptions.setUserId(r.mUserId); + } sendRemoteCallback(mClientAnimationStartCallback); mClientAnimationStartCallback = startCallback; mClientAnimationFinishCallback = finishCallback; @@ -2990,7 +2993,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // Create the options based on this change's custom animations and layout // parameters animOptions = getOptions(activityRecord /* customAnimActivity */, - activityRecord /* animLpActivity */); + activityRecord /* animLpActivity */); if (!change.hasFlags(FLAG_TRANSLUCENT)) { // If this change is not translucent, its options are going to be // inherited by the changes below @@ -3012,6 +3015,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { params.getOpenAnimationResId(), params.getChangeAnimationResId(), params.getCloseAnimationResId(), 0 /* backgroundColor */, false /* overrideTaskTransition */); + animOptions.setUserId(taskFragment.getTask().mUserId); } } if (animOptions != null) { @@ -3092,6 +3096,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } else { animOptions = TransitionInfo.AnimationOptions .makeAnimOptionsFromLayoutParameters(animLp); + animOptions.setUserId(animLpActivity.mUserId); } } return animOptions; @@ -3117,6 +3122,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { if (animOptions == null) { animOptions = TransitionInfo.AnimationOptions .makeCommonAnimOptions(activity.packageName); + animOptions.setUserId(activity.mUserId); } animOptions.addCustomActivityTransition(open, customAnim.mEnterAnim, customAnim.mExitAnim, customAnim.mBackgroundColor); @@ -3901,9 +3907,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { /** @return true if all tracked subtrees are ready. */ boolean allReady() { - ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, " allReady query: used=%b " - + "override=%b defer=%d states=[%s]", mUsed, mReadyOverride, mDeferReadyDepth, - groupsToString()); + ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, + " allReady query: used=%b " + "override=%b defer=%d states=[%s]", mUsed, + mReadyOverride, mDeferReadyDepth, groupsToString()); // If the readiness has never been touched, mUsed will be false. We never want to // consider a transition ready if nothing has been reported on it. if (!mUsed) return false; diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java index 50fe69cbb50a..1d2a605e8dae 100644 --- a/services/core/java/com/android/server/wm/TransitionController.java +++ b/services/core/java/com/android/server/wm/TransitionController.java @@ -52,8 +52,8 @@ import android.window.WindowContainerTransaction; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.protolog.ProtoLogGroup; import com.android.internal.protolog.ProtoLog; +import com.android.internal.protolog.ProtoLogGroup; import com.android.server.FgThread; import com.android.window.flags.Flags; @@ -880,10 +880,10 @@ class TransitionController { } /** @see Transition#setOverrideAnimation */ - void setOverrideAnimation(TransitionInfo.AnimationOptions options, + void setOverrideAnimation(TransitionInfo.AnimationOptions options, ActivityRecord r, @Nullable IRemoteCallback startCallback, @Nullable IRemoteCallback finishCallback) { if (mCollectingTransition == null) return; - mCollectingTransition.setOverrideAnimation(options, startCallback, finishCallback); + mCollectingTransition.setOverrideAnimation(options, r, startCallback, finishCallback); } void setNoAnimation(WindowContainer wc) { diff --git a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java index 52a80b01971d..7320c0bd4666 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java @@ -2005,10 +2005,10 @@ public class TransitionTests extends WindowTestsBase { @DisableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE) @Test public void testOverrideAnimationOptionsToInfoIfNecessary_disableAnimOptionsPerChange() { - initializeOverrideAnimationOptionsTest(); + ActivityRecord r = initializeOverrideAnimationOptionsTest(); TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions .makeCommonAnimOptions("testPackage"); - mTransition.setOverrideAnimation(options, null /* startCallback */, + mTransition.setOverrideAnimation(options, r, null /* startCallback */, null /* finishCallback */); mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo); @@ -2019,10 +2019,10 @@ public class TransitionTests extends WindowTestsBase { @EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE) @Test public void testOverrideAnimationOptionsToInfoIfNecessary_fromStyleAnimOptions() { - initializeOverrideAnimationOptionsTest(); + ActivityRecord r = initializeOverrideAnimationOptionsTest(); TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions .makeCommonAnimOptions("testPackage"); - mTransition.setOverrideAnimation(options, null /* startCallback */, + mTransition.setOverrideAnimation(options, r, null /* startCallback */, null /* finishCallback */); mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo); @@ -2045,10 +2045,10 @@ public class TransitionTests extends WindowTestsBase { @EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE) @Test public void testOverrideAnimationOptionsToInfoIfNecessary_sceneAnimOptions() { - initializeOverrideAnimationOptionsTest(); + ActivityRecord r = initializeOverrideAnimationOptionsTest(); TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions .makeSceneTransitionAnimOptions(); - mTransition.setOverrideAnimation(options, null /* startCallback */, + mTransition.setOverrideAnimation(options, r, null /* startCallback */, null /* finishCallback */); mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo); @@ -2071,10 +2071,10 @@ public class TransitionTests extends WindowTestsBase { @EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE) @Test public void testOverrideAnimationOptionsToInfoIfNecessary_crossProfileAnimOptions() { - initializeOverrideAnimationOptionsTest(); + ActivityRecord r = initializeOverrideAnimationOptionsTest(); TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions .makeCrossProfileAnimOptions(); - mTransition.setOverrideAnimation(options, null /* startCallback */, + mTransition.setOverrideAnimation(options, r, null /* startCallback */, null /* finishCallback */); final TransitionInfo.Change displayChange = mInfo.getChanges().get(0); @@ -2099,13 +2099,13 @@ public class TransitionTests extends WindowTestsBase { @EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE) @Test public void testOverrideAnimationOptionsToInfoIfNecessary_customAnimOptions() { - initializeOverrideAnimationOptionsTest(); + ActivityRecord r = initializeOverrideAnimationOptionsTest(); TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions .makeCustomAnimOptions("testPackage", Resources.ID_NULL, TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID, TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID, Color.GREEN, false /* overrideTaskTransition */); - mTransition.setOverrideAnimation(options, null /* startCallback */, + mTransition.setOverrideAnimation(options, r, null /* startCallback */, null /* finishCallback */); mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo); @@ -2132,7 +2132,7 @@ public class TransitionTests extends WindowTestsBase { @EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE) @Test public void testOverrideAnimationOptionsToInfoIfNecessary_haveTaskFragmentAnimParams() { - initializeOverrideAnimationOptionsTest(); + ActivityRecord r = initializeOverrideAnimationOptionsTest(); final TaskFragment embeddedTf = mTransition.mTargets.get(2).mContainer.asTaskFragment(); embeddedTf.setAnimationParams(new TaskFragmentAnimationParams.Builder() @@ -2145,7 +2145,7 @@ public class TransitionTests extends WindowTestsBase { TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID, TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID, Color.GREEN, false /* overrideTaskTransition */); - mTransition.setOverrideAnimation(options, null /* startCallback */, + mTransition.setOverrideAnimation(options, r, null /* startCallback */, null /* finishCallback */); final TransitionInfo.Change displayChange = mInfo.getChanges().get(0); @@ -2181,13 +2181,13 @@ public class TransitionTests extends WindowTestsBase { @EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE) @Test public void testOverrideAnimationOptionsToInfoIfNecessary_customAnimOptionsWithTaskOverride() { - initializeOverrideAnimationOptionsTest(); + ActivityRecord r = initializeOverrideAnimationOptionsTest(); TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions .makeCustomAnimOptions("testPackage", Resources.ID_NULL, TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID, TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID, Color.GREEN, true /* overrideTaskTransition */); - mTransition.setOverrideAnimation(options, null /* startCallback */, + mTransition.setOverrideAnimation(options, r, null /* startCallback */, null /* finishCallback */); mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo); @@ -2213,7 +2213,7 @@ public class TransitionTests extends WindowTestsBase { options.getBackgroundColor(), activityChange.getBackgroundColor()); } - private void initializeOverrideAnimationOptionsTest() { + private ActivityRecord initializeOverrideAnimationOptionsTest() { mTransition = createTestTransition(TRANSIT_OPEN); // Test set AnimationOptions for Activity and Task. @@ -2241,6 +2241,7 @@ public class TransitionTests extends WindowTestsBase { embeddedTf.getAnimationLeash())); mInfo.addChange(new TransitionInfo.Change(null /* container */, nonEmbeddedActivity.getAnimationLeash())); + return nonEmbeddedActivity; } @Test -- GitLab From 675ceaa52f1300143bc97b26c2785c4dea797263 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 10 Sep 2024 16:04:39 -0700 Subject: [PATCH 237/492] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: Ibf63ffa2ad0715f3eb2f15a6b35ab9c447af4786 --- packages/SystemUI/res/values-af/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-am/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-ar/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-as/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-az/strings.xml | 40 +++++++++------ .../SystemUI/res/values-b+sr+Latn/strings.xml | 41 +++++++++------- packages/SystemUI/res/values-be/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-bg/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-bn/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-bs/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ca/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-cs/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-da/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-de/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-el/strings.xml | 40 +++++++++------ .../SystemUI/res/values-en-rAU/strings.xml | 40 +++++++++------ .../SystemUI/res/values-en-rCA/strings.xml | 8 +++ .../SystemUI/res/values-en-rGB/strings.xml | 40 +++++++++------ .../SystemUI/res/values-en-rIN/strings.xml | 40 +++++++++------ .../SystemUI/res/values-en-rXC/strings.xml | 8 +++ .../SystemUI/res/values-es-rUS/strings.xml | 22 +++++++-- packages/SystemUI/res/values-es/strings.xml | 21 ++++++-- packages/SystemUI/res/values-et/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-eu/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-fa/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-fi/strings.xml | 40 +++++++++------ .../SystemUI/res/values-fr-rCA/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-fr/strings.xml | 24 +++++++-- packages/SystemUI/res/values-gl/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-gu/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-hi/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-hr/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-hu/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-hy/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-in/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-is/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-it/strings.xml | 22 +++++++-- packages/SystemUI/res/values-iw/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ja/strings.xml | 49 +++++++++++-------- packages/SystemUI/res/values-ka/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-kk/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-km/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-kn/strings.xml | 43 +++++++++------- packages/SystemUI/res/values-ko/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ky/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-lo/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-lt/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-lv/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-mk/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ml/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-mn/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-mr/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-ms/strings.xml | 33 ++++++++----- packages/SystemUI/res/values-my/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-nb/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ne/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-nl/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-or/strings.xml | 42 +++++++++------- packages/SystemUI/res/values-pa/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-pl/strings.xml | 42 +++++++++------- .../SystemUI/res/values-pt-rBR/strings.xml | 40 +++++++++------ .../SystemUI/res/values-pt-rPT/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-pt/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ro/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ru/strings.xml | 41 +++++++++------- packages/SystemUI/res/values-si/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-sk/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-sl/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-sq/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-sr/strings.xml | 41 +++++++++------- packages/SystemUI/res/values-sv/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-sw/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ta/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-te/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-th/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-tl/strings.xml | 33 ++++++++----- packages/SystemUI/res/values-tr/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-uk/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-ur/strings.xml | 39 +++++++++------ packages/SystemUI/res/values-uz/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-vi/strings.xml | 40 +++++++++------ .../SystemUI/res/values-zh-rCN/strings.xml | 40 +++++++++------ .../SystemUI/res/values-zh-rHK/strings.xml | 40 +++++++++------ .../SystemUI/res/values-zh-rTW/strings.xml | 40 +++++++++------ packages/SystemUI/res/values-zu/strings.xml | 40 +++++++++------ 85 files changed, 1961 insertions(+), 1285 deletions(-) diff --git a/packages/SystemUI/res/values-af/strings.xml b/packages/SystemUI/res/values-af/strings.xml index 2a669de9aeee..0fb0aaf20fe2 100644 --- a/packages/SystemUI/res/values-af/strings.xml +++ b/packages/SystemUI/res/values-af/strings.xml @@ -105,6 +105,8 @@ "Voeg by nota" "Sluit skakel in" "%1$s (%2$d)" + + "Skermopnemer" "Verwerk tans skermopname" "Deurlopende kennisgewing vir \'n skermopnamesessie" @@ -292,8 +294,7 @@ "Sluimerskerm" "Ethernet" "Moenie Steur Nie" - - + "Modusse" "Bluetooth" "Geen saamgebinde toestelle beskikbaar nie" "Tik om ’n toestel te koppel of ontkoppel" @@ -434,8 +435,7 @@ "Maak Instellings oop" "Ander toestel" "Wissel oorsig" - - + "Modusse" "Klaar" "Instellings" "Aan" @@ -1393,18 +1393,12 @@ "Vou ikoon in" "Vou ikoon uit" "of" - - - - - - - - - - - - + "Navigeer met jou sleutelbord" + "Leer kortpadsleutels" + "Navigeer met jou raakpaneel" + "Leer raakpaneelgebare" + "Navigeer met jou sleutelbord en raakpaneel" + "Leer raakpaneelgebare, kortpadsleutels en meer" "Teruggebaar" "Tuisgebaar" "Handelingsleutel" @@ -1444,4 +1438,18 @@ "Jy kan nou die skerm ekstra donker maak deur die helderheidvlak vanaf die bokant van jou skerm nog laer te maak.\n\nDit werk die beste wanneer jy in ’n donker omgewing is." "Verwyder kortpad vir ekstra donker" "Kortpad vir ekstra donker is verwyder. Gebruik die gewone helderheidbalk om jou helderheid te verlaag." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-am/strings.xml b/packages/SystemUI/res/values-am/strings.xml index f7f97635b34d..286acea48dd3 100644 --- a/packages/SystemUI/res/values-am/strings.xml +++ b/packages/SystemUI/res/values-am/strings.xml @@ -105,6 +105,7 @@ "ወደ ማስታወሻ አክል" "አገናኝ አካትት" "%1$s(%2$d)" + "አገናኞች ከሌሎች መገለጫዎች ሊታከሉ አይችሉም" "የማያ መቅረጫ" "የማያ ገፅ ቀረጻን በማሰናዳት ላይ" "ለአንድ የማያ ገፅ ቀረጻ ክፍለ-ጊዜ በመካሄድ ያለ ማሳወቂያ" @@ -292,8 +293,7 @@ "የማያ ገፅ ማቆያ" "ኤተርኔት" "አትረብሽ" - - + "ሁነታዎች" "ብሉቱዝ" "ምንም የተጣመሩ መሣሪያዎች አይገኝም" "መሣሪያን ለማገናኘት ወይም ግንኙነቱን ለማቋረጥ መታ ያድርጉ" @@ -434,8 +434,7 @@ "ቅንብሮችን ክፈት" "ሌላ መሣሪያ" "አጠቃላይ እይታን ቀያይር" - - + "ሁነታዎች" "ተከናውኗል" "ቅንብሮች" "በርቷል" @@ -1393,18 +1392,12 @@ "መሰብሰቢያ አዶ" "መዘርጊያ አዶ" "ወይም" - - - - - - - - - - - - + "የቁልፍ ሰሌዳዎን በመጠቀም ያስሱ" + "የቁልፍ ሰሌዳ አቋራጮችን ይወቁ" + "የመዳሰሻ ሰሌዳዎን በመጠቀም ያስሱ" + "የመዳሰሻ ሰሌዳ ምልክቶችን ይወቁ" + "የእርስዎን የቁልፍ ሰሌዳ እና የመዳሰሻ ሰሌዳ በመጠቀም ያስሱ" + "የመዳሰሻ ሰሌዳ ምልክቶችን፣ የቁልፍ ሰሌዳ አቋራጮችን እና ሌሎችን ይወቁ" "የተመለስ ምልክት" "የቤት ምልክት" "የተግባር ቁልፍ" @@ -1444,4 +1437,18 @@ "አሁን ከማያ ገፅዎ በላይ የብሩህነት ደረጃውን ይበልጥ በመቀነስ ማያ ገፁን ተጨማሪ ደብዛዛ ማድረግ ይችላሉ።\n\nይህ በጨለማ አካባቢ ውስጥ ሲሆኑ በተሻለ ይሠራል።" "ተጨማሪ ደብዛዛ አቋራጭን አስወግድ" "የተጨማሪ ደብዛዛ አቋራጭን ያስወግዱ። የእርስዎን ብሩሃማነት ለመቀነስ መደበኛ የብሩሃማነት አሞሌውን ይጠቀሙ።" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml index 5d6b90808aa4..5b844f238028 100644 --- a/packages/SystemUI/res/values-ar/strings.xml +++ b/packages/SystemUI/res/values-ar/strings.xml @@ -105,6 +105,8 @@ "إضافة إلى الملاحظة" "تضمين الرابط" "‫%1$s(%2$d)" + + "مسجّل الشاشة" "جارٍ معالجة تسجيل الشاشة" "إشعار مستمر لجلسة تسجيل شاشة" @@ -292,8 +294,7 @@ "شاشة الاستراحة" "Ethernet" "عدم الإزعاج" - - + "الأوضاع" "بلوتوث" "لا يتوفر أي أجهزة مقترنة" "انقر للاتصال بجهاز أو قطع الاتصال به" @@ -434,8 +435,7 @@ "فتح الإعدادات" "جهاز آخر" "تبديل \"النظرة العامة\"" - - + "الأوضاع" "تم" "الإعدادات" "مفعَّل" @@ -1393,18 +1393,12 @@ "رمز التصغير" "رمز التوسيع" "أو" - - - - - - - - - - - - + "التنقّل باستخدام لوحة المفاتيح" + "تعرَّف على اختصارات لوحة المفاتيح" + "التنقّل باستخدام لوحة اللمس" + "تعرَّف على إيماءات لوحة اللمس" + "التنقّل باستخدام لوحة المفاتيح ولوحة اللمس" + "تعرَّف على إيماءات لوحة اللمس واختصارات لوحة المفاتيح والمزيد" "إيماءة الرجوع" "إيماءة الانتقال إلى الشاشة الرئيسية" "مفتاح الإجراء" @@ -1444,4 +1438,18 @@ "يمكنك الآن زيادة تعتيم الشاشة عن طريق خفض مستوى السطوع بشكل أكبر من أعلى الشاشة.\n\nيُعد هذا الخيار مناسبًا عندما تكون في مكان مظلم." "إزالة اختصار \"زيادة تعتيم الشاشة\"" "تمت إزالة اختصار \"زيادة تعتيم الشاشة\". لخفض مستوى سطوع شاشتك، استخدِم شريط مستوى السطوع العادي." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-as/strings.xml b/packages/SystemUI/res/values-as/strings.xml index 2e8a552012dd..06f28f11f3a4 100644 --- a/packages/SystemUI/res/values-as/strings.xml +++ b/packages/SystemUI/res/values-as/strings.xml @@ -105,6 +105,7 @@ "টোকাত যোগ দিয়ক" "লিংক অন্তৰ্ভুক্ত কৰক" "%1$s (%2$d)⁠" + "অন্য প্ৰ’ফাইলৰ পৰা লিংক যোগ দিব নোৱাৰি" "স্ক্ৰীন ৰেকৰ্ডাৰ" "স্ক্রীন ৰেকৰ্ডিঙৰ প্ৰক্ৰিয়াকৰণ হৈ আছে" "স্ক্রীন ৰেকৰ্ডিং ছেশ্বন চলি থকা সময়ত পোৱা জাননী" @@ -292,8 +293,7 @@ "স্ক্ৰীন ছেভাৰ" "ইথাৰনেট" "অসুবিধা নিদিব" - - + "ম’ড" "ব্লুটুথ" "কোনো যোৰা লগোৱা ডিভাইচ উপলব্ধ নহয়।" "ডিভাইচ সংযোগ কৰিবলৈ অথবা সংযোগ বিচ্ছিন্ন কৰিবলৈ টিপক" @@ -434,8 +434,7 @@ "ছেটিং খোলক" "অন্য ডিভাইচ" "অৱলোকন ট’গল কৰক" - - + "ম’ড" "কৰা হ’ল" "ছেটিং" "অন আছে" @@ -1393,18 +1392,12 @@ "সংকোচন কৰাৰ চিহ্ন" "বিস্তাৰ কৰাৰ চিহ্ন" "অথবা" - - - - - - - - - - - - + "কীব’ৰ্ড ব্যৱহাৰ কৰি নেভিগে’ট কৰক" + "কীব’ৰ্ডৰ শ্বৰ্টকাটসমূহৰ বিষয়ে জানক" + "আপোনাৰ টাচ্চপেড ব্যৱহাৰ কৰি নেভিগে’ট কৰক" + "টাচ্চপেডৰ নিৰ্দেশসমূহ জানক" + "আপোনাৰ কীব’ৰ্ড আৰু টাচ্চপেড ব্যৱহাৰ কৰি নেভিগে’ট কৰক" + "টাচ্চপেডৰ নিৰ্দেশ, কীব’ৰ্ডৰ শ্বৰ্টকাট আৰু অধিকৰ বিষয়ে জানক" "উভতি যাওক নিৰ্দেশ" "গৃহ স্ক্ৰীনলৈ যোৱাৰ নিৰ্দেশ" "কাৰ্য কী" @@ -1444,4 +1437,18 @@ "আপুনি এতিয়া আপোনাৰ স্ক্ৰীনৰ একেবাৰে ওপৰৰ পৰা উজ্জ্বলতাৰ স্তৰ আৰু অধিক হ্ৰাস কৰি স্ক্ৰীনখন এক্সট্ৰা ডিম কৰিব পাৰে।\n\nআপুনি অন্ধকাৰ পৰিৱেশত থাকিলে এই সুবিধাটোৱে আটাইতকৈ ভাল কাম কৰে।" "এক্সট্ৰা ডিম শ্বৰ্টকাট আঁতৰাওক" "এক্সট্ৰা ডিম শ্বৰ্টকাট আঁতৰোৱা হৈছে। আপোনাৰ উজ্জ্বলতা হ্ৰাস কৰিবলৈ, নিয়মীয়া উজ্জ্বলতা বাৰ ব্যৱহাৰ কৰক।" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-az/strings.xml b/packages/SystemUI/res/values-az/strings.xml index b011ca646f5d..24ab6aecaff0 100644 --- a/packages/SystemUI/res/values-az/strings.xml +++ b/packages/SystemUI/res/values-az/strings.xml @@ -105,6 +105,8 @@ "Qeydə əlavə edin" "Keçid daxil edin" "%1$s(%2$d)" + + "Ekran yazıcısı" "Ekran çəkilişi emal edilir" "Ekranın video çəkimi ərzində silinməyən bildiriş" @@ -292,8 +294,7 @@ "Ekran qoruyucu" "Ethernet" "Narahat etməyin" - - + "Rejimlər" "Bluetooth" "Heç bir cütlənmiş cihaz əlçatan deyil" "Toxunaraq cihaza qoşulun, yaxud əlaqəni ayırın" @@ -434,8 +435,7 @@ "Ayarları açın" "Digər cihaz" "İcmala Keçin" - - + "Rejimlər" "Hazırdır" "Ayarlar" "Aktiv" @@ -1393,18 +1393,12 @@ "İkonanı yığcamlaşdırın" "İkonanı genişləndirin" "və ya" - - - - - - - - - - - - + "Klaviaturadan istifadə edərək hərəkət edin" + "Klaviatura qısayolları haqqında öyrənin" + "Taçpeddən istifadə edərək hərəkət edin" + "Taçped jestlərini öyrənin" + "Klaviatura və taçpeddən istifadə edərək hərəkət edin" + "Taçped jestləri, klaviatura qısayolları və s. haqqında öyrənin" "Geri jesti" "Əsas ekran jesti" "Əməliyyat düyməsi" @@ -1444,4 +1438,18 @@ "İndi ekranın yuxarısında parlaqlıq səviyyəsini daha da aşağı salaraq ekranı əlavə qaralda bilərsiniz.\n\nTünd mühitdə olduqda nəticə yaxşı olur." "Əlavə qaraltma qısayolunu silin" "Əlavə qaraltma qısayolu silindi. Parlaqlığı aşağı salmaq üçün adi parlaqlıq panelindən istifadə edin." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-b+sr+Latn/strings.xml b/packages/SystemUI/res/values-b+sr+Latn/strings.xml index c581fd5b0488..5efa223dcd9a 100644 --- a/packages/SystemUI/res/values-b+sr+Latn/strings.xml +++ b/packages/SystemUI/res/values-b+sr+Latn/strings.xml @@ -105,6 +105,7 @@ "Dodaj u belešku" "Uvrsti link" "%1$s (%2$d)" + "Ne možete da dodate linkove sa drugih profila" "Snimač ekrana" "Obrađujemo video snimka ekrana" "Obaveštenje o sesiji snimanja ekrana je aktivno" @@ -292,8 +293,7 @@ "Čuvar ekrana" "Eternet" "Ne uznemiravaj" - - + "Režimi" "Bluetooth" "Nije dostupan nijedan upareni uređaj" "Dodirnite da biste povezali uređaj ili prekinuli vezu" @@ -434,8 +434,7 @@ "Otvori Podešavanja" "Drugi uređaj" "Uključi/isključi pregled" - - + "Režimi" "Gotovo" "Podešavanja" "Uključeno" @@ -488,7 +487,7 @@ "Odbaci" "Dodajte, uklonite i preuredite vidžete ovde" "Dodajte još vidžeta" - "Dugi pritisak za prilagođavanje vidžeta" + "Dugo pritisnite za prilagođavanje vidžeta" "Prilagodi vidžete" "Otključajte da biste prilagodili vidžete" "Ikona aplikacije za onemogućen vidžet" @@ -1393,18 +1392,12 @@ "Ikona za skupljanje" "Ikona za proširivanje" "ili" - - - - - - - - - - - - + "Krećite se pomoću tastature" + "Saznajte više o tasterskim prečicama" + "Krećite se pomoću tačpeda" + "Naučite pokrete za tačped" + "Krećite se pomoću tastature i tačpeda" + "Naučite pokrete za tačped, tasterske prečice i drugo" "Pokret za vraćanje" "Pokret za početnu stranicu" "Taster radnji" @@ -1444,4 +1437,18 @@ "Sada možete dodatno da zatamnite ekran smanjivanjem nivoa osvetljenosti pri vrhu ekrana. \n\nOvo najbolje funkcioniše kada ste u tamnom okruženju." "Ukloni prečicu za dodatno zatamnjivanje" "Uklonjena je prečica za dodatno zatamnjivanje. Da biste smanjili osvetljenost, koristite uobičajenu traku za osvetljenost." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-be/strings.xml b/packages/SystemUI/res/values-be/strings.xml index 31854f6822c2..435d8339f943 100644 --- a/packages/SystemUI/res/values-be/strings.xml +++ b/packages/SystemUI/res/values-be/strings.xml @@ -105,6 +105,7 @@ "Дадаць у нататку" "Дадаць спасылку" "%1$s (%2$d)" + "Спасылкі нельга дадаваць з іншых профіляў" "Запіс экрана" "Апрацоўваецца запіс экрана" "Бягучае апавяшчэнне для сеанса запісу экрана" @@ -292,8 +293,7 @@ "Экранная застаўка" "Ethernet" "Не турбаваць" - - + "Рэжымы" "Bluetooth" "Няма даступных спалучаных прылад" "Націсніце, каб падключыць або адключыць прыладу" @@ -434,8 +434,7 @@ "Адкрыць налады" "Іншая прылада" "Уключыць/выключыць агляд" - - + "Рэжымы" "Гатова" "Налады" "Уключана" @@ -1393,18 +1392,12 @@ "Значок \"Згарнуць\"" "Значок \"Разгарнуць\"" "або" - - - - - - - - - - - - + "Навігацыя з дапамогай клавіятуры" + "Азнаёмцеся са спалучэннямі клавіш" + "Навігацыя з дапамогай сэнсарнай панэлі" + "Азнаёмцеся з жэстамі для сэнсарнай панэлі" + "Навігацыя з дапамогай клавіятуры і сэнсарнай панэлі" + "Азнаёмцеся з жэстамі для сэнсарнай панэлі, спалучэннямі клавіш і г. д." "Жэст для вяртання на папярэдні экран" "Жэст для вяртання на галоўны экран" "Клавіша дзеяння" @@ -1444,4 +1437,18 @@ "Цяпер вы можаце дадаткова зацямніць экран, яшчэ больш панізіўшы ўзровень яркасці праз налады ўверсе экрана.\n\nГэта функцыя працуе лепш за ўсё ў цёмным асяроддзі." "Выдаліць хуткую каманду для дадатковага памяншэння яркасці" "Хуткая каманда для дадатковага памяншэння яркасці выдалена. Каб паменшыць яркасць, выкарыстоўвайце звычайную панэль яркасці." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-bg/strings.xml b/packages/SystemUI/res/values-bg/strings.xml index 64ecfd3c0243..adbc13ab590f 100644 --- a/packages/SystemUI/res/values-bg/strings.xml +++ b/packages/SystemUI/res/values-bg/strings.xml @@ -105,6 +105,8 @@ "Добавяне към бележката" "Включване на връзката" "%1$s (%2$d)" + + "Запис на екрана" "Записът на екрана се обработва" "Текущо известие за сесия за записване на екрана" @@ -292,8 +294,7 @@ "Скрийнсейвър" "Ethernet" "Не безпокойте" - - + "Режими" "Bluetooth" "Няма налични сдвоени устройства" "Докоснете, за да свържете устройство или да прекъснете връзката му" @@ -434,8 +435,7 @@ "Към настройките" "Друго устройство" "Превключване на общия преглед" - - + "Режими" "Готово" "Настройки" "Вкл." @@ -1393,18 +1393,12 @@ "Икона за свиване" "Икона за разгъване" "или" - - - - - - - - - - - - + "Навигирайте посредством клавиатурата си" + "Научете за клавишните комбинации" + "Навигирайте посредством сензорния панел" + "Научете за жестовете със сензорния панел" + "Навигирайте посредством клавиатурата и сензорния панел" + "Научете за жестовете със сензорния панел, клавишните комбинации и др." "Жест за връщане назад" "Жест за преминаване към началния екран" "Клавиш за действия" @@ -1444,4 +1438,18 @@ "Вече можете да затъмнявате екрана допълнително, като намалявате яркостта още повече от лентата в горната му част.\n\nТова е най-полезно, когато сте на тъмно място." "Премахване на прекия път за допълнително затъмняване" "Прекият път за допълнително затъмняване е премахнат. За да намалите яркостта, използвайте обикновената лента за управлението ѝ." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-bn/strings.xml b/packages/SystemUI/res/values-bn/strings.xml index f62ee9ecaa34..2aa7786774f9 100644 --- a/packages/SystemUI/res/values-bn/strings.xml +++ b/packages/SystemUI/res/values-bn/strings.xml @@ -105,6 +105,8 @@ "নোটে যোগ করুন" "লিঙ্ক যোগ করুন" "%1$s (%2$d)" + + "স্ক্রিন রেকর্ডার" "স্ক্রিন রেকর্ডিং প্রসেস হচ্ছে" "স্ক্রিন রেকর্ডিং সেশন চলার বিজ্ঞপ্তি" @@ -292,8 +294,7 @@ "স্ক্রিন সেভার" "ইথারনেট" "বিরক্ত করবে না" - - + "মোড" "ব্লুটুথ" "চেনা কোনও ডিভাইস নেই" "কোনও ডিভাইস কানেক্ট বা ডিসকানেক্ট করতে ট্যাপ করুন" @@ -434,8 +435,7 @@ "সেটিংস খুলুন" "অন্য ডিভাইস" "\'এক নজরে\' বৈশিষ্ট্যটি চালু বা বন্ধ করুন" - - + "মোড" "হয়ে গেছে" "সেটিংস" "চালু আছে" @@ -1393,18 +1393,12 @@ "আইকন আড়াল করুন" "আইকন বড় করুন" "অথবা" - - - - - - - - - - - - + "আপনার কীবোর্ড ব্যবহার করে নেভিগেট করুন" + "কীবোর্ড শর্টকাট সম্পর্কে জানুন" + "আপনার টাচপ্যাড ব্যবহার করে নেভিগেট করুন" + "টাচপ্যাডের জেসচার সম্পর্কে জানুন" + "আপনার কীবোর্ড এবং টাচপ্যাড ব্যবহার করে নেভিগেট করুন" + "টাচপ্যাড জেসচার, কীবোর্ড শর্টকাট এবং আরও অনেক কিছু সম্পর্কে জানুন" "ফিরে যাওয়ার জেসচার" "হোমপেজে যাওয়ার জেসচার" "অ্যাকশন কী" @@ -1444,4 +1438,18 @@ "আপনি এখন স্ক্রিনের উপর থেকে ব্রাইটনেস লেভেল কমিয়েও, স্ক্রিন অতিরিক্ত কম ব্রাইট করতে পারবেন।\n\nআপনি অন্ধকার পরিবেশে থাকলে এটি সবথেকে ভালো কাজ করে।" "\'অতিরিক্ত কম ব্রাইটনেস\' ফিচারের শর্টকাট সরান" "\'অতিরিক্ত কম ব্রাইটনেস\' ফিচারের শর্টকাট সরানো হয়েছে। আপনার ব্রাইটনেস কম করতে, সাধারণ ব্রাইটনেস বার ব্যবহার করুন।" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-bs/strings.xml b/packages/SystemUI/res/values-bs/strings.xml index 51416ef326ef..4802af846eda 100644 --- a/packages/SystemUI/res/values-bs/strings.xml +++ b/packages/SystemUI/res/values-bs/strings.xml @@ -105,6 +105,8 @@ "Dodaj u bilješku" "Uključi link" "%1$s (%2$d)⁠" + + "Snimač ekrana" "Obrađivanje snimka ekrana" "Obavještenje za sesiju snimanja ekrana je u toku" @@ -292,8 +294,7 @@ "Čuvar ekrana" "Ethernet" "Ne ometaj" - - + "Načini rada" "Bluetooth" "Nema dostupnih uparenih uređaja" "Dodirnite da povežete ili prekinete povezanost uređaja" @@ -434,8 +435,7 @@ "Otvori Postavke" "Drugi uređaj" "Pregled uključivanja/isključivanja" - - + "Načini rada" "Gotovo" "Postavke" "Uključeno" @@ -1393,18 +1393,12 @@ "Ikona sužavanja" "Ikona proširivanja" "ili" - - - - - - - - - - - - + "Krećite se pomoću tastature" + "Saznajte više o prečicama tastature" + "Krećite se pomoću dodirne podloge" + "Saznajte više o pokretima na dodirnoj podlozi" + "Krećite se pomoću tastature i dodirne podloge" + "Saznajte više o pokretima na dodirnoj podlozi, prečicama tastature i drugim opcijama" "Pokret za povratak" "Pokret za povratak na početni ekran" "Tipka radnji" @@ -1444,4 +1438,18 @@ "Sada možete dodatno zatamniti ekran daljnjim smanjenjem nivoa osvijetljenosti s vrha ekrana.\n\nOvo najbolje funkcionira u tamnom okruženju." "Ukloni prečicu za dodatno zatamnjenje" "Prečica za dodatno zatamnjenje je uklonjena. Da smanjite osvijetljenost, koristite običnu traku za osvijetljenost." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml index 182fe02a371c..10fedd8ce7a4 100644 --- a/packages/SystemUI/res/values-ca/strings.xml +++ b/packages/SystemUI/res/values-ca/strings.xml @@ -105,6 +105,8 @@ "Afegeix a una nota" "Inclou l\'enllaç" "%1$s (%2$d)" + + "Gravació de pantalla" "Processant gravació de pantalla" "Notificació en curs d\'una sessió de gravació de la pantalla" @@ -292,8 +294,7 @@ "Estalvi de pantalla" "Ethernet" "No molestis" - - + "Modes" "Bluetooth" "No hi ha dispositius vinculats disponibles" "Toca per connectar o desconnectar un dispositiu" @@ -434,8 +435,7 @@ "Obre Configuració" "Un altre dispositiu" "Activa o desactiva Aplicacions recents" - - + "Modes" "Fet" "Configuració" "Activat" @@ -1393,18 +1393,12 @@ "Replega la icona" "Desplega la icona" "o" - - - - - - - - - - - - + "Navega amb el teclat" + "Aprèn les tecles de drecera" + "Navega amb el ratolí tàctil" + "Aprèn els gestos del ratolí tàctil" + "Navega amb el teclat i el ratolí tàctil" + "Aprèn els gestos del ratolí tàctil, les tecles de drecera i més" "Gest Enrere" "Gest Inici" "Tecla d\'acció" @@ -1444,4 +1438,18 @@ "Ara pots atenuar encara més la pantalla abaixant-ne el nivell de brillantor des de la part superior.\n\nFunciona millor si et trobes en un lloc fosc." "Suprimeix la drecera d\'atenuació extra" "S\'ha suprimit la drecera d\'atenuació extra. Per abaixar la brillantor, utilitza la barra de brillantor normal." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-cs/strings.xml b/packages/SystemUI/res/values-cs/strings.xml index cebb175e4ae7..f995b294a477 100644 --- a/packages/SystemUI/res/values-cs/strings.xml +++ b/packages/SystemUI/res/values-cs/strings.xml @@ -105,6 +105,7 @@ "Přidat do poznámky" "Zahrnout odkaz" "%1$s (%2$d)" + "Nelze přidat odkazy z jiných profilů" "Nahrávání obrazovky" "Záznam obrazovky se zpracovává" "Trvalé oznámení o relaci nahrávání" @@ -292,8 +293,7 @@ "Spořič obrazovky" "Ethernet" "Nerušit" - - + "Režimy" "Bluetooth" "Nejsou dostupná žádná spárovaná zařízení" "Klepnutím zařízení připojíte nebo odpojíte" @@ -434,8 +434,7 @@ "Otevřít nastavení" "Další zařízení" "Přepnout přehled" - - + "Režimy" "Hotovo" "Nastavení" "Zapnuto" @@ -1393,18 +1392,12 @@ "Ikona sbalení" "Ikona rozbalení" "nebo" - - - - - - - - - - - - + "Navigujte pomocí klávesnice" + "Naučte se klávesové zkratky" + "Navigujte pomocí touchpadu" + "Naučte se gesta touchpadu" + "Navigujte pomocí klávesnice a touchpadu" + "Naučte se gesta touchpadu, klávesové zkratky a další" "Gesto zpět" "Gesto domů" "Akční klávesa" @@ -1444,4 +1437,18 @@ "Obrazovku můžete v horní části nastavit jako velmi tmavou tím, že ještě víc snížíte jas.\n\nNejlépe to funguje ve tmavém prostředí." "Odstranit zkratku pro velmi tmavou obrazovku" "Zkratka pro velmi tmavou obrazovku byla odstraněna. Jas můžete snížit pomocí standardního sloupce jasu." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml index 974083e5ffa8..3b74a6db4bdd 100644 --- a/packages/SystemUI/res/values-da/strings.xml +++ b/packages/SystemUI/res/values-da/strings.xml @@ -105,6 +105,8 @@ "Føj til note" "Inkluder link" "%1$s (%2$d)" + + "Skærmoptagelse" "Behandler skærmoptagelse" "Konstant notifikation om skærmoptagelse" @@ -292,8 +294,7 @@ "Pauseskærm" "Ethernet" "Forstyr ikke" - - + "Tilstande" "Bluetooth" "Der er ingen tilgængelige parrede enheder" "Tryk for at oprette eller afbryde forbindelse til en enhed" @@ -434,8 +435,7 @@ "Åbn Indstillinger" "Anden enhed" "Slå Oversigt til/fra" - - + "Tilstande" "Udfør" "Indstillinger" "Til" @@ -1393,18 +1393,12 @@ "Ikon for Skjul" "Ikon for Udvid" "eller" - - - - - - - - - - - - + "Naviger ved hjælp af dit tastatur" + "Se tastaturgenveje" + "Naviger ved hjælp af din touchplade" + "Se bevægelser på touchpladen" + "Naviger ved hjælp af dit tastatur og din touchplade" + "Se bevægelser på touchpladen, tastaturgenveje m.m." "Bevægelse for at gå tilbage" "Bevægelse for at gå til startskærm" "Handlingstast" @@ -1444,4 +1438,18 @@ "Du kan nu dæmpe skærmens belysning ekstra meget ved at reducere lysstyrken endnu mere fra toppen af skærmen.\n\nDette fungerer bedst i mørke omgivelser." "Fjern genvejen til ekstra dæmpet belysning" "Genvejen til ekstra dæmpet belysning er fjernet. Brug den almindelige lysstyrkebjælke til at reducere lysstyrken." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml index 11dd46e5b11f..fa7ad567e0b9 100644 --- a/packages/SystemUI/res/values-de/strings.xml +++ b/packages/SystemUI/res/values-de/strings.xml @@ -105,6 +105,8 @@ "Zu Notiz hinzufügen" "Link einschließen" "%1$s (%2$d)" + + "Bildschirmaufzeichnung" "Bildschirmaufzeichnung…" "Fortlaufende Benachrichtigung für eine Bildschirmaufzeichnung" @@ -292,8 +294,7 @@ "Bildschirmschoner" "Ethernet" "Bitte nicht stören" - - + "Modi" "Bluetooth" "Keine gekoppelten Geräte verfügbar" "Zum Verbinden oder Trennen eines Geräts tippen" @@ -434,8 +435,7 @@ "Einstellungen öffnen" "Sonstiges Gerät" "Übersicht ein-/ausblenden" - - + "Modi" "Fertig" "Einstellungen" "An" @@ -1393,18 +1393,12 @@ "Symbol „Minimieren“" "Symbol „Maximieren“" "oder" - - - - - - - - - - - - + "Navigation mit der Tastatur" + "Informationen zu Tastenkombinationen" + "Navigation mit dem Touchpad" + "Informationen zu Touchpad-Gesten" + "Navigation mit Tastatur und Touchpad" + "Informationen zu Touchpad-Gesten, Tastenkombinationen und mehr" "Touch-Geste „Zurück“" "Touch-Geste „Startbildschirm“" "Aktionstaste" @@ -1444,4 +1438,18 @@ "Du kannst das Display jetzt extradunkel machen, indem du die Helligkeit vom oberen Displayrand aus noch weiter senkst.\n\nDas funktioniert in dunklen Umgebungen am besten." "Verknüpfung für „Extradunkel“ entfernen" "Verknüpfung für „Extradunkel“ wurde entfernt. Wenn du die Helligkeit reduzieren möchtest, verwende einfach die normale Helligkeitsleiste." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-el/strings.xml b/packages/SystemUI/res/values-el/strings.xml index 433137cb0127..26f1c5666c9c 100644 --- a/packages/SystemUI/res/values-el/strings.xml +++ b/packages/SystemUI/res/values-el/strings.xml @@ -105,6 +105,8 @@ "Προσθήκη σε σημείωση" "Συμπερίληψη συνδέσμου" "%1$s (%2$d)" + + "Εγγραφή οθόνης" "Επεξεργασία εγγραφής οθόνης" "Ειδοποίηση σε εξέλιξη για μια περίοδο λειτουργίας εγγραφής οθόνης" @@ -292,8 +294,7 @@ "Προφύλαξη οθόνης" "Ethernet" "Μην ενοχλείτε" - - + "Λειτουργίες" "Bluetooth" "Δεν υπάρχουν διαθέσιμες συσκευές σε σύζευξη" "Πατήστε για σύνδεση ή αποσύνδεση μιας συσκευής" @@ -434,8 +435,7 @@ "Άνοιγμα Ρυθμίσεων" "Άλλη συσκευή" "Εναλλαγή επισκόπησης" - - + "Λειτουργίες" "Τέλος" "Ρυθμίσεις" "Ενεργό" @@ -1393,18 +1393,12 @@ "Εικονίδιο σύμπτυξης" "Εικονίδιο ανάπτυξης" "ή" - - - - - - - - - - - - + "Πλοήγηση με το πληκτρολόγιο" + "Μάθετε συντομεύσεις πληκτρολογίου" + "Πλοήγηση με την επιφάνεια αφής" + "Μάθετε κινήσεις επιφάνειας αφής" + "Πλοήγηση με το πληκτρολόγιο και την επιφάνεια αφής" + "Μάθετε κινήσεις επιφάνειας αφής, συντομεύσεις πληκτρολογίου και άλλα" "Κίνηση επιστροφής" "Κίνηση μετάβασης στην αρχική οθόνη" "Πλήκτρο ενέργειας" @@ -1444,4 +1438,18 @@ "Τώρα μπορείτε να μειώσετε επιπλέον τη φωτεινότητα της οθόνης, χαμηλώνοντας το επίπεδο φωτεινότητας ακόμα περισσότερο από το επάνω μέρος της οθόνης.\n\nΑυτό λειτουργεί καλύτερα όταν βρίσκεστε σε σκοτεινό περιβάλλον." "Κατάργηση συντόμευσης επιπλέον μείωσης φωτεινότητας" "Η συντόμευση της επιπλέον μείωσης φωτεινότητας καταργήθηκε. Για να χαμηλώσετε τη φωτεινότητα, χρησιμοποιήστε την κανονική γραμμή φωτεινότητας." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-en-rAU/strings.xml b/packages/SystemUI/res/values-en-rAU/strings.xml index cb9dfe5a8d54..24922ac29c7e 100644 --- a/packages/SystemUI/res/values-en-rAU/strings.xml +++ b/packages/SystemUI/res/values-en-rAU/strings.xml @@ -105,6 +105,8 @@ "Add to note" "Include link" "%1$s (%2$d)⁠" + + "Screen recorder" "Processing screen recording" "Ongoing notification for a screen record session" @@ -292,8 +294,7 @@ "Screen saver" "Ethernet" "Do Not Disturb" - - + "Modes" "Bluetooth" "No paired devices available" "Tap to connect or disconnect a device" @@ -434,8 +435,7 @@ "Open settings" "Other device" "Toggle Overview" - - + "Modes" "Done" "Settings" "On" @@ -1393,18 +1393,12 @@ "Collapse icon" "Expand icon" "or" - - - - - - - - - - - - + "Navigate using your keyboard" + "Learn keyboards shortcuts" + "Navigate using your touchpad" + "Learn touchpad gestures" + "Navigate using your keyboard and touchpad" + "Learn touchpad gestures, keyboards shortcuts and more" "Back gesture" "Home gesture" "Action key" @@ -1444,4 +1438,18 @@ "You can now make the screen extra dim by lowering the brightness level even further from the top of your screen.\n\nThis works best when you\'re in a dark environment." "Remove extra dim shortcut" "Extra dim shortcut removed. To lower your brightness, use the regular brightness bar." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-en-rCA/strings.xml b/packages/SystemUI/res/values-en-rCA/strings.xml index 3d4c31f9f60e..88f175393e0c 100644 --- a/packages/SystemUI/res/values-en-rCA/strings.xml +++ b/packages/SystemUI/res/values-en-rCA/strings.xml @@ -105,6 +105,7 @@ "Add to note" "Include link" "%1$s (%2$d)" + "Links can\'t be added from other profiles" "Screen Recorder" "Processing screen recording" "Ongoing notification for a screen record session" @@ -1436,4 +1437,11 @@ "You can now make the screen extra dim by lowering the brightness level even further from the top of your screen.\n\nThis works best when you\'re in a dark environment." "Remove extra dim shortcut" "Extra dim shortcut removed. To lower your brightness, use the regular brightness bar." + "Connectivity" + "Accessibility" + "Utilities" + "Privacy" + "Provided by apps" + "Display" + "Unknown" diff --git a/packages/SystemUI/res/values-en-rGB/strings.xml b/packages/SystemUI/res/values-en-rGB/strings.xml index cb9dfe5a8d54..24922ac29c7e 100644 --- a/packages/SystemUI/res/values-en-rGB/strings.xml +++ b/packages/SystemUI/res/values-en-rGB/strings.xml @@ -105,6 +105,8 @@ "Add to note" "Include link" "%1$s (%2$d)⁠" + + "Screen recorder" "Processing screen recording" "Ongoing notification for a screen record session" @@ -292,8 +294,7 @@ "Screen saver" "Ethernet" "Do Not Disturb" - - + "Modes" "Bluetooth" "No paired devices available" "Tap to connect or disconnect a device" @@ -434,8 +435,7 @@ "Open settings" "Other device" "Toggle Overview" - - + "Modes" "Done" "Settings" "On" @@ -1393,18 +1393,12 @@ "Collapse icon" "Expand icon" "or" - - - - - - - - - - - - + "Navigate using your keyboard" + "Learn keyboards shortcuts" + "Navigate using your touchpad" + "Learn touchpad gestures" + "Navigate using your keyboard and touchpad" + "Learn touchpad gestures, keyboards shortcuts and more" "Back gesture" "Home gesture" "Action key" @@ -1444,4 +1438,18 @@ "You can now make the screen extra dim by lowering the brightness level even further from the top of your screen.\n\nThis works best when you\'re in a dark environment." "Remove extra dim shortcut" "Extra dim shortcut removed. To lower your brightness, use the regular brightness bar." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-en-rIN/strings.xml b/packages/SystemUI/res/values-en-rIN/strings.xml index cb9dfe5a8d54..24922ac29c7e 100644 --- a/packages/SystemUI/res/values-en-rIN/strings.xml +++ b/packages/SystemUI/res/values-en-rIN/strings.xml @@ -105,6 +105,8 @@ "Add to note" "Include link" "%1$s (%2$d)⁠" + + "Screen recorder" "Processing screen recording" "Ongoing notification for a screen record session" @@ -292,8 +294,7 @@ "Screen saver" "Ethernet" "Do Not Disturb" - - + "Modes" "Bluetooth" "No paired devices available" "Tap to connect or disconnect a device" @@ -434,8 +435,7 @@ "Open settings" "Other device" "Toggle Overview" - - + "Modes" "Done" "Settings" "On" @@ -1393,18 +1393,12 @@ "Collapse icon" "Expand icon" "or" - - - - - - - - - - - - + "Navigate using your keyboard" + "Learn keyboards shortcuts" + "Navigate using your touchpad" + "Learn touchpad gestures" + "Navigate using your keyboard and touchpad" + "Learn touchpad gestures, keyboards shortcuts and more" "Back gesture" "Home gesture" "Action key" @@ -1444,4 +1438,18 @@ "You can now make the screen extra dim by lowering the brightness level even further from the top of your screen.\n\nThis works best when you\'re in a dark environment." "Remove extra dim shortcut" "Extra dim shortcut removed. To lower your brightness, use the regular brightness bar." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-en-rXC/strings.xml b/packages/SystemUI/res/values-en-rXC/strings.xml index eb94d598bf6e..e8b32060b03f 100644 --- a/packages/SystemUI/res/values-en-rXC/strings.xml +++ b/packages/SystemUI/res/values-en-rXC/strings.xml @@ -105,6 +105,7 @@ "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‎‎‎‎‎‎‎‎‏‎‏‎‎‎‏‏‎‏‎‎‏‎‎‎‎‎‎‎‎‎‏‎‏‏‏‎‏‏‏‏‎‎‎‎‎‎‏‎‏‏‎‏‏‎‎‎‏‎‏‎Add to note‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‏‏‏‏‎‏‎‎‏‏‏‏‏‏‎‎‏‏‏‏‏‏‏‏‎‎‏‏‎‎‏‏‏‏‎‎‎‏‏‏‏‎‏‎‎‎‏‏‏‏‎‎‎‏‎‏‏‏‏‎‎Include link‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‏‏‏‏‏‎‏‏‏‏‏‏‏‏‏‏‏‏‏‎‏‏‏‎‎‎‏‎‏‏‎‏‎‎‎‏‏‏‎‎‎‏‏‏‏‏‎‏‎‎‎‎‎‎‎‏‎‏‏‎‎‎‏‎‎‏‏‎%1$s‎‏‎‎‏‏‏‎ ‎‏‎‎‏‏‎(%2$d)‎‏‎‎‏‏‏‎‎‏‎‎‏‎" + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‎‎‏‎‏‏‎‏‎‎‎‎‏‏‎‎‎‎‏‏‏‎‏‎‎‎‎‏‎‏‏‎‎‎‎‏‎‏‎‎‏‎‎‎‎‏‎‏‏‎‏‏‏‎‏‎‏‎‏‎‎Links can\'t be added from other profiles‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‏‎‏‏‎‎‎‏‎‏‎‎‏‎‎‎‎‎‏‏‎‎‎‎‎‏‎‎‎‎‎‏‏‎‏‏‏‎‏‎‏‏‏‎‏‏‎‎‎‏‎‏‎‏‎‏‎‎‎‎‎Screen Recorder‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‎‏‎‎‏‎‎‎‏‎‏‎‎‎‎‎‏‏‎‏‎‏‎‎‏‎‎‎‎‏‎‏‎‏‎‎‎‏‏‎‏‏‏‏‎‎‎‏‏‏‏‎‎‎‏‏‎‎‏‎‎Processing screen recording‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‏‎‎‏‏‎‎‎‏‏‎‏‎‏‏‎‎‎‎‎‏‎‏‎‏‏‎‏‎‎‎‏‏‎‏‏‏‎‎‏‎‎‎‎‎‎‏‏‎‎‎‏‏‏‏‎‏‏‏‏‎Ongoing notification for a screen record session‎‏‎‎‏‎" @@ -1436,4 +1437,11 @@ "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‎‎‎‎‏‎‎‎‏‎‎‎‎‎‎‎‏‏‎‏‏‏‏‏‏‎‏‎‎‏‏‏‎‎‏‏‎‏‎‎‎‏‏‎‏‎‏‎‎‏‏‎‏‏‏‎‎‏‎‎You can now make the screen extra dim by lowering the brightness level even further from the top of your screen.‎‏‎‎‏‏‎\n‎‏‎‎‏‏‏‎‎‏‎‎‏‏‎\n‎‏‎‎‏‏‏‎This works best when you\'re in a dark environment.‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‏‎‎‎‏‎‏‏‏‎‏‏‎‏‏‏‎‏‎‏‎‏‏‏‎‎‎‎‎‎‎‎‎‏‎‎‏‏‏‎‏‏‏‎‎‎‏‏‎‎‏‏‏‏‏‎‏‎‎‎‎Remove extra dim shortcut‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‏‎‎‎‎‏‏‏‏‏‏‎‎‎‎‎‎‏‎‏‎‏‎‎‎‏‎‏‏‏‎‎‎‏‏‎‎‎‏‎‎‎‏‎‎‎‏‎‎‏‎‎‏‎‏‎‏‏‎‏‎Extra dim shortcut removed. To lower your brightness, use the regular brightness bar.‎‏‎‎‏‎" + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‏‏‏‏‎‏‎‎‎‏‏‏‎‏‏‎‎‏‏‏‎‏‏‏‏‏‎‏‏‎‎‎‎‏‎‏‏‎‎‏‏‎‏‏‎‎‏‏‏‏‎‎‎‎‏‎‎‎‎‎‎Connectivity‎‏‎‎‏‎" + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‏‏‎‏‎‎‏‎‏‏‏‏‏‏‎‎‏‏‎‎‏‏‎‎‏‎‎‏‎‎‎‎‏‎‏‏‏‎‎‏‏‏‏‏‎‎‏‏‏‎‎‏‏‎‏‎‎‏‎‎Accessibility‎‏‎‎‏‎" + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‎‎‎‎‏‎‏‏‏‎‏‎‏‏‏‏‏‎‏‎‎‏‎‎‏‏‎‏‏‏‎‏‎‏‎‎‏‏‏‏‎‏‎‏‏‏‎‏‏‏‏‏‏‏‏‏‏‏‏‏‎Utilities‎‏‎‎‏‎" + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‎‏‏‎‏‎‎‏‎‎‎‏‏‏‏‎‎‏‏‎‎‎‎‎‎‎‏‎‏‏‎‏‎‏‏‎‏‎‎‎‎‎‏‎‎‎‎‏‏‎‏‏‏‎‏‏‏‏‏‎Privacy‎‏‎‎‏‎" + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‎‎‏‏‏‏‎‏‎‎‏‏‎‏‎‏‏‎‎‎‏‎‏‏‎‏‏‎‎‏‏‎‎‏‏‏‏‏‏‎‎‎‏‏‏‎‎‎‏‏‎‎‎‎‏‎‏‎‏‏‎Provided by apps‎‏‎‎‏‎" + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‎‎‎‏‏‏‏‎‏‎‎‏‏‎‏‎‎‏‏‏‎‏‏‏‏‏‎‏‎‏‏‎‏‎‎‏‎‏‏‏‎‏‏‎‏‏‏‏‏‎‎‎‏‏‏‏‎‏‏‎‎Display‎‏‎‎‏‎" + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‏‏‏‏‎‎‎‏‎‎‎‏‎‏‏‏‎‎‏‎‏‎‎‏‏‏‎‏‎‎‏‎‎‏‎‎‏‏‏‎‎‏‎‏‏‏‏‎‎‎‎‎‎‎‏‎‏‏‏‎‎Unknown‎‏‎‎‏‎" diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml index 2af8bd128d95..42c35109be8a 100644 --- a/packages/SystemUI/res/values-es-rUS/strings.xml +++ b/packages/SystemUI/res/values-es-rUS/strings.xml @@ -105,6 +105,8 @@ "Agregar a la nota" "Incluir vínculo" "%1$s (%2$d)" + + "Grabadora de pantalla" "Procesando grabación pantalla" "Notificación constante para una sesión de grabación de pantalla" @@ -292,8 +294,7 @@ "Protector pantalla" "Ethernet" "No interrumpir" - - + "Modos" "Bluetooth" "No hay dispositivos sincronizados disponibles" "Presiona para conectar o desconectar un dispositivo" @@ -434,8 +435,7 @@ "Abrir Configuración" "Otro dispositivo" "Ocultar o mostrar Recientes" - - + "Modos" "Listo" "Configuración" "Activado" @@ -1444,4 +1444,18 @@ "Ahora puedes bajar el nivel del brillo desde la parte superior de la pantalla para atenuarla aún más.\n\nEsto funciona mejor si estás en un ambiente oscuro." "Quitar la combinación de teclas de atenuación extra" "Se quitó el atajo de atenuación extra. Para bajar el brillo, usa la barra de brillo normal." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-es/strings.xml b/packages/SystemUI/res/values-es/strings.xml index 2e823eda8fc7..6595258bc8e8 100644 --- a/packages/SystemUI/res/values-es/strings.xml +++ b/packages/SystemUI/res/values-es/strings.xml @@ -105,6 +105,7 @@ "Añadir a nota" "Incluir enlace" "%1$s (%2$d)" + "No se pueden añadir enlaces de otros perfiles" "Grabación de pantalla" "Procesando grabación de pantalla" "Notificación continua de una sesión de grabación de la pantalla" @@ -292,8 +293,7 @@ "Salvapantallas" "Ethernet" "No molestar" - - + "Modos" "Bluetooth" "No hay dispositivos vinculados disponibles" "Toca para conectar o desconectar un dispositivo" @@ -434,8 +434,7 @@ "Abrir Ajustes" "Otro dispositivo" "Mostrar u ocultar aplicaciones recientes" - - + "Modos" "Hecho" "Ajustes" "Activado" @@ -1444,4 +1443,18 @@ "Ahora puedes atenuar aún más tu pantalla reduciendo el nivel de brillo desde la parte superior.\n\nFunciona mejor cuando estás en un lugar con poca luz." "Eliminar acceso directo a la atenuación extra" "Acceso directo a la atenuación extra eliminado. Para reducir el brillo, usa la barra de brillo normal." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-et/strings.xml b/packages/SystemUI/res/values-et/strings.xml index 09f461f07003..7042ac136845 100644 --- a/packages/SystemUI/res/values-et/strings.xml +++ b/packages/SystemUI/res/values-et/strings.xml @@ -105,6 +105,8 @@ "Lisa märkmesse" "Kaasa link" "%1$s (%2$d)" + + "Ekraanisalvesti" "Ekraanisalvestuse töötlemine" "Pooleli märguanne ekraanikuva salvestamise seansi puhul" @@ -292,8 +294,7 @@ "Ekraanisäästja" "Ethernet" "Mitte segada" - - + "Režiimid" "Bluetooth" "Ühtegi seotud seadet pole saadaval" "Puudutage seadme ühendamiseks või ühenduse katkestamiseks" @@ -434,8 +435,7 @@ "Ava menüü Seaded" "Muu seade" "Lehe Ülevaade sisse- ja väljalülitamine" - - + "Režiimid" "Valmis" "Seaded" "Sees" @@ -1393,18 +1393,12 @@ "Ahendamisikoon" "Laiendamisikoon" "või" - - - - - - - - - - - - + "Navigeerige klaviatuuri abil" + "Õppige klaviatuuri otseteid" + "Navigeerige puuteplaadi abil" + "Õppige puuteplaadi liigutusi" + "Navigeerige klaviatuuri ja puuteplaadi abil" + "Õppige puuteplaadi liigutusi, klaviatuuri otseteid ja palju muud" "Tagasiliikumisliigutus" "Avakuvale liikumise liigutus" "Toiminguklahv" @@ -1444,4 +1438,18 @@ "Nüüd saate muuta ekraani eriti tumedaks, vähendades ereduse taset ekraani ülaosast veelgi rohkem.\n\nSee toimib kõige paremini hämaras keskkonnas." "Eemalda funktsiooni „Eriti tume“ otsetee" "Funktsiooni „Eriti tume“ otsetee eemaldati. Kasutage ereduse vähendamiseks tavapärast ereduse reguleerimise riba." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-eu/strings.xml b/packages/SystemUI/res/values-eu/strings.xml index 329b6e2bb0d9..e51e37530751 100644 --- a/packages/SystemUI/res/values-eu/strings.xml +++ b/packages/SystemUI/res/values-eu/strings.xml @@ -105,6 +105,8 @@ "Gehitu oharrean" "Sartu esteka" "%1$s (%2$d)" + + "Pantaila-grabagailua" "Pantaila-grabaketa prozesatzen" "Pantailaren grabaketa-saioaren jakinarazpen jarraitua" @@ -292,8 +294,7 @@ "Pantaila-babeslea" "Ethernet" "Ez molestatzeko modua" - - + "Moduak" "Bluetootha" "Ez dago parekatutako gailurik erabilgarri" "Sakatu hau gailu bat konektatu edo deskonektatzeko" @@ -434,8 +435,7 @@ "Ireki Ezarpenak" "Beste gailu bat" "Aldatu ikuspegi orokorra" - - + "Moduak" "Eginda" "Ezarpenak" "Aktibatuta" @@ -1393,18 +1393,12 @@ "Tolesteko ikonoa" "Zabaltzeko ikonoa" "edo" - - - - - - - - - - - - + "Nabigatu teklatua erabilita" + "Ikasi lasterbideak" + "Nabigatu ukipen-panela erabilita" + "Ikasi ukipen-paneleko keinuak" + "Nabigatu teklatua eta ukipen-panela erabilita" + "Ikasi ukipen-paneleko keinuak, lasterbideak eta abar" "Atzera egiteko keinua" "Orri nagusira joateko keinua" "Ekintza-tekla" @@ -1444,4 +1438,18 @@ "Orain, pantaila are ilunago jar dezakezu, pantailaren goialdetik argitasun-maila are gehiago jaitsita.\n\nIngurune ilun batean zaudenean funtzionatzen du ondoen." "Kendu Are ilunago eginbidearen lasterbidea" "Kendu da Are ilunago eginbidearen lasterbidea. Argitasuna murrizteko, erabili argitasun-barra arrunta." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-fa/strings.xml b/packages/SystemUI/res/values-fa/strings.xml index f845027a38df..13d403b1d274 100644 --- a/packages/SystemUI/res/values-fa/strings.xml +++ b/packages/SystemUI/res/values-fa/strings.xml @@ -105,6 +105,7 @@ "افزودن به یادداشت" "اضافه کردن پیوند" "‫%1$s(%2$d)" + "نمی‌توان از نمایه‌های دیگر پیوند اضافه کرد" "ضبط‌کن صفحه‌نمایش" "درحال پردازش ضبط صفحه‌نمایش" "اعلان درحال انجام برای جلسه ضبط صفحه‌نمایش" @@ -292,8 +293,7 @@ "محافظ صفحه" "اترنت" "مزاحم نشوید" - - + "حالت‌ها" "بلوتوث" "هیچ دستگاه مرتبط شده‌ای موجود نیست" "برای اتصال یا قطع اتصال دستگاه، تک‌ضرب بزنید" @@ -434,8 +434,7 @@ "باز کردن تنظیمات" "دستگاه دیگر" "تغییر وضعیت نمای کلی" - - + "حالت‌ها" "تمام" "تنظیمات" "روشن" @@ -1393,18 +1392,12 @@ "نماد جمع کردن" "نماد ازهم بازکردن" "یا" - - - - - - - - - - - - + "پیمایش کردن بااستفاده از صفحه‌کلید" + "آشنایی با میان‌برهای صفحه‌کلید" + "پیمایش کردن بااستفاده از صفحه لمسی" + "آشنایی با اشاره‌های صفحه لمسی" + "پیمایش کردن بااستفاده از صفحه‌کلید و صفحه لمسی" + "آشنایی با اشاره‌های صفحه لمسی، میان‌برهای صفحه‌کلید، و موارد دیگر" "اشاره برگشت" "اشاره صفحه اصلی" "دکمه کنش" @@ -1444,4 +1437,18 @@ "ازاین‌پس می‌توانید با پایین‌تر آوردن سطح روشنایی از بالای صفحه‌نمایش، صفحه‌نمایش را بسیار کم‌نور کنید.\n\nاین ویژگی زمانی بهترین عملکرد را دارد که در محیطی تاریک باشید." "حذف میان‌بر «بسیار کم‌نور»" "میان‌بر «بسیار کم‌نور» حذف شد. برای کم کردن روشنایی، از نوار معمول روشنایی استفاده کنید." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-fi/strings.xml b/packages/SystemUI/res/values-fi/strings.xml index b9afcd567242..ab31329cf26c 100644 --- a/packages/SystemUI/res/values-fi/strings.xml +++ b/packages/SystemUI/res/values-fi/strings.xml @@ -105,6 +105,8 @@ "Lisää muistiinpanoon" "Lisää linkki" "%1$s (%2$d)" + + "Näytön tallentaja" "Näytön tallennusta käsitellään" "Pysyvä ilmoitus näytön tallentamisesta" @@ -292,8 +294,7 @@ "Näytönsäästäjä" "Ethernet" "Älä häiritse" - - + "Tilat" "Bluetooth" "Laitepareja ei ole käytettävissä" "Muodosta yhteys laitteeseen tai katkaise yhteys napauttamalla" @@ -434,8 +435,7 @@ "Avaa Asetukset" "Muu laite" "Näytä/piilota viimeisimmät" - - + "Tilat" "Valmis" "Asetukset" "Päällä" @@ -1393,18 +1393,12 @@ "Tiivistyskuvake" "Laajennuskuvake" "tai" - - - - - - - - - - - - + "Siirry käyttämällä näppäimistöä" + "Opettele pikanäppäimiä" + "Siirry käyttämällä kosketuslevyä" + "Opettele kosketuslevyn eleitä" + "Siirry käyttämällä näppäimistöä ja kosketuslevyä" + "Opettele kosketuslevyn eleitä, pikanäppäimiä ja muuta" "Takaisin-ele" "Etusivu-ele" "Toimintonäppäin" @@ -1444,4 +1438,18 @@ "Voit nyt tehdä näytöstä erittäin himmeän vähentämällä kirkkautta vieläkin enemmän näytön yläreunasta.\n\nTämä toimii parhaiten pimeässä ympäristössä." "Poista erittäin himmeä ‑pikakomento" "Erittäin himmeä ‑pikakomento poistettu. Voit vähentää kirkkautta tavallisesta kirkkauspalkista." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-fr-rCA/strings.xml b/packages/SystemUI/res/values-fr-rCA/strings.xml index 07e131ed0e71..ecb17f9ca1ed 100644 --- a/packages/SystemUI/res/values-fr-rCA/strings.xml +++ b/packages/SystemUI/res/values-fr-rCA/strings.xml @@ -105,6 +105,8 @@ "Ajouter à une note" "Inclure le lien" "%1$s (%2$d)" + + "Enregistreur d\'écran" "Trait. de l\'enregist. d\'écran…" "Notification en cours pour une session d\'enregistrement d\'écran" @@ -292,8 +294,7 @@ "Écran de veille" "Ethernet" "Ne pas déranger" - - + "Modes" "Bluetooth" "Aucun des appareils associés n\'est disponible" "Touchez pour connecter ou déconnecter un appareil" @@ -434,8 +435,7 @@ "Ouvrir les paramètres" "Autre appareil" "Basculer l\'aperçu" - - + "Modes" "OK" "Paramètres" "Activé" @@ -1393,18 +1393,12 @@ "Icône Réduire" "Icône Développer" "ou" - - - - - - - - - - - - + "Naviguer à l\'aide de votre clavier" + "Apprenez à utiliser les raccourcis-clavier" + "Naviguer à l\'aide de votre pavé tactile" + "Apprenez à utiliser les gestes du pavé tactile" + "Naviguer à l\'aide de votre clavier et de votre pavé tactile" + "Apprenez les gestes du pavé tactile, les raccourcis-clavier et bien plus encore" "Geste de retour" "Geste d\'accès à l\'écran d\'accueil" "Touche d\'action" @@ -1444,4 +1438,18 @@ "Vous pouvez désormais rendre l\'écran encore plus sombre en réduisant davantage le niveau de luminosité à partir du haut de l\'écran.\n\nCela fonctionne mieux lorsque vous êtes dans un environnement sombre." "Retirer le raccourci de réduction supplémentaire de la luminosité" "Le raccourci de réduction supplémentaire de la luminosité à été retiré. Pour réduire la luminosité, utilisez la barre de luminosité habituelle." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml index 9d3bbd70116a..c023f1b0f42e 100644 --- a/packages/SystemUI/res/values-fr/strings.xml +++ b/packages/SystemUI/res/values-fr/strings.xml @@ -105,6 +105,8 @@ "Ajouter à la note" "Inclure le lien" "%1$s (%2$d)" + + "Enregistreur d\'écran" "Enregistrement de l\'écran…" "Notification en cours pour une session d\'enregistrement de l\'écran" @@ -292,8 +294,7 @@ "Économiseur d\'écran" "Ethernet" "Ne pas déranger" - - + "Modes" "Bluetooth" "Aucun appareil associé disponible." "Appuyez pour connecter ou déconnecter un appareil" @@ -434,8 +435,7 @@ "Ouvrir les paramètres" "Autre appareil" "Activer/Désactiver l\'écran Récents" - - + "Modes" "OK" "Paramètres" "Activé" @@ -498,7 +498,7 @@ "Ajouter un widget" "OK" "Ajouter des widgets" - "Accéder rapidement aux widgets de vos applis préférées sans déverrouiller votre tablette." + "Accédez rapidement aux widgets de vos applis préférées sans déverrouiller votre tablette." "Autoriser n\'importe quel widget sur l\'écran de verrouillage ?" "Ouvrir les paramètres" "Réactiver les applis pro ?" @@ -1444,4 +1444,18 @@ "Désormais, vous pouvez rendre l\'écran encore plus sombre en abaissant davantage le niveau de luminosité en haut de l\'écran.\n\nCela fonctionne mieux lorsque vous êtes dans un environnement sombre." "Supprimer le raccourci Luminosité ultra-réduite" "Raccourci Luminosité ultra-réduite supprimé. Pour diminuer la luminosité, utilisez la barre de luminosité habituelle." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-gl/strings.xml b/packages/SystemUI/res/values-gl/strings.xml index 6281570d84b4..b525bb8f1234 100644 --- a/packages/SystemUI/res/values-gl/strings.xml +++ b/packages/SystemUI/res/values-gl/strings.xml @@ -105,6 +105,8 @@ "Engadir a unha nota" "Incluír ligazón" "%1$s (%2$d)" + + "Gravadora da pantalla" "Procesando gravación pantalla" "Notificación de actividade en curso sobre unha sesión de gravación de pantalla" @@ -292,8 +294,7 @@ "Protector pantalla" "Ethernet" "Non molestar" - - + "Modos" "Bluetooth" "Non hai dispositivos vinculados dispoñibles" "Toca para conectar ou desconectar un dispositivo" @@ -434,8 +435,7 @@ "Abrir Configuración" "Outro dispositivo" "Activar/desactivar Visión xeral" - - + "Modos" "Feito" "Configuración" "Activado" @@ -1393,18 +1393,12 @@ "Icona de contraer" "Icona de despregar" "ou" - - - - - - - - - - - - + "Navega co teclado" + "Aprende a usar os atallos de teclado" + "Navega co panel táctil" + "Aprende a usar os xestos do panel táctil" + "Navega co teclado e o panel táctil" + "Aprende a usar os xestos do panel táctil, atallos de teclado e moito máis" "Xesto para volver" "Xesto para ir ao inicio" "Tecla de acción" @@ -1444,4 +1438,18 @@ "Agora podes aumentar a atenuación da pantalla: só tes que baixar o nivel de brillo aínda máis desde a parte superior.\n\nEsta opción funciona mellor se estás nun ambiente escuro." "Quitar atallo de atenuación extra" "Quitouse o atallo de atenuación extra. Para reducir o brillo, usa a barra de brillo normal." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-gu/strings.xml b/packages/SystemUI/res/values-gu/strings.xml index 2be88f2ecfe4..9afbf8e4f857 100644 --- a/packages/SystemUI/res/values-gu/strings.xml +++ b/packages/SystemUI/res/values-gu/strings.xml @@ -105,6 +105,7 @@ "નોંધમાં ઉમેરો" "લિંક શામેલ કરો" "%1$s (%2$d)⁠" + "અન્ય પ્રોફાઇલમાંથી લિંક ઉમેરી શકાતી નથી" "સ્ક્રીન રેકોર્ડર" "સ્ક્રીન રેકૉર્ડિંગ ચાલુ છે" "સ્ક્રીન રેકોર્ડિંગ સત્ર માટે ચાલુ નોટિફિકેશન" @@ -292,8 +293,7 @@ "સ્ક્રીન સેવર" "ઇથરનેટ" "ખલેલ પાડશો નહીં" - - + "મોડ" "બ્લૂટૂથ" "કોઈ જોડી કરેલ ઉપકરણો ઉપલબ્ધ નથી" "કોઈ ડિવાઇસ કનેક્ટ કરવા કે ડિસ્કનેક્ટ કરવા માટે ટૅપ કરો" @@ -434,8 +434,7 @@ "સેટિંગ ખોલો" "અન્ય ડિવાઇસ" "ઝલકને ટૉગલ કરો" - - + "મોડ" "થઈ ગયું" "સેટિંગ" "ચાલુ" @@ -1393,18 +1392,12 @@ "\'નાનું કરો\'નું આઇકન" "\'મોટું કરો\'નું આઇકન" "અથવા" - - - - - - - - - - - - + "તમારા કીબોર્ડ વડે નૅવિગેટ કરો" + "કીબોર્ડ શૉર્ટકર્ટ જાણો" + "તમારા ટચપૅડ વડે નૅવિગેટ કરો" + "ટચપૅડના સંકેતો વિશે જાણો" + "તમારા કીબોર્ડ અને ટચપૅડ વડે નૅવિગેટ કરો" + "ટચપૅડના સંકેતો અને કીબોર્ડના શૉર્ટકટ જેવું બીજું ઘણું જાણો" "પાછળ જવાનો સંકેત" "હોમ સ્ક્રીન પર જવાનો સંકેત" "ઍક્શન કી" @@ -1444,4 +1437,18 @@ "તમે હવે તમારી સ્ક્રીનના સૌથી ઉપરના ભાગમાંથી બ્રાઇટનેસ લેવલને હજી પણ ઘટાડીને સ્ક્રીનને એક્સ્ટ્રા ડિમ બનાવી શકો છો.\n\nતમે ડાર્ક વાતાવરણમાં હો, ત્યારે આ શ્રેષ્ઠ રીતે કામ કરે છે." "એક્સ્ટ્રા ડિમ શૉર્ટકટ કાઢી નાખો" "એક્સ્ટ્રા ડિમ શૉર્ટકટ કાઢી નાખ્યો. તમારી બ્રાઇટનેસ ઘટાડવા માટે, નિયમિત બ્રાઇટનેસ બારનો ઉપયોગ કરો." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml index 7c267bf2e86c..2b28b7a12522 100644 --- a/packages/SystemUI/res/values-hi/strings.xml +++ b/packages/SystemUI/res/values-hi/strings.xml @@ -105,6 +105,7 @@ "नोट में जोड़ें" "लिंक जोड़ें" "%1$s (%2$d)" + "अन्य प्रोफ़ाइलों से लिंक नहीं जोड़े जा सकते" "स्क्रीन रिकॉर्डर" "स्क्रीन रिकॉर्डिंग को प्रोसेस किया जा रहा है" "स्क्रीन रिकॉर्ड सेशन के लिए जारी सूचना" @@ -292,8 +293,7 @@ "स्क्रीन सेवर" "ईथरनेट" "परेशान न करें" - - + "मोड" "ब्लूटूथ" "कोई भी युग्मित डिवाइस उपलब्ध नहीं" "किसी डिवाइस को कनेक्ट या डिसकनेक्ट करने के लिए टैप करें" @@ -434,8 +434,7 @@ "सेटिंग खोलें" "अन्य डिवाइस" "खास जानकारी टॉगल करें" - - + "मोड" "हो गया" "सेटिंग" "चालू है" @@ -1393,18 +1392,12 @@ "छोटा करने का आइकॉन" "बड़ा करने का आइकॉन" "या" - - - - - - - - - - - - + "कीबोर्ड का इस्तेमाल करके नेविगेट करें" + "कीबोर्ड शॉर्टकट के बारे में जानें" + "टचपैड का इस्तेमाल करके नेविगेट करें" + "टचपैड पर हाथ के जेस्चर के बारे में जानें" + "कीबोर्ड और टचपैड का इस्तेमाल करके नेविगेट करें" + "टचपैड पर हाथ के जेस्चर, कीबोर्ड शॉर्टकट वगैरह के बारे में जानें" "पीछे जाने का जेस्चर" "होम स्क्रीन पर जाने का जेस्चर" "ऐक्शन बटन" @@ -1444,4 +1437,18 @@ "अब स्क्रीन के सबसे ऊपरी हिस्से से, स्क्रीन की रोशनी सामान्य लेवल से और कम की जा सकती है.\n\nयह सुविधा, अंधेरे वाली जगह पर बेहतर तरीके से काम करती है." "स्क्रीन की रोशनी को सामान्य लेवल से और कम करने की सुविधा का शॉर्टकट हटाएं" "स्क्रीन की रोशनी को सामान्य लेवल से और कम करने की सुविधा का शॉर्टकट हटा दिया गया. स्क्रीन की रोशनी कम करने के लिए, ब्राइटनेस बार का इस्तेमाल करें." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-hr/strings.xml b/packages/SystemUI/res/values-hr/strings.xml index bdf6e13a9d7a..34bccbd6229e 100644 --- a/packages/SystemUI/res/values-hr/strings.xml +++ b/packages/SystemUI/res/values-hr/strings.xml @@ -105,6 +105,8 @@ "Dodaj bilješci" "Uključi vezu" "%1$s (%2$d)" + + "Snimač zaslona" "Obrada snimanja zaslona" "Tekuća obavijest za sesiju snimanja zaslona" @@ -292,8 +294,7 @@ "Čuvar zaslona" "Ethernet" "Ne uznemiravaj" - - + "Načini" "Bluetooth" "Upareni uređaji nisu dostupni" "Dodirnite da biste povezali uređaj ili prekinuli vezu s njim" @@ -434,8 +435,7 @@ "Otvori postavke" "Ostali uređaji" "Uključivanje/isključivanje pregleda" - - + "Načini" "Gotovo" "Postavke" "Uključeno" @@ -1393,18 +1393,12 @@ "Ikona za sažimanje" "Ikona za proširivanje" "ili" - - - - - - - - - - - - + "Krećite se pomoću tipkovnice" + "Saznajte više o tipkovnim prečacima" + "Krećite se pomoću dodirne podloge" + "Saznajte više o pokretima za dodirnu podlogu" + "Krećite se pomoću tipkovnice i dodirne podloge" + "Saznajte više o pokretima za dodirnu podlogu, tipkovnim prečacima i ostalom" "Pokret za povratak" "Pokret za otvaranje početnog zaslona" "Tipka za radnju" @@ -1444,4 +1438,18 @@ "Zaslon možete dodatno zatamniti daljnjim smanjivanjem razine svjetline na vrhu zaslona.\n\nTo najbolje funkcionira kada ste u tamnom okruženju." "Ukloni prečac za dodatno zatamnjenje" "Prečac za dodatno zatamnjenje je uklonjen. Da biste smanjili svjetlinu, upotrijebite regularnu traku za svjetlinu." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-hu/strings.xml b/packages/SystemUI/res/values-hu/strings.xml index 773d9baf3a17..cc2f66e1a04a 100644 --- a/packages/SystemUI/res/values-hu/strings.xml +++ b/packages/SystemUI/res/values-hu/strings.xml @@ -105,6 +105,8 @@ "Hozzáadás jegyzethez" "Linkkel együtt" "%1$s (%2$d)" + + "Képernyőrögzítő" "Képernyőrögzítés feldolgozása" "Folyamatban lévő értesítés képernyőrögzítési munkamenethez" @@ -292,8 +294,7 @@ "Képernyővédő" "Ethernet" "Ne zavarjanak" - - + "Módok" "Bluetooth" "Nem áll rendelkezésre párosított eszköz" "Koppintson egy eszköz csatlakoztatásához vagy leválasztásához" @@ -434,8 +435,7 @@ "Beállítások megnyitása" "Más eszköz" "Áttekintés be- és kikapcsolása" - - + "Módok" "Kész" "Beállítások" "Be" @@ -1393,18 +1393,12 @@ "Összecsukás ikon" "Kibontás ikon" "vagy" - - - - - - - - - - - - + "Navigáció a billentyűzet segítségével" + "Billentyűparancsok megismerése" + "Navigálás az érintőpaddal" + "Érintőpad-kézmozdulatok megismerése" + "Navigálás a billentyűzet és az érintőpad használatával" + "Érintőpad-kézmozdulatok, billentyűparancsok és egyebek megismerése" "Vissza kézmozdulat" "Kezdőképernyő kézmozdulat" "Műveletbillentyű" @@ -1444,4 +1438,18 @@ "A képernyő tetején mostantól extrasötétre állíthatja a képernyőt, amivel a korábbinál még jobban csökkentheti a fényerőt.\n\nA funkció sötét környezetben használható a legjobban." "Az extrasötét funkció gyorsparancsának eltávolítása" "Eltávolította az extrasötét funkció gyorsparancsát. A fényerő csökkentéséhez használja a fényerő-beállítási sávot." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-hy/strings.xml b/packages/SystemUI/res/values-hy/strings.xml index 6a64c5d26c8d..c017263b2810 100644 --- a/packages/SystemUI/res/values-hy/strings.xml +++ b/packages/SystemUI/res/values-hy/strings.xml @@ -105,6 +105,8 @@ "Ավելացնել նշմանը" "Ներառել հղումը" "%1$s (%2$d)" + + "Էկրանի տեսագրում" "Էկրանի տեսագրության մշակում" "Էկրանի տեսագրման աշխատաշրջանի ընթացիկ ծանուցում" @@ -292,8 +294,7 @@ "Էկրանապահ" "Ethernet" "Չանհանգստացնել" - - + "Ռեժիմներ" "Bluetooth" "Զուգակցված սարքեր չկան" "Հպեք՝ սարք միացնելու կամ անջատելու համար" @@ -434,8 +435,7 @@ "Բացել կարգավորումները" "Այլ սարք" "Միացնել/անջատել համատեսքը" - - + "Ռեժիմներ" "Պատրաստ է" "Կարգավորումներ" "Միացված է" @@ -1393,18 +1393,12 @@ "Ծալել պատկերակը" "Ծավալել պատկերակը" "կամ" - - - - - - - - - - - - + "Կողմնորոշվեք ձեր ստեղնաշարի օգնությամբ" + "Սովորեք օգտագործել ստեղնային դյուրանցումները" + "Կողմնորոշվեք ձեր հպահարթակի օգնությամբ" + "Սովորեք օգտագործել հպահարթակի ժեստերը" + "Կողմնորոշվեք ստեղնաշարի և հպահարթակի օգնությամբ" + "Սովորեք օգտագործել հպահարթակի ժեստերը, ստեղնային դյուրանցումները և ավելին" "«Հետ» ժեստ" "Հիմնական էկրան անցնելու ժեստ" "Գործողության ստեղն" @@ -1444,4 +1438,18 @@ "Էկրանը հավելյալ խամրեցնելու համար բացեք կարգավորումները էկրանի վերևի մասից։\n\nԽորհուրդ ենք տալիս օգտագործել այս գործառույթը, երբ շուրջը մութ է։" "Հեռացնել հավելյալ խամրեցման դյուրանցումը" "Հավելյալ խամրեցման դյուրանցումը հեռացվեց։ Պայծառության մակարդակը նվազեցնելու համար օգտագործեք պայծառության գոտին։" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml index 8c58012a2124..a3ea9b26c49e 100644 --- a/packages/SystemUI/res/values-in/strings.xml +++ b/packages/SystemUI/res/values-in/strings.xml @@ -105,6 +105,8 @@ "Tambahkan ke catatan" "Sertakan link" "%1$s (%2$d)" + + "Perekam Layar" "Memproses perekaman layar" "Notifikasi yang sedang berjalan untuk sesi rekaman layar" @@ -292,8 +294,7 @@ "Screensaver" "Ethernet" "Jangan Ganggu" - - + "Mode" "Bluetooth" "Perangkat yang disandingkan tak tersedia" "Ketuk untuk mulai atau berhenti menghubungkan perangkat" @@ -434,8 +435,7 @@ "Buka Setelan" "Perangkat lainnya" "Aktifkan Ringkasan" - - + "Mode" "Selesai" "Setelan" "Aktif" @@ -1393,18 +1393,12 @@ "Ikon ciutkan" "Ikon luaskan" "atau" - - - - - - - - - - - - + "Menavigasi menggunakan keyboard" + "Pelajari pintasan keyboard" + "Menavigasi menggunakan touchpad" + "Pelajari gestur touchpad" + "Menavigasi menggunakan keyboard dan touchpad" + "Pelajari gestur touchpad, pintasan keyboard, dan lainnya" "Gestur kembali" "Gestur layar utama" "Tombol tindakan" @@ -1444,4 +1438,18 @@ "Anda kini dapat membuat layar menjadi ekstra redup dengan menurunkan tingkat kecerahan lebih banyak lagi dari bagian atas layar.\n\nFitur ini berfungsi optimal saat Anda berada di tempat yang gelap." "Hapus pintasan ekstra redup" "Pintasan ekstra redup dihapus. Untuk menurunkan kecerahan, gunakan panel kecerahan biasa." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-is/strings.xml b/packages/SystemUI/res/values-is/strings.xml index 6b3b6732d9bc..2468bcc9f2c1 100644 --- a/packages/SystemUI/res/values-is/strings.xml +++ b/packages/SystemUI/res/values-is/strings.xml @@ -105,6 +105,7 @@ "Bæta við glósu" "Hafa tengil með" "%1$s (%2$d)" + "Ekki er hægt að bæta við tenglum frá öðrum prófílum" "Skjáupptaka" "Vinnur úr skjáupptöku" "Áframhaldandi tilkynning fyrir skjáupptökulotu" @@ -292,8 +293,7 @@ "Skjávari" "Ethernet" "Ónáðið ekki" - - + "Stillingar" "Bluetooth" "Engin pöruð tæki til staðar" "Ýttu til að tengja eða aftengja tæki" @@ -434,8 +434,7 @@ "Opna stillingar" "Annað tæki" "Kveikja/slökkva á yfirliti" - - + "Stillingar" "Lokið" "Stillingar" "Kveikt" @@ -1393,18 +1392,12 @@ "Minnka tákn" "Stækka tákn" "eða" - - - - - - - - - - - - + "Flettu með því að nota lyklaborðið" + "Kynntu þér flýtilykla" + "Flettu með því að nota snertiflötinn" + "Nánar um bendingar á snertifleti" + "Flettu með því að nota lyklaborðið og snertiflötinn" + "Kynntu þér bendingar á snertifleti, flýtilykla og fleira" "Bending til að fara til baka" "Bending til að fara á upphafsskjá" "Aðgerðalykill" @@ -1444,4 +1437,18 @@ "Nú geturðu gert skjáinn mjög dökkan með því að lækka birtustigið enn frekar efst á skjánum.\n\nÞetta virkar best þegar umhverfi þitt er mjög dimmt." "Fjarlægja flýtilykil á mjög dökka stillingu" "Flýtilykill á mjög dökka stillingu fjarlægður. Notaðu hefðbundnu birtustigsstikuna til að lækka birtustigið." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml index 958d67bdfb36..5ea4486f35af 100644 --- a/packages/SystemUI/res/values-it/strings.xml +++ b/packages/SystemUI/res/values-it/strings.xml @@ -105,6 +105,8 @@ "Aggiungi alla nota" "Includi link" "%1$s (%2$d)" + + "Registrazione dello schermo" "Elaborazione registrazione…" "Notifica costante per una sessione di registrazione dello schermo" @@ -292,8 +294,7 @@ "Salvaschermo" "Ethernet" "Non disturbare" - - + "Modalità" "Bluetooth" "Nessun dispositivo accoppiato disponibile" "Tocca per connettere o disconnettere un dispositivo" @@ -434,8 +435,7 @@ "Apri Impostazioni" "Altro dispositivo" "Attiva/disattiva la panoramica" - - + "Modalità" "Fine" "Impostazioni" "On" @@ -1444,4 +1444,18 @@ "Ora puoi usare l\'attenuazione extra per lo schermo abbassando il livello di luminosità ancora di più dalla parte superiore della schermata.\n\nQuesta funzionalità opera in modo ottimale quando ti trovi in un ambiente buio." "Rimuovi scorciatoia attenuazione extra" "Scorciatoia attenuazione extra rimossa. Per diminuire la luminosità, usa la normale barra della luminosità." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml index 1161fa0e9a38..5fd5ca6fcaf3 100644 --- a/packages/SystemUI/res/values-iw/strings.xml +++ b/packages/SystemUI/res/values-iw/strings.xml @@ -105,6 +105,8 @@ "הוספה לפתק" "הכנסת הקישור" "%1$s (%2$d)⁠" + + "מקליט המסך" "מתבצע עיבוד של הקלטת מסך" "התראה מתמשכת לסשן הקלטת מסך" @@ -292,8 +294,7 @@ "שומר מסך" "אתרנט" "נא לא להפריע" - - + "מצבים" "Bluetooth" "אין מכשירים מותאמים זמינים" "אפשר להקיש כדי להתחבר למכשיר או להתנתק ממנו" @@ -434,8 +435,7 @@ "פתיחת ההגדרות" "מכשיר אחר" "החלפת מצב של מסכים אחרונים" - - + "מצבים" "סיום" "הגדרות" "מצב מופעל" @@ -1393,18 +1393,12 @@ "סמל הכיווץ" "סמל ההרחבה" "או" - - - - - - - - - - - - + "ניווט באמצעות המקלדת" + "מידע על מקשי קיצור" + "ניווט באמצעות לוח המגע" + "מידע על התנועות בלוח המגע" + "ניווט באמצעות המקלדת ולוח המגע" + "מידע על התנועות בלוח המגע, מקשי קיצור ועוד" "תנועת חזרה" "תנועת חזרה למסך הבית" "מקש הפעולה" @@ -1444,4 +1438,18 @@ "עכשיו אפשר להפוך את המסך למעומעם במיוחד באמצעות הפחתה נוספת של רמת הבהירות דרך החלק העליון במסך.\n\nהפעולה הזו עובדת הכי טוב בסביבה חשוכה." "הסרה של קיצור הדרך לתכונה \'מעומעם במיוחד\'" "קיצור הדרך לתכונה \'מעומעם במיוחד\' הוסר. כדי להפחית את הבהירות, אפשר להשתמש בסרגל הבהירות הרגיל." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ja/strings.xml b/packages/SystemUI/res/values-ja/strings.xml index 6436cdd3293c..7897f4826155 100644 --- a/packages/SystemUI/res/values-ja/strings.xml +++ b/packages/SystemUI/res/values-ja/strings.xml @@ -44,8 +44,8 @@ "%1$s を起動して %2$s を処理しますか?" "%1$s を開いて %2$sを利用しますか?\nこのアプリに録音権限は付与されていませんが、この USB デバイスから音声を収集できるようになります。" "%1$s を起動して %2$s を処理しますか?" - "このUSBアクセサリを扱うアプリはインストールされていません。詳細: %1$s" - "USBアクセサリ" + "このUSBアクセサリーを扱うアプリはインストールされていません。詳細: %1$s" + "USBアクセサリー" "表示" "%2$s を接続している場合は常に %1$s を起動する" "%2$s を接続している場合は常に %1$s を起動する" @@ -67,8 +67,8 @@ "ワイヤレス デバッグは許可されていません" "このデバイスに現在ログインしているユーザーはワイヤレス デバッグを ON にできません。この機能を使用するには、管理者ユーザーに切り替えてください。" "USB ポート無効" - "液体やゴミからデバイスを保護するため、USB ポートは無効になっています。アクセサリの検出は行われません。\n\nUSB ポートを再び安全に使用できるようになりましたらお知らせします。" - "USB ポートが有効になり、充電器やアクセサリを検出できるようになりました" + "液体やゴミからデバイスを保護するため、USB ポートは無効になっています。アクセサリーの検出は行われません。\n\nUSB ポートを再び安全に使用できるようになりましたらお知らせします。" + "USB ポートが有効になり、充電器やアクセサリーを検出できるようになりました" "USB を有効にする" "詳細" "スクリーンショット" @@ -105,6 +105,7 @@ "メモに追加" "リンクを含める" "%1$s (%2$d)" + "他のプロファイルからリンクを追加することはできません" "スクリーン レコーダー" "画面の録画を処理しています" "画面の録画セッション中の通知" @@ -292,8 +293,7 @@ "スクリーン セーバー" "イーサネット" "サイレント モード" - - + "モード" "Bluetooth" "ペア設定されたデバイスがありません" "タップしてデバイスを接続または接続解除します" @@ -434,8 +434,7 @@ "設定を開く" "その他のデバイス" "概要を切り替え" - - + "モード" "完了" "設定" "ON" @@ -949,7 +948,7 @@ "取り扱いに関する手順をご覧ください" "取り扱いに関する手順をご覧ください" "デバイスを電源から外します" - "充電ポートの近くにデバイスを置くと、本体が熱くなります。デバイスが充電器や USB アクセサリに接続されている場合は外してください。ケーブルが熱くなっていることもあるので注意してください。" + "充電ポートの近くにデバイスを置くと、本体が熱くなります。デバイスが充電器や USB アクセサリーに接続されている場合は外してください。ケーブルが熱くなっていることもあるので注意してください。" "取り扱いに関する手順をご覧ください" "左ショートカット" "右ショートカット" @@ -1393,18 +1392,12 @@ "閉じるアイコン" "開くアイコン" "または" - - - - - - - - - - - - + "キーボードを使用して移動する" + "キーボード ショートカットの詳細" + "タッチパッドを使用して移動する" + "タッチパッド操作の詳細" + "キーボードとタッチパッドを使用して移動する" + "タッチパッド操作やキーボード ショートカットなどの詳細" "「戻る」ジェスチャー" "「ホーム」ジェスチャー" "アクションキー" @@ -1444,4 +1437,18 @@ "画面の上部で明るさを大幅に低く設定することで、画面の輝度をさらに下げられるようになりました。\n\nこの設定は暗い場所での操作に最適です。" "「さらに輝度を下げる」のショートカットを削除する" "「さらに輝度を下げる」のショートカットを削除しました。明るさを下げるには、通常の明るさのバーを使用してください。" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ka/strings.xml b/packages/SystemUI/res/values-ka/strings.xml index 7d5276053220..5550a63ad9a2 100644 --- a/packages/SystemUI/res/values-ka/strings.xml +++ b/packages/SystemUI/res/values-ka/strings.xml @@ -105,6 +105,7 @@ "დაამატეთ შენიშვნა" "ბმულის დართვა" "%1$s (%2$d)" + "სხვა პროფილებიდან ბმულების დამატება შეუძლებელია" "ეკრანის ჩამწერი" "ეკრანის ჩანაწერი მუშავდება" "უწყვეტი შეტყობინება ეკრანის ჩაწერის სესიისთვის" @@ -292,8 +293,7 @@ "ეკრანმზოგი" "ეთერნეტი" "არ შემაწუხოთ" - - + "რეჟიმები" "Bluetooth" "დაწყვილებული მოწყობილობები მიუწვდომელია" "შეეხეთ მოწყობილობის დასაკავშირებლად ან გასათიშად" @@ -434,8 +434,7 @@ "პარამეტრების გახსნა" "სხვა მოწყობილობა" "მიმოხილვის გადართვა" - - + "რეჟიმები" "მზადაა" "პარამეტრები" "ჩართული" @@ -1393,18 +1392,12 @@ "ხატულის ჩაკეცვა" "ხატულის გაფართოება" "ან" - - - - - - - - - - - - + "ნავიგაცია კლავიატურის გამოყენებით" + "კლავიატურის მალსახმობების სწავლა" + "ნავიგაცია სენსორული პანელის გამოყენებით" + "სენსორული პანელის ჟესტების სწავლა" + "ნავიგაცია კლავიატურის და სენსორული პანელის გამოყენებით" + "სენსორული პანელის ჟესტების, კლავიატურის მალსახმობების და სხვა ფუნქციების სწავლა" "უკან დაბრუნების ჟესტი" "მთავარ ეკრანზე გადასვლის ჟესტი" "მოქმედების კლავიში" @@ -1444,4 +1437,18 @@ "ახლა თქვენ შეგიძლიათ დამატებით დაბინდოთ ეკრანი მის ზედა ნაწილში სიკაშკაშის დონის კიდევ უფრო შემცირების გზით.\n\nეს ყველაზე უკეთ ბნელ გარემოში ყოფნისას მუშაობს." "დამატებითი დაბინდვის მალსახმობის ამოშლა" "დამატებითი დაბინდვის მალსახმობი ამოშლილია. სიკაშკაშის შესამცირებლად გამოიყენეთ სიკაშკაშის ჩვეულებრივი პანელი." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-kk/strings.xml b/packages/SystemUI/res/values-kk/strings.xml index 7b32db1b9d61..d8b454218ac2 100644 --- a/packages/SystemUI/res/values-kk/strings.xml +++ b/packages/SystemUI/res/values-kk/strings.xml @@ -105,6 +105,8 @@ "Ескертпеге қосу" "Сілтеме қосу" "%1$s (%2$d)" + + "Экран жазғыш" "Экран жазғыш бейнесін өңдеу" "Экранды бейнеге жазудың ағымдағы хабарландыруы" @@ -292,8 +294,7 @@ "Скринсейвер" "Этернет" "Мазаламау" - - + "Режимдер" "Bluetooth" "Жұптасқан құрылғылар жоқ" "Құрылғыны жалғау не ажырату үшін түртіңіз." @@ -434,8 +435,7 @@ "Параметрлерді ашу" "Басқа құрылғы" "Шолуды қосу/өшіру" - - + "Режимдер" "Дайын" "Параметрлер" "Қосулы" @@ -1393,18 +1393,12 @@ "Жию белгішесі" "Жаю белгішесі" "немесе" - - - - - - - - - - - - + "Пернетақтамен жұмыс істеңіз" + "Перне тіркесімдерін үйреніңіз." + "Сенсорлық тақтамен жұмыс істеңіз" + "Сенсорлық тақта қимылдарын үйреніңіз." + "Пернетақтамен және сенсорлық тақтамен жұмыс істеңіз" + "Сенсорлық тақта қимылдарын, перне тіркесімдерін және т.б. үйреніңіз." "Артқа қайтару қимылы" "Негізгі бетке қайтару қимылы" "Әрекет пернесі" @@ -1444,4 +1438,18 @@ "Енді экранның жоғарғы бөлігінде жарықтық деңгейін түсіру арқылы экранды одан сайын қарайтуға болады.\n\nБұл мүмкіндіктің артықшылығын қараңғы жерде көруге болады." "Экранды қарайту жылдам пәрменін өшіру" "Экранды қарайту жылдам пәрмені өшірілді. Жарықтықты азайту үшін әдеттегі жарықтық панелін пайдаланыңыз." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-km/strings.xml b/packages/SystemUI/res/values-km/strings.xml index 81664cabd896..f2fc313a4bb2 100644 --- a/packages/SystemUI/res/values-km/strings.xml +++ b/packages/SystemUI/res/values-km/strings.xml @@ -105,6 +105,7 @@ "បញ្ចូលទៅក្នុងកំណត់ចំណាំ" "រួមបញ្ចូល​តំណ" "%1$s (%2$d)⁠" + "មិនអាចបញ្ចូលតំណពីកម្រងព័ត៌មានផ្សេងទៀតបានទេ" "មុខងារថត​វីដេអូអេក្រង់" "កំពុង​ដំណើរការ​ការថតអេក្រង់" "ការជូនដំណឹង​ដែល​កំពុង​ដំណើរការ​សម្រាប់​រយៈពេលប្រើ​ការថត​សកម្មភាព​អេក្រង់" @@ -292,8 +293,7 @@ "ធាតុរក្សាអេក្រង់" "អ៊ីសឺរណិត" "កុំ​រំខាន" - - + "មុខងារ" "ប៊្លូធូស" "មិន​មាន​ឧបករណ៍​ផ្គូផ្គង​ដែល​អាច​ប្រើ​បាន" "ចុចដើម្បីភ្ជាប់ ឬផ្ដាច់ឧបករណ៍" @@ -434,8 +434,7 @@ "បើកការកំណត់" "ឧបករណ៍ផ្សេងទៀត" "បិទ/បើក​ទិដ្ឋភាពរួម" - - + "មុខងារ" "រួចរាល់" "ការកំណត់" "បើក" @@ -1393,18 +1392,12 @@ "រូបតំណាង \"បង្រួម\"" "រូបតំណាង \"ពង្រីក\"" "ឬ" - - - - - - - - - - - - + "រុករកដោយប្រើក្ដារចុចរបស់អ្នក" + "ស្វែងយល់អំពីផ្លូវកាត់​ក្ដារ​ចុច" + "រុករកដោយប្រើផ្ទាំងប៉ះរបស់អ្នក" + "ស្វែងយល់អំពីចលនាផ្ទាំងប៉ះ" + "រុករកដោយប្រើក្ដារចុច និងផ្ទាំងប៉ះរបស់អ្នក" + "ស្វែងយល់អំពីចលនាផ្ទាំងប៉ះ ផ្លូវកាត់​ក្ដារ​ចុច និងអ្វីៗជាច្រើនទៀត" "ចលនាថយក្រោយ" "ចលនាទៅទំព័រដើម" "គ្រាប់ចុចសកម្មភាព" @@ -1444,4 +1437,18 @@ "ឥឡូវនេះ អ្នកអាចធ្វើឱ្យអេក្រង់ងងឹតខ្លាំងបានដោយបន្ថយកម្រិតពន្លឺបន្ថែមទៀតដោយចូលទៅកាន់ផ្នែកខាងលើនៃអេក្រង់របស់អ្នក។\n\nការធ្វើបែបនេះទទួលបានលទ្ធផលប្រសើរបំផុត ពេលអ្នកស្ថិតនៅកន្លែងងងឹត។" "ដកផ្លូវ​កាត់មុខងារងងឹតខ្លាំងចេញ" "ផ្លូវ​កាត់មុខងារងងឹតខ្លាំងត្រូវបានដកចេញ។ ដើម្បីបន្ថយពន្លឺរបស់អ្នក សូមប្រើរបារពន្លឺធម្មតា។" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-kn/strings.xml b/packages/SystemUI/res/values-kn/strings.xml index e1b119cee100..6f6333299129 100644 --- a/packages/SystemUI/res/values-kn/strings.xml +++ b/packages/SystemUI/res/values-kn/strings.xml @@ -74,8 +74,8 @@ "ಸ್ಕ್ರೀನ್‌ಶಾಟ್" "ಎಕ್ಸ್‌ಟೆಂಡ್ ಅನ್‌ಲಾಕ್ ಅನ್ನು ನಿಷ್ಕ್ರಿಯಗೊಳಿಸಲಾಗಿದೆ" "ಚಿತ್ರವನ್ನು ಕಳುಹಿಸಲಾಗಿದೆ" - "ಸ್ಕ್ರೀನ್‌ಶಾಟ್ ಉಳಿಸಲಾಗುತ್ತಿದೆ…" - "ಉದ್ಯೋಗ ಪ್ರೊಫೈಲ್‌ಗೆ ಸ್ಕ್ರೀನ್‌ಶಾಟ್‌ ಉಳಿಸಲಾಗುತ್ತಿದೆ…" + "ಸ್ಕ್ರೀನ್‌ಶಾಟ್ ಸೇವ್ ಮಾಡಲಾಗುತ್ತಿದೆ…" + "ಉದ್ಯೋಗ ಪ್ರೊಫೈಲ್‌ಗೆ ಸ್ಕ್ರೀನ್‌ಶಾಟ್‌ ಸೇವ್ ಮಾಡಲಾಗುತ್ತಿದೆ…" "ಸ್ಕ್ರೀನ್‌ಶಾಟ್‌ ಅನ್ನು ಖಾಸಗಿ ಪ್ರೊಫೈಲ್‌ಗೆ ಸೇವ್‌ ಮಾಡಲಾಗುತ್ತಿದೆ" "ಸ್ಕ್ರೀನ್‌ಶಾಟ್‌ ಅನ್ನು ಸೇವ್ ಮಾಡಲಾಗಿದೆ" "ಸ್ಕ್ರೀನ್‌ಶಾಟ್ ಅನ್ನು ಉಳಿಸಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ" @@ -105,6 +105,7 @@ "ಟಿಪ್ಪಣಿಗೆ ಸೇರಿಸಿ" "ಲಿಂಕ್ ಅನ್ನು ಸೇರಿಸಿ" "%1$s (%2$d)⁠" + "ಇತರ ಪ್ರೊಫೈಲ್‌ಗಳಿಂದ ಲಿಂಕ್‌ಗಳನ್ನು ಸೇರಿಸಲು ಸಾಧ್ಯವಿಲ್ಲ" "ಸ್ಕ್ರೀನ್ ರೆಕಾರ್ಡರ್" "ಸ್ಕ್ರೀನ್ ರೆಕಾರ್ಡಿಂಗ್ ಆಗುತ್ತಿದೆ" "ಸ್ಕ್ರೀನ್ ರೆಕಾರ್ಡಿಂಗ್ ಸೆಶನ್‌ಗಾಗಿ ಚಾಲ್ತಿಯಲ್ಲಿರುವ ನೋಟಿಫಿಕೇಶನ್" @@ -292,8 +293,7 @@ "ಸ್ಕ್ರೀನ್ ಸೇವರ್" "ಇಥರ್ನೆಟ್" "ಅಡಚಣೆ ಮಾಡಬೇಡಿ" - - + "ಮೋಡ್‌ಗಳು" "ಬ್ಲೂಟೂತ್‌" "ಯಾವುದೇ ಜೋಡಿಸಲಾದ ಸಾಧನಗಳು ಲಭ್ಯವಿಲ್ಲ" "ಸಾಧನವನ್ನು ಕನೆಕ್ಟ್ ಅಥವಾ ಡಿಸ್‌ಕನೆಕ್ಟ್ ಮಾಡಲು ಟ್ಯಾಪ್ ಮಾಡಿ" @@ -434,8 +434,7 @@ "ಸೆಟ್ಟಿಂಗ್‌ಗಳನ್ನು ತೆರೆಯಿರಿ" "ಅನ್ಯ ಸಾಧನ" "ಟಾಗಲ್ ನ ಅವಲೋಕನ" - - + "ಮೋಡ್‌ಗಳು" "ಮುಗಿದಿದೆ" "ಸೆಟ್ಟಿಂಗ್‌ಗಳು" "ಆನ್ ಆಗಿದೆ" @@ -1393,18 +1392,12 @@ "ಕುಗ್ಗಿಸುವ ಐಕಾನ್" "ವಿಸ್ತೃತಗೊಳಿಸುವ ಐಕಾನ್" "ಅಥವಾ" - - - - - - - - - - - - + "ನಿಮ್ಮ ಕೀಬೋರ್ಡ್ ಬಳಸಿ ನ್ಯಾವಿಗೇಟ್ ಮಾಡಿ" + "ಕೀಬೋರ್ಡ್ ಶಾರ್ಟ್‌ಕಟ್‌ಗಳನ್ನು ಕಲಿಯಿರಿ" + "ನಿಮ್ಮ ಟಚ್‌ಪ್ಯಾಡ್ ಬಳಸಿ ನ್ಯಾವಿಗೇಟ್ ಮಾಡಿ" + "ಟಚ್‌ಪ್ಯಾಡ್ ಗೆಸ್ಚರ್‌ಗಳನ್ನು ಕಲಿಯಿರಿ" + "ನಿಮ್ಮ ಕೀಬೋರ್ಡ್ ಮತ್ತು ಟಚ್‌ಪ್ಯಾಡ್ ಬಳಸಿ ನ್ಯಾವಿಗೇಟ್ ಮಾಡಿ" + "ಟಚ್‌ಪ್ಯಾಡ್ ಗೆಸ್ಚರ್‌ಗಳು, ಕೀಬೋರ್ಡ್‌ಗಳ ಶಾರ್ಟ್‌ಕಟ್‌ಗಳು ಮತ್ತು ಹೆಚ್ಚಿನದನ್ನು ತಿಳಿಯಿರಿ" "ಹಿಂಬದಿ ಗೆಸ್ಚರ್" "ಹೋಮ್ ಗೆಸ್ಚರ್" "ಆ್ಯಕ್ಷನ್‌ ಕೀ" @@ -1444,4 +1437,18 @@ "ನಿಮ್ಮ ಸ್ಕ್ರೀನ್ ಮೇಲ್ಭಾಗದಿಂದ ಬ್ರೈಟ್‌ನೆಸ್ ಮಟ್ಟವನ್ನು ಇನ್ನಷ್ಟು ಕಡಿಮೆ ಮಾಡುವ ಮೂಲಕ ನೀವು ಈಗ ಸ್ಕ್ರೀನ್ ಅನ್ನು ಇನ್ನಷ್ಟು ಮಬ್ಬುಗೊಳಿಸಬಹುದು.\n\nನೀವು ಕತ್ತಲೆಯ ವಾತಾವರಣದಲ್ಲಿರುವಾಗ ಇದು ಉತ್ತಮವಾಗಿ ಕಾರ್ಯನಿರ್ವಹಿಸುತ್ತದೆ." "ಇನ್ನಷ್ಟು ಮಬ್ಬು ಶಾರ್ಟ್‌ಕಟ್ ಅನ್ನು ತೆಗೆದುಹಾಕಿ" "ಇನ್ನಷ್ಟು ಮಬ್ಬು ಶಾರ್ಟ್‌ಕಟ್ ಅನ್ನು ತೆಗೆದುಹಾಕಲಾಗಿದೆ. ನಿಮ್ಮ ಬ್ರೈಟ್‌ನೆಸ್ ಅನ್ನು ಕಡಿಮೆ ಮಾಡಲು, ಸಾಮಾನ್ಯ ಬ್ರೈಟ್‌ನೆಸ್ ಬಾರ್ ಬಳಸಿ." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ko/strings.xml b/packages/SystemUI/res/values-ko/strings.xml index 27aa785186d9..75bc3b26f61c 100644 --- a/packages/SystemUI/res/values-ko/strings.xml +++ b/packages/SystemUI/res/values-ko/strings.xml @@ -105,6 +105,8 @@ "메모에 추가" "링크 포함" "%1$s(%2$d)" + + "화면 녹화" "화면 녹화 처리 중" "화면 녹화 세션에 관한 지속적인 알림" @@ -292,8 +294,7 @@ "화면 보호기" "이더넷" "방해 금지 모드" - - + "모드" "블루투스" "페어링된 기기가 없습니다" "기기를 연결 또는 연결 해제하려면 탭하세요" @@ -434,8 +435,7 @@ "설정 열기" "기타 기기" "최근 사용 버튼 전환" - - + "모드" "완료" "설정" "사용" @@ -1393,18 +1393,12 @@ "접기 아이콘" "확장 아이콘" "또는" - - - - - - - - - - - - + "키보드를 사용하여 이동" + "단축키 알아보기" + "터치패드를 사용하여 이동" + "터치패드 동작 알아보기" + "키보드와 터치패드를 사용하여 이동" + "터치패드 동작, 단축키 등 알아보기" "뒤로 동작" "홈 동작" "작업 키" @@ -1444,4 +1438,18 @@ "이제 화면 상단에서 밝기 수준을 더 낮춰 화면을 더 어둡게 만들 수 있습니다\n\n이 기능은 어두운 환경에서 가장 잘 작동합니다." "\'더 어둡게\' 단축키 삭제" "\'더 어둡게\' 단축키가 삭제되었습니다. 밝기를 낮추려면 일반 밝기 막대를 사용하세요." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ky/strings.xml b/packages/SystemUI/res/values-ky/strings.xml index 306baa7fb3b1..9bf427c0bfb9 100644 --- a/packages/SystemUI/res/values-ky/strings.xml +++ b/packages/SystemUI/res/values-ky/strings.xml @@ -105,6 +105,7 @@ "Кыска жазууга кошуу" "Шилтеме кошуу" "%1$s (%2$d)⁠" + "Башка профилдердеги шилтемелерди кошууга болбойт" "Экрандан видео жаздырып алуу" "Экрандан жаздырылып алынган видео иштетилүүдө" "Экранды жаздыруу сеансы боюнча учурдагы билдирме" @@ -292,8 +293,7 @@ "Көшөгө" "Ethernet" "Тынчымды алба" - - + "Режимдер" "Bluetooth" "Жупташкан түзмөктөр жок" "Түзмөктү туташтыруу же ажыратуу үчүн таптаңыз" @@ -434,8 +434,7 @@ "Параметрлерди ачуу" "Башка түзмөк" "Назар режимин өчүрүү/күйгүзүү" - - + "Режимдер" "Бүттү" "Параметрлер" "Күйүк" @@ -1393,18 +1392,12 @@ "Жыйыштыруу сүрөтчөсү" "Жайып көрсөтүү сүрөтчөсү" "же" - - - - - - - - - - - - + "Нерселерге баскычтоп аркылуу өтүңүз" + "Ыкчам баскычтар тууралуу билип алыңыз" + "Нерселерге сенсордук такта аркылуу өтүңүз" + "Сенсордук тактадагы жаңсоолорду үйрөнүп алыңыз" + "Нерселерге баскычтоп жана сенсордук такта аркылуу өтүңүз" + "Сенсордук тактадагы жаңсоолор, ыкчам баскычтар жана башкалар жөнүндө билип алыңыз" "Артка кайтуу жаңсоосу" "Башкы бетке өтүү жаңсоосу" "Аракет баскычы" @@ -1444,4 +1437,18 @@ "Эми экраныңыздын өйдө жагынан жарыктыктын деңгээлин азайтып, экранды кошумча караңгылата аласыз.\n\nМуну караңгы жерде турганыңызда колдонуу сунушталат." "Кошумча караңгылатуу ыкчам баскычын өчүрүү" "Кошумча караңгылатуу ыкчам баскычы өчүрүлдү. Жарыктыкты азайтуу үчүн кадимки жарыктык тилкесин колдонуңуз." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-lo/strings.xml b/packages/SystemUI/res/values-lo/strings.xml index 75f579c83c76..bc0c22d92373 100644 --- a/packages/SystemUI/res/values-lo/strings.xml +++ b/packages/SystemUI/res/values-lo/strings.xml @@ -105,6 +105,7 @@ "ເພີ່ມໃສ່ບັນທຶກ" "ຮວມລິ້ງ" "%1$s (%2$d)⁠" + "ບໍ່ສາມາດເພີ່ມລິ້ງຈາກໂປຣໄຟລ໌ອື່ນໆໄດ້" "ໂປຣແກຣມບັນທຶກໜ້າຈໍ" "ກຳລັງປະມວນຜົນການບັນທຶກໜ້າຈໍ" "ການແຈ້ງເຕືອນສຳລັບເຊດຊັນການບັນທຶກໜ້າຈໍໃດໜຶ່ງ" @@ -292,8 +293,7 @@ "ພາບພັກໜ້າຈໍ" "Ethernet" "ຫ້າມລົບກວນ" - - + "ໂໝດ" "Bluetooth" "ບໍ່​ມີ​ອຸ​ປະ​ກອນ​ທີ່​ສາ​ມາດ​ຈັບ​ຄູ່​ໄດ້" "ແຕະເພື່ອເຊື່ອມຕໍ່ ຫຼື ຕັດການເຊື່ອມຕໍ່ອຸປະກອນ" @@ -434,8 +434,7 @@ "ເປີດການຕັ້ງຄ່າ" "ອຸປະກອນອື່ນໆ" "ສະຫຼັບພາບຮວມ" - - + "ໂໝດ" "ແລ້ວໆ" "ການຕັ້ງຄ່າ" "ເປີດ" @@ -1393,18 +1392,12 @@ "ໄອຄອນຫຍໍ້ລົງ" "ໄອຄອນຂະຫຍາຍ" "ຫຼື" - - - - - - - - - - - - + "ນຳທາງໂດຍໃຊ້ແປ້ນພິມຂອງທ່ານ" + "ສຶກສາຄີລັດ" + "ນຳທາງໂດຍໃຊ້ແຜ່ນສຳຜັດຂອງທ່ານ" + "ສຶກສາທ່າທາງຂອງແຜ່ນສຳຜັດ" + "ນຳທາງໂດຍໃຊ້ແປ້ນພິມ ແລະ ແຜ່ນສຳຜັດຂອງທ່ານ" + "ສຶກສາທ່າທາງຂອງແຜ່ນສຳຜັດ, ຄີລັດ ແລະ ອື່ນໆ" "ທ່າທາງສຳລັບກັບຄືນ" "ທ່າທາງສຳລັບໜ້າຫຼັກ" "ປຸ່ມຄຳສັ່ງ" @@ -1444,4 +1437,18 @@ "ຕອນນີ້ທ່ານສາມາດເຮັດໃຫ້ໜ້າຈໍມືດລົງເປັນພິເສດໄດ້ໂດຍການຫຼຸດລະດັບຄວາມສະຫວ່າງລົງໃຫ້ຫຼາຍຂຶ້ນຈາກເທິງສຸດຂອງໜ້າຈໍຂອງທ່ານ.\n\nຄຸນສົມບັດນີ້ຈະເຮັດວຽກໄດ້ດີທີ່ສຸດເມື່ອທ່ານຢູ່ໃນສະພາບແວດລ້ອມທີ່ມືດ." "ລຶບທາງລັດທີ່ຫຼຸດແສງເປັນພິເສດອອກ" "ລຶບທາງລັດທີ່ຫຼຸດແສງເປັນພິເສດອອກແລ້ວ. ເພື່ອຫຼຸດຄວາມສະຫວ່າງຂອງທ່ານລົງ, ໃຫ້ໃຊ້ແຖບຄວາມສະຫວ່າງປົກກະຕິ." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-lt/strings.xml b/packages/SystemUI/res/values-lt/strings.xml index 61516fed7111..91f8398c8e16 100644 --- a/packages/SystemUI/res/values-lt/strings.xml +++ b/packages/SystemUI/res/values-lt/strings.xml @@ -105,6 +105,8 @@ "Pridėti prie užrašo" "Įtraukti nuorodą" "„%1$s(%2$d)" + + "Ekrano vaizdo įrašytuvas" "Apdorojam. ekrano vaizdo įraš." "Šiuo metu rodomas ekrano įrašymo sesijos pranešimas" @@ -292,8 +294,7 @@ "Ekrano užsklanda" "Eternetas" "Netrukdymo režimas" - - + "Režimai" "Bluetooth" "Nėra pasiekiamų susietų įrenginių" "Palieskite, kad prijungtumėte ar atjungtumėte įrenginį" @@ -434,8 +435,7 @@ "Atidaryti nustatymus" "Kitas įrenginys" "Perjungti apžvalgą" - - + "Režimai" "Atlikta" "Nustatymai" "Įjungta" @@ -1393,18 +1393,12 @@ "Sutraukimo piktograma" "Išskleidimo piktograma" "arba" - - - - - - - - - - - - + "Naršykite naudodamiesi klaviatūra" + "Sužinokite apie sparčiuosius klavišus" + "Naršykite naudodamiesi jutikline dalimi" + "Sužinokite jutiklinės dalies gestus" + "Naršykite naudodamiesi klaviatūra ir jutikline dalimi" + "Sužinokite jutiklinės dalies gestus, sparčiuosius klavišus ir kt." "Grįžimo atgal gestas" "Pagrindinio ekrano gestas" "Veiksmų klavišas" @@ -1444,4 +1438,18 @@ "Dabar galite padaryti ekraną itin blankų, dar labiau sumažindami ryškumo lygį nuo ekrano viršaus.\n\nŠi funkcija geriausiai veikia, kai esate tamsioje aplinkoje." "Pašalinti funkcijos „Itin blanku“ spartųjį klavišą" "Funkcijos „Itin blanku“ spartusis klavišas pašalintas. Jei norite sumažinti ryškumą, naudokite įprastą ryškumo juostą." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-lv/strings.xml b/packages/SystemUI/res/values-lv/strings.xml index 1b48d3f613b5..29af399aaf94 100644 --- a/packages/SystemUI/res/values-lv/strings.xml +++ b/packages/SystemUI/res/values-lv/strings.xml @@ -105,6 +105,8 @@ "Pievienot piezīmei" "Iekļaut saiti" "%1$s (%2$d)" + + "Ekrāna ierakstītājs" "Ekrāna ieraksta apstrāde" "Aktīvs paziņojums par ekrāna ierakstīšanas sesiju" @@ -292,8 +294,7 @@ "Ekrānsaudzētājs" "Tīkls Ethernet" "Režīms “Netraucēt”" - - + "Režīmi" "Bluetooth" "Nav pieejama neviena pārī savienota ierīce." "Lai pievienotu vai atvienotu kādu ierīci, pieskarieties." @@ -434,8 +435,7 @@ "Atvērt iestatījumus" "Cita ierīce" "Pārskata pārslēgšana" - - + "Režīmi" "Gatavs" "Iestatījumi" "Ieslēgts" @@ -1393,18 +1393,12 @@ "Sakļaušanas ikona" "Izvēršanas ikona" "vai" - - - - - - - - - - - - + "Pārvietošanās, izmantojot tastatūru" + "Uzziniet par īsinājumtaustiņiem." + "Pārvietošanās, izmantojot skārienpaliktni" + "Apgūstiet skārienpaliktņa žestus." + "Pārvietošanās, izmantojot tastatūru un skārienpaliktni" + "Uzziniet par skārienpaliktņa žestiem, īsinājumtaustiņiem un citām iespējām." "Žests pāriešanai atpakaļ" "Žests pāriešanai uz sākumu" "Darbību taustiņš" @@ -1444,4 +1438,18 @@ "Tagad varat veikt ekrāna papildu aptumšošanu, vēl vairāk samazinot spilgtumu ekrāna augšdaļā.\n\nTas darbojas vislabāk, ja esat tumšā vietā." "Noņemt papildu aptumšošanas saīsni" "Papildu aptumšošanas saīsne ir noņemta. Lai samazinātu spilgtumu, izmantojiet parasto spilgtuma joslu." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-mk/strings.xml b/packages/SystemUI/res/values-mk/strings.xml index 1c853df520cb..11fb67c759e0 100644 --- a/packages/SystemUI/res/values-mk/strings.xml +++ b/packages/SystemUI/res/values-mk/strings.xml @@ -105,6 +105,8 @@ "Додај во белешка" "Опфати линк" "%1$s (%2$d)" + + "Снимач на екран" "Се обработува снимка од екран" "Тековно известување за сесија за снимање на екранот" @@ -292,8 +294,7 @@ "Штедач на екран" "Етернет" "Не вознемирувај" - - + "Режими" "Bluetooth" "Нема достапни спарени уреди" "Допрете за да воспоставите или да прекинете врска со уред" @@ -434,8 +435,7 @@ "Отворете „Поставки“" "Друг уред" "Вклучи/исклучи преглед" - - + "Режими" "Готово" "Поставки" "Вклучено" @@ -1393,18 +1393,12 @@ "Икона за собирање" "Икона за проширување" "или" - - - - - - - - - - - - + "Движете се со користење на тастатурата" + "Научете кратенки од тастатурата" + "Движете се со користење на допирната подлога" + "Научете движења за допирната подлога" + "Движете се со користење на тастатурата и допирната подлога" + "Научете движења за допирната подлога, кратенки од тастатурата и друго" "Движење за назад" "Движење за почетен екран" "Копче за дејство" @@ -1444,4 +1438,18 @@ "Отсега може да го затемнувате екранот дополнително со намалување на нивото на осветленост од горниот дел на екранот.\n\nОва функционира најдобро кога сте во темна средина." "Отстрани ја кратенката за „Дополнително затемнување“" "Кратенката за „Дополнително затемнување“ е отстранета. Користете ја стандардната лента за осветленост за да ја намалите осветленоста." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ml/strings.xml b/packages/SystemUI/res/values-ml/strings.xml index ef63d675ed42..720275e3a6a4 100644 --- a/packages/SystemUI/res/values-ml/strings.xml +++ b/packages/SystemUI/res/values-ml/strings.xml @@ -105,6 +105,7 @@ "കുറിപ്പിലേക്ക് ചേർക്കുക" "ലിങ്ക് ഉൾപ്പെടുത്തുക" "%1$s (%2$d)⁠" + "മറ്റ് പ്രൊഫൈലുകളിൽ നിന്ന് ലിങ്കുകൾ ചേർക്കാനാകില്ല" "സ്ക്രീൻ റെക്കോർഡർ" "സ്ക്രീൻ റെക്കോർഡിംഗ് പ്രോസസുചെയ്യുന്നു" "ഒരു സ്ക്രീൻ റെക്കോർഡിംഗ് സെഷനായി നിലവിലുള്ള അറിയിപ്പ്" @@ -292,8 +293,7 @@ "സ്ക്രീൻ സേവർ" "ഇതർനെറ്റ്" "ശല്യപ്പെടുത്തരുത്" - - + "മോഡുകൾ" "Bluetooth" "ജോടിയാക്കിയ ഉപകരണങ്ങളൊന്നും ലഭ്യമല്ല" "ഒരു ഉപകരണം കണക്റ്റ് ചെയ്യാനോ വിച്ഛേദിക്കാനോ ടാപ്പ് ചെയ്യുക" @@ -434,8 +434,7 @@ "ക്രമീകരണം തുറക്കുക" "മറ്റ് ഉപകരണം" "അവലോകനം മാറ്റുക" - - + "മോഡുകൾ" "ശരി" "ക്രമീകരണം" "ഓണാണ്" @@ -1393,18 +1392,12 @@ "ചുരുക്കൽ ഐക്കൺ" "വികസിപ്പിക്കൽ ഐക്കൺ" "അല്ലെങ്കിൽ" - - - - - - - - - - - - + "നിങ്ങളുടെ കീബോർഡ് ഉപയോഗിച്ച് നാവിഗേറ്റ് ചെയ്യുക" + "കീബോർഡ് കുറുക്കുവഴികൾ മനസ്സിലാക്കുക" + "നിങ്ങളുടെ ടച്ച്‌പാഡ് ഉപയോഗിച്ച് നാവിഗേറ്റ് ചെയ്യുക" + "ടച്ച്പാഡ് ജെസ്ച്ചറുകൾ മനസ്സിലാക്കുക" + "നിങ്ങളുടെ കീപാഡ്, ടച്ച്‌പാഡ് എന്നിവ ഉപയോഗിച്ച് നാവിഗേറ്റ് ചെയ്യുക" + "ടച്ച്‌പാഡ് ജെസ്ച്ചറുകൾ, കീബോർഡ് കുറുക്കുവഴികൾ എന്നിവയും മറ്റും മനസ്സിലാക്കുക" "\'മടങ്ങുക\' ജെസ്ച്ചർ" "ഹോം ജെസ്‌ച്ചർ" "ആക്ഷൻ കീ" @@ -1444,4 +1437,18 @@ "മുകളിൽ നിന്ന് തെളിച്ചം കുറയ്ക്കുന്നതിലൂടെ നിങ്ങൾക്ക് ഇപ്പോൾ സ്‌ക്രീൻ കൂടുതൽ മങ്ങിക്കാൻ കഴിയും.\n\nനിങ്ങൾ ഇരുണ്ട മുറിയിലായിരിക്കുമ്പോൾ ഇത് മികച്ച രീതിയിൽ പ്രവർത്തിക്കുന്നു." "കൂടുതൽ ഡിം ചെയ്യൽ കുറുക്കുവഴി നീക്കം ചെയ്യുക" "കൂടുതൽ ഡിം ചെയ്യാനുള്ള കുറുക്കുവഴി നീക്കം ചെയ്തു. തെളിച്ചം കുറയ്ക്കാൻ, സാധാരണ \'തെളിച്ചം ബാർ\' ഉപയോഗിക്കുക." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-mn/strings.xml b/packages/SystemUI/res/values-mn/strings.xml index ff8c52be79f8..50a942e4a2c8 100644 --- a/packages/SystemUI/res/values-mn/strings.xml +++ b/packages/SystemUI/res/values-mn/strings.xml @@ -105,6 +105,8 @@ "Тэмдэглэлд нэмэх" "Холбоосыг оруулах" "%1$s (%2$d)⁠" + + "Дэлгэцийн үйлдэл бичигч" "Дэлгэц бичлэг боловсруулж байна" "Дэлгэц бичих горимын үргэлжилж буй мэдэгдэл" @@ -292,8 +294,7 @@ "Дэлгэц амраагч" "Этернет" "Бүү саад бол" - - + "Горим" "Bluetooth" "Хослуулсан төхөөрөмж байхгүй" "Төхөөрөмжийг холбох эсвэл салгахын тулд товшино уу" @@ -434,8 +435,7 @@ "Тохиргоог нээх" "Бусад төхөөрөмж" "Тоймыг асаах/унтраах" - - + "Горим" "Болсон" "Тохиргоо" "Асаалттай" @@ -1393,18 +1393,12 @@ "Хураах дүрс тэмдэг" "Дэлгэх дүрс тэмдэг" "эсвэл" - - - - - - - - - - - - + "Гараа ашиглан шилжих" + "Товчлуурын шууд холбоосыг мэдэж аваарай" + "Мэдрэгч самбараа ашиглан шилжээрэй" + "Мэдрэгч самбарын зангааг мэдэж аваарай" + "Гар эсвэл мэдрэгч самбараа ашиглан шилжээрэй" + "Мэдрэгч самбарын зангаа, товчлуурын шууд холбоос болон бусад зүйлийг мэдэж аваарай" "Буцах зангаа" "Үндсэн нүүрний зангаа" "Тусгай товчлуур" @@ -1444,4 +1438,18 @@ "Та одоо дэлгэцийнхээ дээд талаас гэрэлтүүлгийн түвшнийг бүр илүү багасгаснаар дэлгэцийг хэт бүүдгэр болгох боломжтой.\n\nЭнэ нь таныг харанхуй орчинд байхад хамгийн сайн ажилладаг." "Хэт бүүдгэр онцлогийн товчлолыг хасах" "Хэт бүүдгэр онцлогийн товчлолыг хассан. Гэрэлтүүлгээ багасгахын тулд энгийн гэрэлтүүлгийн самбарыг ашиглана уу." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-mr/strings.xml b/packages/SystemUI/res/values-mr/strings.xml index 76515d2d4892..75ef6e0394ac 100644 --- a/packages/SystemUI/res/values-mr/strings.xml +++ b/packages/SystemUI/res/values-mr/strings.xml @@ -105,6 +105,7 @@ "टीप जोडा" "लिंकचा समावेश करा" "%1$s (%2$d)" + "इतर प्रोफाइलवरून लिंक जोडल्या जाऊ शकत नाहीत" "स्क्रीन रेकॉर्डर" "स्क्रीन रेकॉर्डिंग प्रोसेस सुरू" "स्क्रीन रेकॉर्ड सत्रासाठी सुरू असलेली सूचना" @@ -292,8 +293,7 @@ "स्क्रीन सेव्हर" "इथरनेट" "व्यत्यय आणू नका" - - + "मोड" "ब्लूटूथ" "कोणतेही जोडलेले डिव्हाइसेस उपलब्ध नाहीत" "डिव्हाइस कनेक्ट किंवा डिस्कनेक्ट करण्यासाठी टॅप करा" @@ -434,8 +434,7 @@ "सेटिंग्ज उघडा" "इतर डिव्हाइस" "अवलोकन टॉगल करा." - - + "मोड" "पूर्ण झाले" "सेटिंग्ज" "सुरू आहे" @@ -1393,18 +1392,12 @@ "कोलॅप्स करा आयकन" "विस्तार करा आयकन" "किंवा" - - - - - - - - - - - - + "तुमचा कीबोर्ड वापरून नेव्हिगेट करा" + "कीबोर्ड शॉर्टकट जाणून घ्या" + "तुमचा टचपॅड वापरून नेव्हिगेट करा" + "टचपॅड जेश्चर जाणून घ्या" + "तुमचा कीबोर्ड आणि टचपॅड वापरून नेव्हिगेट करा" + "टचपॅड जेश्चर, कीबोर्ड शॉर्टकट आणि आणखी बरेच काही जाणून घ्या" "मागे जा जेश्चर" "होम जेश्चर" "अ‍ॅक्शन की" @@ -1444,4 +1437,18 @@ "तुम्ही आता तुमच्या स्क्रीनच्या सर्वात वरून ब्राइटनेसची पातळी आणखी कमी करून स्क्रीनला आणखी डिम करू शकता.\n\nतुम्ही गडद वातावरणात असता, तेव्हा हे सर्वोत्तम कार्य करते." "आणखी डिमचा शॉर्टकट काढून टाका" "आणखी डिमचा शॉर्टकट काढून टाकला आहे. तुमचा ब्राइटनेस कमी करण्यासाठी, नेहमीचा ब्राइटनेस बार वापरा." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ms/strings.xml b/packages/SystemUI/res/values-ms/strings.xml index 181b0c7eb1bb..e8213ba5f74c 100644 --- a/packages/SystemUI/res/values-ms/strings.xml +++ b/packages/SystemUI/res/values-ms/strings.xml @@ -105,6 +105,7 @@ "Tambahkan pada nota" "Sertakan pautan" "%1$s (%2$d)" + "Pautan tidak dapat ditambahkan daripada profil lain" "Perakam Skrin" "Memproses rakaman skrin" "Pemberitahuan breterusan untuk sesi rakaman skrin" @@ -1391,18 +1392,12 @@ "Kuncupkan ikon" "Kembangkan ikon" "atau" - - - - - - - - - - - - + "Navigasi menggunakan papan kekunci anda" + "Ketahui pintasan papan kekunci" + "Navigasi menggunakan pad sentuh anda" + "Ketahui gerak isyarat pad sentuh" + "Navigasi menggunakan papan kekunci dan pad sentuh anda" + "Ketahui gerak isyarat pad sentuh, pintasan papan kekunci dan pelbagai lagi" "Gerak isyarat kembali" "Gerak isyarat pergi ke laman utama" "Kekunci tindakan" @@ -1442,4 +1437,18 @@ "Kini anda boleh menjadikan skrin amat malap dengan merendahkan tahap kecerahan lebih jauh daripada bahagian atas skrin anda.\n\nCiri ini berfungsi paling baik apabila anda berada dalam persekitaran yang gelap." "Alih keluar pintasan amat malap" "Pintasan amat malap dialih keluar. Untuk mengurangkan kecerahan anda, gunakan bar kecerahan biasa." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-my/strings.xml b/packages/SystemUI/res/values-my/strings.xml index afc57ac30166..8abb63da1b3a 100644 --- a/packages/SystemUI/res/values-my/strings.xml +++ b/packages/SystemUI/res/values-my/strings.xml @@ -105,6 +105,7 @@ "မှတ်စုတွင် ထည့်ရန်" "လင့်ခ်ထည့်သွင်းရန်" "%1$s (%2$d)" + "လင့်ခ်များကို အခြားပရိုဖိုင်များမှ ထည့်၍မရပါ" "ဖန်သားပြင်ရိုက်ကူးစက်" "စကရင်ရိုက်ကူးမှု အပြီးသတ်နေသည်" "ဖန်သားပြင် ရိုက်ကူးသည့် စက်ရှင်အတွက် ဆက်တိုက်လာနေသော အကြောင်းကြားချက်" @@ -292,8 +293,7 @@ "စခရင်နားချိန်ပုံ" "အီသာနက်" "မနှောင့်ယှက်ရ" - - + "မုဒ်များ" "ဘလူးတုသ်" "ချိတ်တွဲထားသည့် ကိရိယာများ မရှိ" "စက်ကို ချိတ်ဆက်ရန် (သို့) ချိတ်ဆက်မှုဖြုတ်ရန် တို့ပါ" @@ -434,8 +434,7 @@ "ဆက်တင်များဖွင့်ရန်" "အခြားစက်ပစ္စည်း" "ဖွင့်၊ ပိတ် အနှစ်ချုပ်" - - + "မုဒ်များ" "ပြီးပြီ" "ဆက်တင်များ" "ဖွင့်" @@ -1393,18 +1392,12 @@ "လျှော့ပြရန် သင်္ကေတ" "ပိုပြရန် သင်္ကေတ" "သို့မဟုတ်" - - - - - - - - - - - - + "သင့်ကီးဘုတ်ကိုသုံး၍ လမ်းညွှန်ခြင်း" + "လက်ကွက်ဖြတ်လမ်းများကို လေ့လာပါ" + "သင့်တာ့ချ်ပက်ကိုသုံး၍ လမ်းညွှန်ခြင်း" + "တာ့ချ်ပက်လက်ဟန်များကို လေ့လာပါ" + "သင်၏ ကီးဘုတ်နှင့် တာ့ချ်ပက်တို့ကိုသုံး၍ လမ်းညွှန်ခြင်း" + "တာ့ချ်ပက်လက်ဟန်များ၊ လက်ကွက်ဖြတ်လမ်းများ စသည်တို့ကို လေ့လာပါ" "နောက်သို့ လက်ဟန်" "ပင်မစာမျက်နှာ လက်ဟန်" "လုပ်ဆောင်ချက်ကီး" @@ -1444,4 +1437,18 @@ "သင့်စခရင်ထိပ်ဆုံး၌ပင် တောက်ပမှုအဆင့်လျှော့ချခြင်းဖြင့် စခရင်ကို ပိုမှိန်အောင် လုပ်နိုင်ပါပြီ။\n\nသင်သည် မှောင်သောပတ်ဝန်းကျင်၌ရှိချိန် ၎င်းက အကောင်းဆုံးအလုပ်လုပ်သည်။" "ပိုမှိန်ခြင်း ဖြတ်လမ်း ဖယ်ရှားရန်" "ပိုမှိန်ခြင်း ဖြတ်လမ်းကို ဖယ်ရှားလိုက်ပြီ။ တောက်ပမှုလျှော့ရန် ပုံမှန် တောက်ပမှုဘားကို အသုံးပြုပါ။" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml index d222f314f025..8ccb77618fa1 100644 --- a/packages/SystemUI/res/values-nb/strings.xml +++ b/packages/SystemUI/res/values-nb/strings.xml @@ -105,6 +105,8 @@ "Legg til i notat" "Inkluder linken" "%1$s (%2$d)" + + "Skjermopptak" "Behandler skjermopptaket" "Vedvarende varsel for et skjermopptak" @@ -292,8 +294,7 @@ "Skjermsparer" "Ethernet" "Ikke forstyrr" - - + "Moduser" "Bluetooth" "Ingen sammenkoblede enheter er tilgjengelige" "Trykk for å koble en enhet til eller fra" @@ -434,8 +435,7 @@ "Åpne Innstillinger" "Annen enhet" "Slå oversikten av eller på" - - + "Moduser" "Ferdig" "Innstillinger" "På" @@ -1393,18 +1393,12 @@ "Skjul-ikon" "Vis-ikon" "eller" - - - - - - - - - - - - + "Naviger med tastaturet" + "Lær deg hurtigtaster" + "Naviger med styreflaten" + "Lær deg styreflatebevegelser" + "Naviger med tastaturet og styreflaten" + "Lær deg styreflatebevegelser, hurtigtaster med mer" "Tilbakebevegelse" "Startskjermbevegelse" "Handlingstast" @@ -1444,4 +1438,18 @@ "Nå kan du gjøre skjermen ekstra dimmet ved å redusere lysstyrkenivået enda mer fra toppen av skjermen.\n\nDette fungerer best i mørke omgivelser." "Fjern hurtigtasten for ekstra dimmet" "Hurtigtasten for ekstra dimmet er fjernet. For å redusere lysstyrken kan du bruke den vanlige lysstyrkeraden." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ne/strings.xml b/packages/SystemUI/res/values-ne/strings.xml index 8af52a1d3b68..60e99eaf48b6 100644 --- a/packages/SystemUI/res/values-ne/strings.xml +++ b/packages/SystemUI/res/values-ne/strings.xml @@ -105,6 +105,7 @@ "नोटमा सेभ गर्नुहोस्" "लिंक समावेश गर्नुहोस्" "%1$s (%2$d)⁠" + "अन्य प्रोफाइलबाट लिंकहरू हाल्न मिल्दैन" "स्क्रिन रेकर्डर" "स्क्रिन रेकर्डिङको प्रक्रिया अघि बढाइँदै" "कुनै स्क्रिन रेकर्ड गर्ने सत्रका लागि चलिरहेको सूचना" @@ -292,8 +293,7 @@ "स्क्रिन सेभर" "Ethernet" "बाधा नपुऱ्याउनुहोस्" - - + "मोडहरू" "ब्लुटुथ" "जोडी उपकरणहरू उपलब्ध छैन" "कुनै डिभाइस कनेक्ट गर्न वा डिस्कनेक्ट गर्न ट्याप गर्नुहोस्" @@ -434,8 +434,7 @@ "सेटिङ खोल्नुहोस्" "अर्को डिभाइड" "परिदृश्य टगल गर्नुहोस्" - - + "मोडहरू" "सम्पन्न भयो" "सेटिङ" "अन छ" @@ -1393,18 +1392,12 @@ "\"कोल्याप्स गर्नुहोस्\" आइकन" "\"एक्स्पान्ड गर्नुहोस्\" आइकन" "वा" - - - - - - - - - - - - + "किबोर्ड प्रयोग गरी नेभिगेट गर्नुहोस्" + "किबोर्डका सर्टकटहरू प्रयोग गर्न सिक्नुहोस्" + "टचप्याड प्रयोग गरी नेभिगेट गर्नुहोस्" + "टचप्याड जेस्चर प्रयोग गर्न सिक्नुहोस्" + "किबोर्ड र टचप्याड प्रयोग गरी नेभिगेट गर्नुहोस्" + "टचप्याड जेस्चर, किबोर्डका सर्टकट र अन्य कुरा प्रयोग गर्न सिक्नुहोस्" "ब्याक जेस्चर" "होम जेस्चर" "एक्सन की" @@ -1444,4 +1437,18 @@ "तपाईं अब आफ्नो स्क्रिनको सिरानबाट चमकको स्तर घटाएर आफ्नो स्क्रिन अझै मधुरो बनाउन सक्नुहुन्छ।\n\nतपाईं अँध्यारो ठाउँमा भएका बेला यो सुविधाले अझ राम्रोसँग काम गर्छ।" "\"अझै मधुरो\" सर्टकट हटाउनुहोस्" "\"अझै मधुरो\" सर्टकट हटाइएको छ। स्क्रिनको चमक घटाउन \"रेगुलर ब्राइटनेस बार\" प्रयोग गर्नुहोस्।" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-nl/strings.xml b/packages/SystemUI/res/values-nl/strings.xml index 24a483503454..4b43ab173d3a 100644 --- a/packages/SystemUI/res/values-nl/strings.xml +++ b/packages/SystemUI/res/values-nl/strings.xml @@ -105,6 +105,7 @@ "Toevoegen aan notitie" "Link opnemen" "%1$s (%2$d)" + "Je kunt geen links toevoegen vanuit andere profielen" "Schermopname" "Schermopname verwerken" "Doorlopende melding voor een schermopname-sessie" @@ -292,8 +293,7 @@ "Screensaver" "Ethernet" "Niet storen" - - + "Modi" "Bluetooth" "Geen gekoppelde apparaten beschikbaar" "Tik om een apparaat te verbinden of de verbinding te verbreken" @@ -434,8 +434,7 @@ "Instellingen openen" "Ander apparaat" "Overzicht aan- of uitzetten" - - + "Modi" "Klaar" "Instellingen" "Aan" @@ -1393,18 +1392,12 @@ "Icoon voor samenvouwen" "Icoon voor uitvouwen" "of" - - - - - - - - - - - - + "Navigeren met je toetsenbord" + "Leer sneltoetsen die je kunt gebruiken" + "Navigeren met je touchpad" + "Leer touchpadgebaren die je kunt gebruiken" + "Navigeren met je toetsenbord en touchpad" + "Leer meer over onder andere touchpadgebaren en sneltoetsen" "Gebaar voor terug" "Gebaar voor startscherm" "Actietoets" @@ -1444,4 +1437,18 @@ "Je kunt het scherm nu extra dimmen door het helderheidsniveau nog verder te verlagen vanaf de bovenkant van het scherm.\n\nDit werkt het beste als je in een donkere omgeving bent." "Snelkoppeling voor extra dimmen verwijderen" "Snelkoppeling voor extra dimmen verwijderd. Als je de helderheid wilt verlagen, gebruik je de gewone helderheidsbalk." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-or/strings.xml b/packages/SystemUI/res/values-or/strings.xml index 67537c2b9a2d..af4ee77c04ed 100644 --- a/packages/SystemUI/res/values-or/strings.xml +++ b/packages/SystemUI/res/values-or/strings.xml @@ -105,6 +105,8 @@ "ନୋଟରେ ଯୋଗ କରନ୍ତୁ" "ଲିଙ୍କକୁ ଅନ୍ତର୍ଭୁକ୍ତ କରନ୍ତୁ" "%1$s (%2$d)" + + "ସ୍କ୍ରିନ ରେକର୍ଡର" "ସ୍କ୍ରିନ ରେକର୍ଡିଂର ପ୍ରକ୍ରିୟାକରଣ" "ଏକ ସ୍କ୍ରି‍ନ୍‍ ରେକର୍ଡ୍‍ ସେସନ୍‍ ପାଇଁ ଚାଲୁଥିବା ବିଜ୍ଞପ୍ତି" @@ -292,8 +294,7 @@ "ସ୍କ୍ରିନ୍‌ ସେଭର୍‌" "ଇଥରନେଟ୍‌" "ବିରକ୍ତ କରନ୍ତୁ ନାହିଁ" - - + "ମୋଡ" "ବ୍ଲୁଟୁଥ" "ପେୟାର୍‍ ହୋଇଥିବା କୌଣସି ଡିଭାଇସ୍ ଉପଲବ୍ଧ ନାହିଁ" "ଏକ ଡିଭାଇସ କନେକ୍ଟ କିମ୍ବା ଡିସକନେକ୍ଟ କରିବାକୁ ଟାପ କରନ୍ତୁ" @@ -434,8 +435,7 @@ "ସେଟିଂସ ଖୋଲନ୍ତୁ" "ଅନ୍ୟ ଡିଭାଇସ୍" "ସଂକ୍ଷିପ୍ତ ବିବରଣୀକୁ ଟୋଗଲ୍ କରନ୍ତୁ" - - + "ମୋଡ" "ହୋଇଗଲା" "ସେଟିଂସ" "ଚାଲୁ ଅଛି" @@ -653,7 +653,7 @@ "ଏହି ଆପକୁ ଅନପିନ କରିବାକୁ, \"ବ୍ୟାକ\" ଏବଂ \"ହୋମ\" ବଟନକୁ ସ୍ପର୍ଶ କରି ଦବାଇ ଧରନ୍ତୁ" "ଏହି ଆପକୁ ଅନପିନ୍ କରିବାକୁ, ଉପରକୁ ସ୍ୱାଇପ୍ କରି ଧରି ରଖନ୍ତୁ" "ବୁଝିଗଲି" - "ନାହିଁ, ଥାଉ" + "ନା, ଧନ୍ୟବାଦ" "ଆପ୍ ପିନ୍ କରାଯାଇଛି" "ଆପ୍ ଅନପିନ୍ କରାଯାଇଛି" "କଲ କରନ୍ତୁ" @@ -1393,18 +1393,12 @@ "ଆଇକନକୁ ସଙ୍କୁଚିତ କରନ୍ତୁ" "ଆଇକନକୁ ବିସ୍ତାର କରନ୍ତୁ" "କିମ୍ବା" - - - - - - - - - - - - + "ଆପଣଙ୍କ କୀବୋର୍ଡ ବ୍ୟବହାର କରି ନାଭିଗେଟ କରନ୍ତୁ" + "କୀବୋର୍ଡ ସର୍ଟକଟଗୁଡ଼ିକ ବିଷୟରେ ଜାଣନ୍ତୁ" + "ଆପଣଙ୍କ ଟଚପେଡ ବ୍ୟବହାର କରି ନାଭିଗେଟ କରନ୍ତୁ" + "ଟଚପେଡର ଜେଶ୍ଚରଗୁଡ଼ିକ ବିଷୟରେ ଜାଣନ୍ତୁ" + "ଆପଣଙ୍କ କୀବୋର୍ଡ ଏବଂ ଟଚପେଡ ବ୍ୟବହାର କରି ନାଭିଗେଟ କରନ୍ତୁ" + "ଟଚପେଡ ଜେଶ୍ଚର, କୀବୋର୍ଡ ସର୍ଟକଟ ଏବଂ ଆହୁରି ଅନେକ କିଛି ବିଷୟରେ ଜାଣନ୍ତୁ" "ବେକ ଜେଶ୍ଚର" "ହୋମ ଜେଶ୍ଚର" "ଆକ୍ସନ କୀ" @@ -1444,4 +1438,18 @@ "ବର୍ତ୍ତମାନ ଆପଣ ଆପଣଙ୍କ ସ୍କ୍ରିନର ଶୀର୍ଷରୁ ଉଜ୍ଜ୍ୱଳତାର ଲେଭେଲ ହ୍ରାସ କରି ସ୍କ୍ରିନକୁ ଅତିରିକ୍ତ ଡିମ କରିପାରିବେ।\n\nଆପଣ ଏକ ଡାର୍କ ପରିବେଶରେ ଥିଲେ ଏହା ସବୁଠାରୁ ଭଲ କାମ କରେ।" "ଅତିରିକ୍ତ ଡିମ ସର୍ଟକଟକୁ କାଢ଼ି ଦିଅନ୍ତୁ" "ଅତିରିକ୍ତ ଡିମର ସର୍ଟକଟ କାଢ଼ି ଦିଆଯାଇଛି। ଆପଣଙ୍କ ଉଜ୍ଜ୍ୱଳତା ହ୍ରାସ କରିବା ପାଇଁ ନିୟମିତ ଉଜ୍ଜ୍ୱଳତା ବାର ବ୍ୟବହାର କରନ୍ତୁ।" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-pa/strings.xml b/packages/SystemUI/res/values-pa/strings.xml index 1927d45ea248..e6b275a5cef0 100644 --- a/packages/SystemUI/res/values-pa/strings.xml +++ b/packages/SystemUI/res/values-pa/strings.xml @@ -105,6 +105,8 @@ "ਨੋਟ ਵਿੱਚ ਸ਼ਾਮਲ ਕਰੋ" "ਲਿੰਕ ਸ਼ਾਮਲ ਕਰੋ" "%1$s (%2$d)" + + "ਸਕ੍ਰੀਨ ਰਿਕਾਰਡਰ" "ਸਕ੍ਰੀਨ ਰਿਕਾਰਡਿੰਗ ਜਾਰੀ ਹੈ" "ਕਿਸੇ ਸਕ੍ਰੀਨ ਰਿਕਾਰਡ ਸੈਸ਼ਨ ਲਈ ਚੱਲ ਰਹੀ ਸੂਚਨਾ" @@ -292,8 +294,7 @@ "ਸਕ੍ਰੀਨ ਸੇਵਰ" "ਈਥਰਨੈਟ" "ਪਰੇਸ਼ਾਨ ਨਾ ਕਰੋ" - - + "ਮੋਡ" "ਬਲੂਟੁੱਥ" "ਕੋਈ ਜੋੜਾਬੱਧ ਕੀਤੀਆਂ ਡੀਵਾਈਸਾਂ ਉਪਲਬਧ ਨਹੀਂ" "ਡੀਵਾਈਸ ਨੂੰ ਕਨੈਕਟ ਜਾਂ ਡਿਸਕਨੈਕਟ ਕਰਨ ਲਈ ਟੈਪ ਕਰੋ" @@ -434,8 +435,7 @@ "ਸੈਟਿੰਗਾਂ ਖੋਲ੍ਹੋ" "ਹੋਰ ਡੀਵਾਈਸ" "ਰੂਪ-ਰੇਖਾ ਨੂੰ ਟੌਗਲ ਕਰੋ" - - + "ਮੋਡ" "ਹੋ ਗਿਆ" "ਸੈਟਿੰਗਾਂ" "ਚਾਲੂ" @@ -1393,18 +1393,12 @@ "ਪ੍ਰਤੀਕ ਨੂੰ ਸਮੇਟੋ" "ਪ੍ਰਤੀਕ ਦਾ ਵਿਸਤਾਰ ਕਰੋ" "ਜਾਂ" - - - - - - - - - - - - + "ਆਪਣੇ ਕੀ-ਬੋਰਡ ਦੀ ਵਰਤੋਂ ਕਰ ਕੇ ਨੈਵੀਗੇਟ ਕਰੋ" + "ਕੀ-ਬੋਰਡ ਸ਼ਾਰਟਕੱਟ ਬਾਰੇ ਜਾਣੋ" + "ਆਪਣੇ ਟੱਚਪੈਡ ਦੀ ਵਰਤੋਂ ਕਰ ਕੇ ਨੈਵੀਗੇਟ ਕਰੋ" + "ਟੱਚਪੈਡ ਇਸ਼ਾਰਿਆਂ ਬਾਰੇ ਜਾਣੋ" + "ਆਪਣੇ ਕੀ-ਬੋਰਡ ਅਤੇ ਟੱਚਪੈਡ ਦੀ ਵਰਤੋਂ ਕਰ ਕੇ ਨੈਵੀਗੇਟ ਕਰੋ" + "ਟੱਚਪੈਡ ਇਸ਼ਾਰੇ, ਕੀ-ਬੋਰਡ ਸ਼ਾਰਟਕੱਟ ਅਤੇ ਹੋਰ ਬਹੁਤ ਕੁਝ ਬਾਰੇ ਜਾਣੋ" "ਪਿੱਛੇ ਜਾਣ ਦਾ ਇਸ਼ਾਰਾ" "ਹੋਮ \'ਤੇ ਜਾਣ ਦਾ ਇਸ਼ਾਰਾ" "ਕਾਰਵਾਈ ਕੁੰਜੀ" @@ -1444,4 +1438,18 @@ "ਤੁਸੀਂ ਹੁਣ ਆਪਣੀ ਸਕ੍ਰੀਨ ਦੇ ਸਿਖਰ ਤੋਂ ਚਕਮ ਦੇ ਪੱਧਰ ਨੂੰ ਹੋਰ ਵੀ ਘੱਟ ਕਰ ਕੇ ਸਕ੍ਰੀਨ ਦੀ ਚਮਕ ਨੂੰ ਜ਼ਿਆਦਾ ਘੱਟ ਕਰ ਸਕਦੇ ਹੋ।\n\nਇਹ ਉਦੋਂ ਬਿਹਤਰੀਨ ਕੰਮ ਕਰਦੀ ਹੈ, ਜਦੋਂ ਤੁਸੀਂ ਹਨੇਰੇ ਵਿੱਚ ਹੁੰਦੇ ਹੋ।" "\'ਜ਼ਿਆਦਾ ਘੱਟ ਚਮਕ\' ਸ਼ਾਰਟਕੱਟ ਹਟਾਓ" "\'ਜ਼ਿਆਦਾ ਘੱਟ ਚਮਕ\' ਸ਼ਾਰਟਕੱਟ ਹਟਾਇਆ ਗਿਆ। ਆਪਣੀ ਸਕ੍ਰੀਨ ਦੀ ਚਕਮ ਨੂੰ ਘੱਟ ਕਰਨ ਲਈ, ਨਿਯਮਿਤ ਚਮਕ ਪੱਟੀ ਦੀ ਵਰਤੋਂ ਕਰੋ।" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml index 1b27dba60258..0fefcaecbdb6 100644 --- a/packages/SystemUI/res/values-pl/strings.xml +++ b/packages/SystemUI/res/values-pl/strings.xml @@ -105,6 +105,8 @@ "Dodaj do notatek" "Dołącz link" "%1$s (%2$d)⁠" + + "Nagrywanie ekranu" "Przetwarzam nagrywanie ekranu" "Stałe powiadomienie o sesji rejestrowania zawartości ekranu" @@ -292,8 +294,7 @@ "Wygaszacz ekranu" "Ethernet" "Nie przeszkadzać" - - + "Tryby" "Bluetooth" "Brak dostępnych sparowanych urządzeń" "Kliknij, aby podłączyć lub odłączyć urządzenie" @@ -434,8 +435,7 @@ "Otwórz Ustawienia" "Inne urządzenie" "Przełącz Przegląd" - - + "Tryby" "Gotowe" "Ustawienia" "Wł." @@ -510,7 +510,7 @@ "usuń widżet" "umieść wybrany widżet" "Widżety na ekranie blokady" - "Każdy zobaczy widżety na ekranie blokady, nawet gdy tablet jest zablokowany." + "Widżety są widoczne na ekranie blokady, nawet gdy tablet jest zablokowany." "odznacz widżet" "Widżety na ekranie blokady" "Aby otworzyć aplikację za pomocą widżetu, musisz potwierdzić swoją tożsamość. Pamiętaj też, że każdy będzie mógł wyświetlić widżety nawet wtedy, gdy tablet będzie zablokowany. Niektóre widżety mogą nie być przeznaczone do umieszczenia na ekranie blokady i ich dodanie w tym miejscu może być niebezpieczne." @@ -1393,18 +1393,12 @@ "Ikona zwijania" "Ikona rozwijania" "lub" - - - - - - - - - - - - + "Nawiguj za pomocą klawiatury" + "Dowiedz się więcej o skrótach klawiszowych" + "Nawiguj za pomocą touchpada" + "Poznaj gesty na touchpada" + "Nawiguj za pomocą klawiatury i touchpada" + "Poznaj gesty na touchpada, skróty klawiszowe i inne funkcje" "Gest przejścia wstecz" "Gest przejścia na ekran główny" "Klawisz działania" @@ -1444,4 +1438,18 @@ "Możesz teraz dodatkowo przyciemnić ekran, jeszcze bardziej zmniejszając poziom jasności u góry ekranu.\n\nTa funkcja sprawdza się najlepiej, gdy jesteś w ciemnym otoczeniu." "Usuń skrót do dodatkowego przyciemnienia" "Skrót do dodatkowego przyciemnienia został usunięty. Aby zmniejszyć jasność, użyj standardowego paska jasności." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-pt-rBR/strings.xml b/packages/SystemUI/res/values-pt-rBR/strings.xml index d5856af1f6d8..1331ee65a716 100644 --- a/packages/SystemUI/res/values-pt-rBR/strings.xml +++ b/packages/SystemUI/res/values-pt-rBR/strings.xml @@ -105,6 +105,8 @@ "Incluir anotação" "Incluir link" "%1$s (%2$d)⁠" + + "Gravador de tela" "Processando gravação de tela" "Notificação contínua para uma sessão de gravação de tela" @@ -292,8 +294,7 @@ "Protetor de tela" "Ethernet" "Não perturbe" - - + "Modos" "Bluetooth" "Não há dispositivos pareados disponíveis" "Toque para conectar ou desconectar um dispositivo" @@ -434,8 +435,7 @@ "Abrir as Configurações" "Outro dispositivo" "Alternar Visão geral" - - + "Modos" "Concluído" "Configurações" "Ativado" @@ -1393,18 +1393,12 @@ "Ícone \"Fechar\"" "Ícone \"Abrir\"" "ou" - - - - - - - - - - - - + "Navegue usando o teclado" + "Aprenda atalhos do teclado" + "Navegue usando o touchpad" + "Aprenda gestos do touchpad" + "Navegue usando o teclado e o touchpad" + "Aprenda gestos do touchpad, atalhos do teclado e muito mais" "Gesto de volta" "Gesto de início" "Tecla de ação" @@ -1444,4 +1438,18 @@ "Agora, na parte de cima, é possível usar o recurso Escurecer a tela, que diminui ainda mais o nível de brilho.\n\nIsso funciona melhor quando você está em um ambiente escuro." "Remover atalho de Escurecer a tela" "Atalho de Escurecer a tela removido. Use a barra normal para diminuir o brilho." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml index 6589b0fdbca7..e811fff9782b 100644 --- a/packages/SystemUI/res/values-pt-rPT/strings.xml +++ b/packages/SystemUI/res/values-pt-rPT/strings.xml @@ -105,6 +105,7 @@ "Adicionar a uma nota" "Incluir link" "%1$s (%2$d)⁠" + "Não é possível adicionar links de outros perfis" "Gravador de ecrã" "A processar a gravação de ecrã" "Notificação persistente de uma sessão de gravação de ecrã" @@ -292,8 +293,7 @@ "Proteção ecrã" "Ethernet" "Não incomodar" - - + "Modos" "Bluetooth" "Sem dispositivos sincronizados disponíveis" "Toque para associar ou desassociar um dispositivo" @@ -434,8 +434,7 @@ "Abrir definições" "Outro dispositivo" "Ativar/desativar Vista geral" - - + "Modos" "Concluir" "Definições" "Ativado" @@ -1393,18 +1392,12 @@ "Ícone de reduzir" "Ícone de expandir" "ou" - - - - - - - - - - - - + "Navegue com o teclado" + "Aprenda atalhos de teclado" + "Navegue com o touchpad" + "Aprenda gestos do touchpad" + "Navegue com o teclado e o touchpad" + "Aprenda gestos do touchpad, atalhos de teclado e muito mais" "Gesto para retroceder" "Gesto para aceder ao ecrã principal" "Tecla de ação" @@ -1444,4 +1437,18 @@ "Agora, pode tornar o ecrã ainda mais escuro reduzindo ainda mais o nível de brilho a partir da parte superior do ecrã.\n\nIsto funciona melhor quando está num ambiente escuro." "Remover atalho do escurecimento extra" "Atalho do escurecimento extra removido. Para reduzir o brilho, use a barra do brilho normal." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml index d5856af1f6d8..1331ee65a716 100644 --- a/packages/SystemUI/res/values-pt/strings.xml +++ b/packages/SystemUI/res/values-pt/strings.xml @@ -105,6 +105,8 @@ "Incluir anotação" "Incluir link" "%1$s (%2$d)⁠" + + "Gravador de tela" "Processando gravação de tela" "Notificação contínua para uma sessão de gravação de tela" @@ -292,8 +294,7 @@ "Protetor de tela" "Ethernet" "Não perturbe" - - + "Modos" "Bluetooth" "Não há dispositivos pareados disponíveis" "Toque para conectar ou desconectar um dispositivo" @@ -434,8 +435,7 @@ "Abrir as Configurações" "Outro dispositivo" "Alternar Visão geral" - - + "Modos" "Concluído" "Configurações" "Ativado" @@ -1393,18 +1393,12 @@ "Ícone \"Fechar\"" "Ícone \"Abrir\"" "ou" - - - - - - - - - - - - + "Navegue usando o teclado" + "Aprenda atalhos do teclado" + "Navegue usando o touchpad" + "Aprenda gestos do touchpad" + "Navegue usando o teclado e o touchpad" + "Aprenda gestos do touchpad, atalhos do teclado e muito mais" "Gesto de volta" "Gesto de início" "Tecla de ação" @@ -1444,4 +1438,18 @@ "Agora, na parte de cima, é possível usar o recurso Escurecer a tela, que diminui ainda mais o nível de brilho.\n\nIsso funciona melhor quando você está em um ambiente escuro." "Remover atalho de Escurecer a tela" "Atalho de Escurecer a tela removido. Use a barra normal para diminuir o brilho." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml index 59136e0b953f..35d00254bd09 100644 --- a/packages/SystemUI/res/values-ro/strings.xml +++ b/packages/SystemUI/res/values-ro/strings.xml @@ -105,6 +105,8 @@ "Adaugă în notă" "Include linkul" "%1$s (%2$d)⁠" + + "Recorder pentru ecran" "Se procesează înregistrarea" "Notificare în curs pentru o sesiune de înregistrare a ecranului" @@ -292,8 +294,7 @@ "Screensaver" "Ethernet" "Nu deranja" - - + "Moduri" "Bluetooth" "Niciun dispozitiv conectat disponibil" "Atinge pentru a conecta sau deconecta un dispozitiv" @@ -434,8 +435,7 @@ "Deschide Setări" "Alt dispozitiv" "Comută secțiunea Recente" - - + "Moduri" "Gata" "Setări" "Activat" @@ -1393,18 +1393,12 @@ "Pictograma de restrângere" "Pictograma de extindere" "sau" - - - - - - - - - - - - + "Navighează folosind tastatura" + "Învață comenzile rapide de la tastatură" + "Navighează folosind touchpadul" + "Învață gesturi pentru touchpad" + "Navighează folosind tastatura și touchpadul" + "Învață gesturi pentru touchpad, comenzi rapide de la tastatură și altele" "Gestul Înapoi" "Gestul Ecran de pornire" "Tastă de acțiuni" @@ -1444,4 +1438,18 @@ "Poți reduce suplimentar luminozitatea ecranului dacă scazi nivelul de luminozitate din partea de sus a ecranului.\n\nAcest lucru funcționează cel mai bine într-un mediu întunecat." "Elimină comanda rapidă de luminozitate redusă suplimentar" "S-a eliminat comanda rapidă de luminozitate redusă suplimentar. Ca să reduci luminozitatea, folosește bara obișnuită de luminozitate." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml index de436766ba07..2174dde011c0 100644 --- a/packages/SystemUI/res/values-ru/strings.xml +++ b/packages/SystemUI/res/values-ru/strings.xml @@ -105,6 +105,7 @@ "Добавить в заметку" "Добавить ссылку" "%1$s (%2$d)" + "Нельзя добавлять ссылки из других профилей." "Запись видео с экрана" "Обработка записи с экрана…" "Текущее уведомление для записи видео с экрана" @@ -292,8 +293,7 @@ "Заставка" "Ethernet" "Не беспокоить" - - + "Режимы" "Bluetooth" "Нет доступных сопряженных устройств" "Нажмите, чтобы подключить или отключить устройство." @@ -301,7 +301,7 @@ "Все" "Использовать" "Подключено" - "Отправка аудио" + "Передача аудио" "Нажмите, чтобы переключить аудио или поделиться им" "Сохранено" "отключить" @@ -434,8 +434,7 @@ "Открыть настройки" "Другое устройство" "Переключить режим обзора" - - + "Режимы" "Готово" "Настройки" "Включено" @@ -1393,18 +1392,12 @@ "Значок \"Свернуть\"" "Значок \"Развернуть\"" "или" - - - - - - - - - - - - + "Навигация с помощью клавиатуры" + "Узнайте о сочетаниях клавиш." + "Навигация с помощью сенсорной панели" + "Узнайте о жестах на сенсорной панели." + "Навигация с помощью клавиатуры и сенсорной панели" + "Узнайте о жестах на сенсорной панели, сочетаниях клавиш и многом другом." "Жест \"назад\"" "Жест \"на главный экран\"" "Клавиша действия" @@ -1444,4 +1437,18 @@ "Чтобы дополнительно понизить яркость экрана, откройте настройки в его верхней части.\n\nРекомендуем использовать эту функцию, когда вокруг темно." "Удалить быструю команду для дополнительного уменьшения яркости" "Быстрая команда для дополнительного уменьшения яркости удалена. Чтобы изменить уровень яркости, воспользуйтесь стандартным ползунком яркости." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-si/strings.xml b/packages/SystemUI/res/values-si/strings.xml index 8d6cd091d31e..167e9cdeb64e 100644 --- a/packages/SystemUI/res/values-si/strings.xml +++ b/packages/SystemUI/res/values-si/strings.xml @@ -105,6 +105,8 @@ "සටහනට එක් කරන්න" "සබැඳිය ඇතුළත් කරන්න" "%1$s (%2$d)⁠" + + "තිර රෙකෝඩරය" "තිර පටිගත කිරීම සකසමින්" "තිර පටිගත කිරීමේ සැසියක් සඳහා කෙරෙන දැනුම් දීම" @@ -292,8 +294,7 @@ "තිර සුරැකුම" "ඊතර නෙට්" "බාධා නොකරන්න" - - + "ප්‍රකාර" "බ්ලූටූත්" "යුගල කළ උපාංග නොතිබේ" "උපාංගයක් සම්බන්ධ කිරීමට හෝ විසන්ධි කිරීමට තට්ටු කරන්න" @@ -434,8 +435,7 @@ "සැකසීම් විවෘත කරන්න" "වෙනත් උපාංගය" "දළ විශ්ලේෂණය ටොගල කරන්න" - - + "ප්‍රකාර" "නිමයි" "සැකසීම්" "ක්‍රියාත්මකයි" @@ -1393,18 +1393,12 @@ "හැකුළුම් නිරූපකය" "දිගහැරීම් නිරූපකය" "හෝ" - - - - - - - - - - - - + "ඔබේ යතුරු පුවරුව භාවිතයෙන් සංචාලනය කරන්න" + "යතුරුපුවරු කෙටිමං ඉගෙන ගන්න" + "ඔබේ ස්පර්ශ පෑඩ් භාවිතයෙන් සංචාලනය කරන්න" + "ස්පර්ශක පුවරු අභිනයන් ඉගෙන ගන්න" + "ඔබේ යතුරු පුවරුව සහ ස්පර්ශ පෑඩ් භාවිතයෙන් සංචාලනය කරන්න" + "ස්පර්ශ පෑඩ් අභිනයන්, යතුරුපුවරු කෙටිමං සහ තවත් දේ ඉගෙන ගන්න" "ආපසු අභිනය" "නිවෙස් අභිනය" "ක්‍රියා යතුර" @@ -1444,4 +1438,18 @@ "ඔබේ තිරයේ ඉහළ සිට දීප්තියේ මට්ටම තවත් අඩු කිරීමෙන් ඔබට දැන් තිරය තවත් අඳුරු කළ හැක.\n\nඔබ අඳුරු පරිසරයක සිටින විට මෙය වඩාත් හොඳින් ක්‍රියා කරයි." "තවත් අඳුරු කෙටිමඟ ඉවත් කරන්න" "තවත් අඳුරු කෙටිමඟ ඉවත් කරන ලදි. ඔබේ දීප්තිය අඩු කිරීමට, සාමාන්‍ය දීප්ත තීරුව භාවිත කරන්න." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-sk/strings.xml b/packages/SystemUI/res/values-sk/strings.xml index 715928540706..dd872c25eeb5 100644 --- a/packages/SystemUI/res/values-sk/strings.xml +++ b/packages/SystemUI/res/values-sk/strings.xml @@ -105,6 +105,7 @@ "Pridať do poznámky" "Zahrnúť odkaz" "%1$s (%2$d)" + "Odkazy z iných profilov sa nedajú pridať" "Rekordér obrazovky" "Spracúva sa záznam obrazovky" "Zobrazuje sa upozornenie týkajúce sa relácie záznamu obrazovky" @@ -292,8 +293,7 @@ "Šetrič obrazovky" "Ethernet" "Režim bez vyrušení" - - + "Režimy" "Bluetooth" "Nie sú k dispozícii žiadne spárované zariadenia" "Klepnutím pripojíte alebo odpojíte zariadenie" @@ -434,8 +434,7 @@ "Otvoriť Nastavenia" "Iné zariadenie" "Prepnúť prehľad" - - + "Režimy" "Hotovo" "Nastavenia" "Zapnuté" @@ -1393,18 +1392,12 @@ "Ikona zbalenia" "Ikona rozbalenia" "alebo" - - - - - - - - - - - - + "Prechádzajte pomocou klávesnice" + "Naučte sa klávesové skratky" + "Prechádzajte pomocou touchpadu" + "Naučte sa gestá touchpadu" + "Prechádzajte pomocou klávesnice a touchpadu" + "Naučte sa gestá touchpadu, klávesové skratky a ďalšie funkcie" "Gesto prechodu späť" "Gesto prechodu domov" "Akčný kláves" @@ -1444,4 +1437,18 @@ "Teraz môžete obrazovku mimoriadne stmaviť ešte ďalším znížením úrovne jasu v hornej časti obrazovky.\n\nNajlepšie to funguje v tmavom prostredí." "Odstrániť skratku mimoriadneho stmavenia" "Skratka mimoriadneho stmavenia bola odstránená. Ak chcete znížiť jas, použite bežný posúvač jasu." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-sl/strings.xml b/packages/SystemUI/res/values-sl/strings.xml index f2c466eb5097..01ca4e57162d 100644 --- a/packages/SystemUI/res/values-sl/strings.xml +++ b/packages/SystemUI/res/values-sl/strings.xml @@ -105,6 +105,7 @@ "Dodaj v zapisek" "Vključi povezavo" "%1$s (%2$d)" + "Povezav ni mogoče dodati iz drugih profilov" "Snemalnik zaslona" "Obdelava videoposnetka zaslona" "Nenehno obveščanje o seji snemanja zaslona" @@ -292,8 +293,7 @@ "Ohranjeval. zaslona" "Ethernet" "Ne moti" - - + "Načini" "Bluetooth" "Na voljo ni nobene seznanjene naprave" "Dotaknite se za vzpostavitev ali prekinitev povezave z napravo" @@ -434,8 +434,7 @@ "Odpri nastavitve" "Druga naprava" "Vklop/izklop pregleda" - - + "Načini" "Končano" "Nastavitve" "Vklopljeno" @@ -1393,18 +1392,12 @@ "Ikona za strnitev" "Ikona za razširitev" "ali" - - - - - - - - - - - - + "Krmarjenje s tipkovnico" + "Učenje bližnjičnih tipk" + "Krmarjenje s sledilno ploščico" + "Učenje potez na sledilni ploščici" + "Krmarjenje s tipkovnico in sledilno ploščico" + "Učenje potez na sledilni ploščici, bližnjičnih tipk in drugega" "Poteza za pomik nazaj" "Poteza za začetni zaslon" "Gumb za dejanje" @@ -1444,4 +1437,18 @@ "Zdaj lahko zelo zatemnite zaslon tako, da na vrhu zaslona dodatno zmanjšate raven svetlosti.\n\nTa funkcija najbolje deluje v temnem okolju." "Odstrani bližnjico do funkcije Zelo zatemnjeno" "Bližnjica do funkcije Zelo zatemnjeno je odstranjena. Če želite zmanjšati svetlost, uporabite običajno vrstico za uravnavanje svetlosti." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-sq/strings.xml b/packages/SystemUI/res/values-sq/strings.xml index 70ea421b85ba..c4f880877ea2 100644 --- a/packages/SystemUI/res/values-sq/strings.xml +++ b/packages/SystemUI/res/values-sq/strings.xml @@ -105,6 +105,8 @@ "Shto te shënimi" "Përfshi lidhjen" "%1$s (%2$d)⁠" + + "Regjistruesi i ekranit" "Regjistrimi i ekranit po përpunohet" "Njoftim i vazhdueshëm për një seancë regjistrimi të ekranit" @@ -292,8 +294,7 @@ "Mbrojtësi i ekranit" "Eternet" "Mos shqetëso" - - + "Modalitetet" "Bluetooth-i" "Nuk ofrohet për përdorim asnjë pajisje e çiftuar" "Trokit për të lidhur ose shkëputur një pajisje" @@ -434,8 +435,7 @@ "Hap \"Cilësimet\"" "Pajisje tjetër" "Kalo te përmbledhja" - - + "Modalitetet" "U krye" "Cilësimet" "Aktiv" @@ -1393,18 +1393,12 @@ "Ikona e palosjes" "Ikona e zgjerimit" "ose" - - - - - - - - - - - - + "Navigo duke përdorur tastierën tënde" + "Mëso shkurtoret e tastierës" + "Navigo duke përdorur bllokun me prekje" + "Mëso gjestet e bllokut me prekje" + "Navigo duke përdorur tastierën dhe bllokun me prekje" + "Mëso gjestet e bllokut me prekje, shkurtoret e tastierës etj." "Gjesti i kthimit prapa" "Gjesti për të shkuar tek ekrani bazë" "Tasti i veprimit" @@ -1444,4 +1438,18 @@ "Tani mund ta bësh ekranin shumë më të zbehtë duke e ulur nivelin e ndriçimit edhe më tej nga kreu i ekranit.\n\nKjo funksionon më mirë kur je në një mjedis të errët." "Hiq shkurtoren e modalitetit \"Shumë më i zbehtë\"" "Shkurtorja e modalitetit \"Shumë më i zbehtë\" u hoq. Për të ulur ndriçimin, përdor shiritin e zakonshëm të ndriçimit." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-sr/strings.xml b/packages/SystemUI/res/values-sr/strings.xml index 6db372d192da..66a4915ae3be 100644 --- a/packages/SystemUI/res/values-sr/strings.xml +++ b/packages/SystemUI/res/values-sr/strings.xml @@ -105,6 +105,7 @@ "Додај у белешку" "Уврсти линк" "%1$s (%2$d)" + "Не можете да додате линкове са других профила" "Снимач екрана" "Обрађујемо видео снимка екрана" "Обавештење о сесији снимања екрана је активно" @@ -292,8 +293,7 @@ "Чувар екрана" "Етернет" "Не узнемиравај" - - + "Режими" "Bluetooth" "Није доступан ниједан упарени уређај" "Додирните да бисте повезали уређај или прекинули везу" @@ -434,8 +434,7 @@ "Отвори Подешавања" "Други уређај" "Укључи/искључи преглед" - - + "Режими" "Готово" "Подешавања" "Укључено" @@ -488,7 +487,7 @@ "Одбаци" "Додајте, уклоните и преуредите виџете овде" "Додајте још виџета" - "Дуги притисак за прилагођавање виџета" + "Дуго притисните за прилагођавање виџета" "Прилагоди виџете" "Откључајте да бисте прилагодили виџете" "Икона апликације за онемогућен виџет" @@ -1393,18 +1392,12 @@ "Икона за скупљање" "Икона за проширивање" "или" - - - - - - - - - - - - + "Крећите се помоћу тастатуре" + "Сазнајте више о тастерским пречицама" + "Крећите се помоћу тачпеда" + "Научите покрете за тачпед" + "Крећите се помоћу тастатуре и тачпeда" + "Научите покрете за тачпед, тастерске пречице и друго" "Покрет за враћање" "Покрет за почетну страницу" "Тастер радњи" @@ -1444,4 +1437,18 @@ "Сада можете додатно да затамните екран смањивањем нивоа осветљености при врху екрана. \n\nОво најбоље функционише када сте у тамном окружењу." "Уклони пречицу за додатно затамњивање" "Уклоњена је пречица за додатно затамњивање. Да бисте смањили осветљеност, користите уобичајену траку за осветљеност." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml index 225e3b3c5007..5ec9e963a15f 100644 --- a/packages/SystemUI/res/values-sv/strings.xml +++ b/packages/SystemUI/res/values-sv/strings.xml @@ -105,6 +105,8 @@ "Lägg till i anteckning" "Inkludera länk" "%1$s (%2$d)" + + "Skärminspelare" "Behandlar skärminspelning" "Avisering om att skärminspelning pågår" @@ -292,8 +294,7 @@ "Skärmsläckare" "Ethernet" "Stör ej" - - + "Lägen" "Bluetooth" "Det finns inga kopplade enheter tillgängliga" "Tryck för att ansluta eller koppla från en enhet" @@ -434,8 +435,7 @@ "Öppna Inställningar" "Annan enhet" "Aktivera och inaktivera översikten" - - + "Lägen" "Klar" "Inställningar" "På" @@ -1393,18 +1393,12 @@ "Ikonen Komprimera" "Ikonen Utöka" "eller" - - - - - - - - - - - - + "Navigera med tangentbordet" + "Lär dig kortkommandon" + "Navigera med styrplattan" + "Lär dig rörelser för styrplattan" + "Navigera med tangentbordet och styrplattan" + "Lär dig rörelser för styrplattan, kortkommandon med mera" "Tillbaka-rörelse" "Rörelse för att öppna startskärmen" "Åtgärdstangent" @@ -1444,4 +1438,18 @@ "Nu kan du göra skärmen extradimmad genom att sänka ljusstyrkan ännu mer från överst på skärmen.\n\nDetta fungerar bäst när omgivningen är mörk." "Ta bort kortkommandot för extradimmat" "Kortkommandot för extradimmat har tagits bort. Använd det vanliga fältet för ljusstyrka om du vill sänka ljusstyrkan." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-sw/strings.xml b/packages/SystemUI/res/values-sw/strings.xml index 9fa8e558aa42..ababf7010302 100644 --- a/packages/SystemUI/res/values-sw/strings.xml +++ b/packages/SystemUI/res/values-sw/strings.xml @@ -105,6 +105,8 @@ "Ongeza kwenye dokezo" "Jumuisha kiungo" "(%2$d) %1$s" + + "Kinasa Skrini" "Inachakata rekodi ya skrini" "Arifa inayoendelea ya kipindi cha kurekodi skrini" @@ -292,8 +294,7 @@ "Taswira ya skrini" "Ethernet" "Usinisumbue" - - + "Hali" "Bluetooth" "Hakuna vifaa vilivyooanishwa vinavyopatikana" "Gusa ili uunganishe au utenganishe kifaa" @@ -434,8 +435,7 @@ "Fungua Mipangilio" "Kifaa kingine" "Washa Muhtasari" - - + "Hali" "Nimemaliza" "Mipangilio" "Imewashwa" @@ -1393,18 +1393,12 @@ "Kunja aikoni" "Panua aikoni" "au" - - - - - - - - - - - - + "Kusogeza kwa kutumia kibodi yako" + "Jifunze kuhusu mikato ya kibodi" + "Kusogeza kwa kutumia padi yako ya kugusa" + "Jifunze kuhusu miguso ya padi ya kugusa" + "Kusogeza kwa kutumia kibodi na padi yako ya kugusa" + "Jifunze kuhusu miguso ya padi ya kugusa, mikato ya kibodi na mengineyo" "Ishara ya kurudi nyuma" "Mguso wa kurudi kwenye skrini ya kwanza" "Kitufe cha vitendo" @@ -1444,4 +1438,18 @@ "Sasa unaweza kupunguza mwangaza zaidi kwa kupunguza kabisa kiwango cha mwangaza katika sehemu ya juu ya skrini yako.\n\nMipangilio hii hufanya kazi vyema zaidi ukiwa katika mazingira yenye giza." "Ondoa njia ya mkato ya kipunguza mwangaza zaidi" "Njia ya mkato ya kipunguza mwangaza zaidi imeondolewa. Tumia upau wa kawaida wa mwangaza ili upunguze mwangaza wako." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ta/strings.xml b/packages/SystemUI/res/values-ta/strings.xml index 7acd1e85129b..54ab3c337f94 100644 --- a/packages/SystemUI/res/values-ta/strings.xml +++ b/packages/SystemUI/res/values-ta/strings.xml @@ -105,6 +105,7 @@ "குறிப்பில் சேர்" "இணைப்பைச் சேர்" "%1$s (%2$d)" + "பிற சுயவிவர்ங்களில் இருந்து இணைப்புகளைச் சேர்க்க முடியாது" "ஸ்கிரீன் ரெக்கார்டர்" "ஸ்க்ரீன் ரெக்கார்டிங் செயலாக்கப்படுகிறது" "திரை ரெக்கார்டிங் அமர்விற்கான தொடர் அறிவிப்பு" @@ -292,8 +293,7 @@ "ஸ்கிரீன் சேவர்" "ஈதர்நெட்" "தொந்தரவு செய்ய வேண்டாம்" - - + "பயன்முறைகள்" "புளூடூத்" "இணைக்கப்பட்ட சாதனங்கள் இல்லை" "சாதனத்தை இணைக்க/துண்டிக்க தட்டவும்" @@ -434,8 +434,7 @@ "அமைப்புகளைத் திற" "பிற சாதனம்" "மேலோட்டப் பார்வையை நிலைமாற்று" - - + "பயன்முறைகள்" "முடிந்தது" "அமைப்புகள்" "இயக்கப்பட்டுள்ளது" @@ -1393,18 +1392,12 @@ "சுருக்குவதற்கான ஐகான்" "விரிவாக்குவதற்கான ஐகான்" "அல்லது" - - - - - - - - - - - - + "கீபோர்டைப் பயன்படுத்திச் செல்லுதல்" + "கீபோர்டு ஷார்ட்கட்கள் குறித்துத் தெரிந்துகொள்ளுங்கள்" + "டச்பேடைப் பயன்படுத்திச் செல்லுதல்" + "டச்பேட் சைகைள் குறித்துத் தெரிந்துகொள்ளுங்கள்" + "உங்கள் டச்பேட் மற்றும் கீபோர்டைப் பயன்படுத்திச் செல்லுதல்" + "டச்பேட் சைகைகள், கீபோர்டு ஷார்ட்கட்கள் மற்றும் பலவற்றைத் தெரிந்துகொள்ளுங்கள்" "பின்செல்வதற்கான சைகை" "முகப்பிற்குச் செல்வதற்கான சைகை" "ஆக்ஷன் பட்டன்" @@ -1444,4 +1437,18 @@ "இப்போது உங்கள் திரையின் மேற்பகுதியில் ஒளிர்வு அளவைக் குறைப்பதன் மூலம் திரையை மிகக் குறைவான வெளிச்சத்திற்குக் கொண்டு வரலாம்.\n\nஇருட்டான சூழலில் இருக்கும்போது இது சிறப்பாகச் செயல்படும்." "மிகக் குறைவான வெளிச்சத்திற்கான ஷார்ட்கட்டை அகற்று" "மிகக் குறைவான வெளிச்சத்திற்கான ஷார்ட்கட் அகற்றப்பட்டது. உங்கள் ஒளிர்வைக் குறைக்க, வழக்கமான ஒளிர்வுப் பட்டியைப் பயன்படுத்துங்கள்." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-te/strings.xml b/packages/SystemUI/res/values-te/strings.xml index 5cba2efbfc94..2c4109a8fd9e 100644 --- a/packages/SystemUI/res/values-te/strings.xml +++ b/packages/SystemUI/res/values-te/strings.xml @@ -105,6 +105,7 @@ "గమనికకు జోడించండి" "లింక్‌ను చేర్చండి" "%1$s (%2$d)⁠" + "ఇతర ప్రొఫైల్స్ నుండి లింక్‌లు జోడించబడవు" "స్క్రీన్ రికార్డర్" "స్క్రీన్ రికార్డింగ్ అవుతోంది" "స్క్రీన్ రికార్డ్ సెషన్ కోసం ఆన్‌గోయింగ్ నోటిఫికేషన్" @@ -292,8 +293,7 @@ "స్క్రీన్ సేవర్" "ఈథర్‌నెట్" "అంతరాయం కలిగించవద్దు" - - + "మోడ్‌లు" "బ్లూటూత్" "జత చేసిన పరికరాలు ఏవీ అందుబాటులో లేవు" "పరికరాన్ని కనెక్ట్ చేయడానికి లేదా డిస్‌కనెక్ట్ చేయడానికి ట్యాప్ చేయండి" @@ -434,8 +434,7 @@ "సెట్టింగ్‌లను తెరవండి" "ఇతర పరికరం" "స్థూలదృష్టిని టోగుల్ చేయి" - - + "మోడ్‌లు" "పూర్తయింది" "సెట్టింగ్‌లు" "ఆన్‌లో ఉంది" @@ -1393,18 +1392,12 @@ "కుదించండి చిహ్నం" "విస్తరించండి చిహ్నం" "లేదా" - - - - - - - - - - - - + "మీ కీబోర్డ్ ఉపయోగించి నావిగేట్ చేయండి" + "కీబోర్డ్ షార్ట్‌కట్‌ల గురించి తెలుసుకోండి" + "మీ టచ్‌ప్యాడ్‌ని ఉపయోగించి నావిగేట్ చేయండి" + "టచ్‌ప్యాడ్ సంజ్ఞ గురించి తెలుసుకోండి" + "మీ కీబోర్డ్, టచ్‌ప్యాడ్‌ను ఉపయోగించి నావిగేట్ చేయండి" + "టచ్‌ప్యాడ్ సంజ్ఞలు, కీబోర్డ్ షార్ట్‌కట్‌లు, అలాగే మరిన్నింటిని గురించి తెలుసుకోండి" "వెనుకకు పంపే సంజ్ఞ" "హోమ్‌కు పంపే సంజ్ఞ" "యాక్షన్ కీ" @@ -1444,4 +1437,18 @@ "మీరు ఇప్పుడు మీ స్క్రీన్ పైభాగం నుండి బ్రైట్‌నెస్ స్థాయిని తగ్గించడం ద్వారా కూడా స్క్రీన్ కాంతిని మరింత డిమ్ చేయవచ్చు.\n\nమీరు డార్క్ ఎన్విరాన్‌మెంట్‌లో ఉన్నప్పుడు కూడా ఇది బాగా పని చేస్తుంది." "కాంతిని మరింత డిమ్ చేసే షార్ట్‌కట్‌ను తీసివేయండి" "కాంతిని మరింత డిమ్ చేసే షార్ట్‌కట్ తీసివేయబడింది. మీ బ్రైట్‌నెస్‌ను తగ్గించడానికి, సాధారణ బ్రైట్‌నెస్ బార్‌ను ఉపయోగించండి." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-th/strings.xml b/packages/SystemUI/res/values-th/strings.xml index 905ab9834eef..20e730c2df57 100644 --- a/packages/SystemUI/res/values-th/strings.xml +++ b/packages/SystemUI/res/values-th/strings.xml @@ -105,6 +105,7 @@ "เพิ่มลงในโน้ต" "รวมลิงก์" "%1$s (%2$d)" + "เพิ่มลิงก์จากโปรไฟล์อื่นไม่ได้" "โปรแกรมบันทึกหน้าจอ" "กำลังประมวลผลการอัดหน้าจอ" "การแจ้งเตือนต่อเนื่องสำหรับเซสชันการบันทึกหน้าจอ" @@ -292,8 +293,7 @@ "ภาพพักหน้าจอ" "อีเทอร์เน็ต" "ห้ามรบกวน" - - + "โหมด" "บลูทูธ" "ไม่มีอุปกรณ์ที่จับคู่ที่สามารถใช้ได้" "แตะเพื่อเชื่อมต่อหรือยกเลิกการเชื่อมต่ออุปกรณ์" @@ -434,8 +434,7 @@ "เปิดการตั้งค่า" "อุปกรณ์อื่น" "สลับภาพรวม" - - + "โหมด" "เสร็จสิ้น" "การตั้งค่า" "เปิด" @@ -1393,18 +1392,12 @@ "ไอคอนยุบ" "ไอคอนขยาย" "หรือ" - - - - - - - - - - - - + "ไปยังส่วนต่างๆ โดยใช้แป้นพิมพ์" + "ดูข้อมูลเกี่ยวกับแป้นพิมพ์ลัด" + "ไปยังส่วนต่างๆ โดยใช้ทัชแพด" + "ดูข้อมูลเกี่ยวกับท่าทางสัมผัสของทัชแพด" + "ไปยังส่วนต่างๆ โดยใช้แป้นพิมพ์และทัชแพด" + "ดูข้อมูลเกี่ยวกับท่าทางสัมผัสของทัชแพด แป้นพิมพ์ลัด และอื่นๆ" "ท่าทางสัมผัสสำหรับย้อนกลับ" "ท่าทางสัมผัสสำหรับหน้าแรก" "ปุ่มดำเนินการ" @@ -1444,4 +1437,18 @@ "ตอนนี้คุณสามารถหรี่แสงหน้าจอเพิ่มเติมได้โดยลดระดับความสว่างจากด้านบนของหน้าจอมากขึ้น\n\nฟีเจอร์นี้จะทำงานได้ดีเมื่อคุณอยู่ในที่มืด" "นำทางลัดหรี่แสงเพิ่มเติมออก" "นำทางลัดหรี่แสงเพิ่มเติมออกแล้ว หากต้องการลดความสว่าง ให้ใช้แถบความสว่างปกติ" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-tl/strings.xml b/packages/SystemUI/res/values-tl/strings.xml index 5e9d7207badf..0bef7436269c 100644 --- a/packages/SystemUI/res/values-tl/strings.xml +++ b/packages/SystemUI/res/values-tl/strings.xml @@ -105,6 +105,7 @@ "Idagdag sa tala" "Isama ang link" "%1$s (%2$d)⁠" + "Hindi maidaragdag ang mga link mula sa ibang profile" "Recorder ng Screen" "Pinoproseso screen recording" "Kasalukuyang notification para sa session ng pag-record ng screen" @@ -1391,18 +1392,12 @@ "I-collapse ang icon" "I-expand ang icon" "o" - - - - - - - - - - - - + "Mag-navigate gamit ang iyong keyboard" + "Matuto ng mga keyboard shortcut" + "Mag-navigate gamit ang iyong touchpad" + "Matuto ng mga galaw sa touchpad" + "Mag-navigate gamit ang iyong keyboard at touchpad" + "Matuto ng mga galaw sa touchpad, keyboard shortcut, at higit pa" "Galaw para bumalik" "Galaw para sa Home" "Action key" @@ -1442,4 +1437,18 @@ "Puwede mo nang gawing extra dim ang screen sa pamamagitan ng pagpapababa ng level ng liwanag nang higit pa mula sa itaas ng iyong screen.\n\nPinakamahusay itong gumagana kapag nasa madilim na kapaligiran ka." "Alisin ang shortcut ng extra dim" "Inalis ang shortcut ng extra dim. Para bawasan ang liwanag, gamitin ang karaniwang bar ng liwanag." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-tr/strings.xml b/packages/SystemUI/res/values-tr/strings.xml index db4940233b45..060ecd1010eb 100644 --- a/packages/SystemUI/res/values-tr/strings.xml +++ b/packages/SystemUI/res/values-tr/strings.xml @@ -105,6 +105,8 @@ "Nota ekle" "Bağlantıyı dahil et" "%1$s (%2$d)" + + "Ekran Kaydedicisi" "Ekran kaydı işleniyor" "Ekran kaydı oturumu için devam eden bildirim" @@ -292,8 +294,7 @@ "Ekran koruyucu" "Ethernet" "Rahatsız Etmeyin" - - + "Modlar" "Bluetooth" "Kullanılabilir eşlenmiş cihaz yok" "Cihaz bağlamak veya cihazın bağlantısını kesmek için dokunun" @@ -434,8 +435,7 @@ "Ayarlar\'ı aç" "Diğer cihaz" "Genel bakışı aç/kapat" - - + "Modlar" "Bitti" "Ayarlar" "Açık" @@ -1393,18 +1393,12 @@ "Daralt simgesi" "Genişlet simgesi" "veya" - - - - - - - - - - - - + "Klavyenizi kullanarak gezinin" + "Klavye kısayollarını öğrenin" + "Dokunmatik alanınızı kullanarak gezinin" + "Dokunmatik alan hareketlerini öğrenin" + "Klavyenizi ve dokunmatik alanınızı kullanarak gezinin" + "Dokunmatik alan hareketlerini, klavye kısayollarını ve daha fazlasını öğrenin" "Geri hareketi" "Ana sayfa hareketi" "Eylem tuşu" @@ -1444,4 +1438,18 @@ "Artık ekranınızın üst kısmından parlaklık seviyesini daha da düşürerek ekranı ekstra loş hale getirebilirsiniz.\n\nBu özellik, karanlık ortamdayken en iyi sonucu verir." "Ekstra loş kısayolunu kaldır" "Ekstra loş kısayolu kaldırıldı. Parlaklık seviyesini düşürmek için normal parlaklık çubuğunu kullanın." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-uk/strings.xml b/packages/SystemUI/res/values-uk/strings.xml index 6d881df5d6c6..ae07ae26d0f0 100644 --- a/packages/SystemUI/res/values-uk/strings.xml +++ b/packages/SystemUI/res/values-uk/strings.xml @@ -105,6 +105,8 @@ "Додати до примітки" "Додати посилання" "%1$s (%2$d)" + + "Запис відео з екрана" "Обробка записування екрана" "Сповіщення про сеанс запису екрана" @@ -292,8 +294,7 @@ "Заставка" "Ethernet" "Не турбувати" - - + "Режими" "Bluetooth" "Немає спарених пристроїв" "Натисніть, щоб під’єднати або від’єднати пристрій" @@ -434,8 +435,7 @@ "Відкрити налаштування" "Інший пристрій" "Увімкнути або вимкнути огляд" - - + "Режими" "Готово" "Налаштування" "Увімкнено" @@ -1393,18 +1393,12 @@ "Значок згортання" "Значок розгортання" "або" - - - - - - - - - - - - + "Навігація за допомогою клавіатури" + "Комбінації клавіш: докладніше" + "Навігація за допомогою сенсорної панелі" + "Жести для сенсорної панелі: докладніше" + "Навігація за допомогою клавіатури й сенсорної панелі" + "Жести для сенсорної панелі, комбінації клавіш тощо: докладніше" "Жест \"Назад\"" "Жест переходу на головний екран" "Клавіша дії" @@ -1444,4 +1438,18 @@ "Тепер ви можете зробити екран ще темнішим, додатково зменшуючи рівень яскравості вгорі екрана.\n\nНайкраще ця функція працює, коли ви перебуваєте в темному місці." "Видалити комбінацію клавіш для додаткового зменшення яскравості" "Комбінацію клавіш для додаткового зменшення яскравості видалено. Щоб зменшити яскравість, використовуйте стандартну панель регулювання." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-ur/strings.xml b/packages/SystemUI/res/values-ur/strings.xml index 628d66094431..5d1f66e364ef 100644 --- a/packages/SystemUI/res/values-ur/strings.xml +++ b/packages/SystemUI/res/values-ur/strings.xml @@ -105,6 +105,7 @@ "نوٹ میں شامل کریں" "لنک شامل کریں" "%1$s (%2$d)⁠" + "دوسری پروفائلز سے لنکس شامل نہیں کیے جا سکتے" "اسکرین ریکارڈر" "سکرین ریکارڈنگ پروسیس ہورہی ہے" "اسکرین ریکارڈ سیشن کیلئے جاری اطلاع" @@ -292,8 +293,7 @@ "اسکرین سیور" "ایتھرنیٹ" "ڈسٹرب نہ کریں" - - + "موڈز" "بلوٹوتھ" "کوئی جوڑا بنائے ہوئے آلات دستیاب نہیں ہیں" "کسی آلے کو منسلک یا غیر منسلک کرنے کے لیے تھپتھپائیں" @@ -434,8 +434,7 @@ "ترتیبات کھولیں" "دوسرا آلہ" "مجموعی جائزہ ٹوگل کریں" - - + "موڈز" "ہو گیا" "ترتیبات" "آن ہے" @@ -1393,18 +1392,12 @@ "آئیکن سکیڑیں" "آئیکن پھیلائیں" "یا" - - - - - - - - - - - - + "اپنے کی بورڈ کا استعمال کر کے نیویگیٹ کریں" + "کی بورڈ شارٹ کٹس جانیں" + "اپنے ٹچ پیڈ کا استعمال کر کے نیویگیٹ کریں" + "ٹچ پیڈ کے اشارے کو جانیں" + "اپنے کی بورڈ اور ٹچ پیڈ کا استعمال کر کے نیویگیٹ کریں" + "ٹچ پیڈ کے اشارے، کی بورڈ شارٹ کٹس اور مزید جانیں" "پیچھے جانے کا اشارہ" "ہوم کا اشارہ" "ایکشن کلید" @@ -1444,4 +1437,18 @@ "آپ اپنی اسکرین کے اوپری حصے سے چمکیلے پن لیول کو مزید کم کر کے اپنی اسکرین کو اضافی دھندلی بنا سکتے ہیں۔\n\nجب آپ تاریک ماحول میں ہوتے ہیں تو یہ بہتر کام کرتا ہے۔" "اضافی دھندلا شارٹ کٹ کو ہٹائیں" "اضافی دھندلا شارٹ کٹ کو ہٹا دیا گیا۔ اپنا چمکیلا پن کم کرنے کیلئے، ریگولر چمک بار کا استعمال کریں" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-uz/strings.xml b/packages/SystemUI/res/values-uz/strings.xml index f0988edc2efd..af35adf0f390 100644 --- a/packages/SystemUI/res/values-uz/strings.xml +++ b/packages/SystemUI/res/values-uz/strings.xml @@ -105,6 +105,8 @@ "Qaydga qoʻshish" "Havolani kiritish" "%1$s, (%2$d)⁠" + + "Ekranni yozib olish" "Ekran yozib olinmoqda" "Ekrandan yozib olish seansi uchun joriy bildirishnoma" @@ -292,8 +294,7 @@ "Ekran lavhasi" "Ethernet" "Bezovta qilinmasin" - - + "Rejimlar" "Bluetooth" "Ulangan qurilmalar topilmadi" "Qurilma ulash yoki uzish uchun tegining" @@ -434,8 +435,7 @@ "Sozlamalarni ochish" "Boshqa qurilma" "Umumiy nazar rejimini almashtirish" - - + "Rejimlar" "Tayyor" "Sozlamalar" "Yoniq" @@ -1393,18 +1393,12 @@ "Yigʻish belgisi" "Yoyish belgisi" "yoki" - - - - - - - - - - - - + "Klaviatura yordamida kezing" + "Tezkor tugmalar haqida" + "Sensorli panel yordamida kezing" + "Sensorli panel ishoralari haqida" + "Klaviatura va sensorli panel yordamida kezing" + "Sensorli panel ishoralari, tezkor tugmalar va boshqalar haqida" "Orqaga qaytish ishorasi" "Asosiy ekran ishorasi" "Amal tugmasi" @@ -1444,4 +1438,18 @@ "Endi yorqinlik darajasini ekranning yuqori qismidan yanada pasaytirish orqali ekranni yanada xiralashtirishingiz mumkin.\n\nBu qorongʻi muhitda eng yaxshi ishlaydi." "Juda xira yorligʻini olib tashlash" "Juda xira yorligʻi olib tashlandi. Yorqinlikni pasaytirish uchun oddiy yorqinlik panelidan foydalaning." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-vi/strings.xml b/packages/SystemUI/res/values-vi/strings.xml index 6ad5db47eafa..b7cd6b0d899f 100644 --- a/packages/SystemUI/res/values-vi/strings.xml +++ b/packages/SystemUI/res/values-vi/strings.xml @@ -105,6 +105,8 @@ "Thêm vào ghi chú" "Thêm đường liên kết" "%1$s (%2$d)" + + "Trình ghi màn hình" "Đang xử lý video ghi màn hình" "Thông báo đang diễn ra về phiên ghi màn hình" @@ -292,8 +294,7 @@ "Trình bảo vệ m.hình" "Ethernet" "Không làm phiền" - - + "Chế độ" "Bluetooth" "Không có thiết bị nào được ghép nối" "Nhấn để kết nối/ngắt kết nối với một thiết bị" @@ -434,8 +435,7 @@ "Mở phần Cài đặt" "Thiết bị khác" "Bật/tắt chế độ xem Tổng quan" - - + "Chế độ" "Xong" "Cài đặt" "Đang bật" @@ -1393,18 +1393,12 @@ "Biểu tượng Thu gọn" "Biểu tượng Mở rộng" "hoặc" - - - - - - - - - - - - + "Di chuyển bằng bàn phím" + "Tìm hiểu về phím tắt" + "Di chuyển bằng bàn di chuột" + "Tìm hiểu về cử chỉ trên bàn di chuột" + "Di chuyển bằng bàn phím và bàn di chuột" + "Tìm hiểu về cử chỉ trên bàn di chuột, phím tắt và nhiều mục khác" "Cử chỉ quay lại" "Cử chỉ chuyển đến màn hình chính" "Phím hành động" @@ -1444,4 +1438,18 @@ "Giờ đây, bạn có thể đặt màn hình ở chế độ siêu tối bằng cách giảm thêm độ sáng từ đầu màn hình.\n\nChế độ này hoạt động hiệu quả nhất khi bạn ở trong một môi trường tối." "Xoá lối tắt của chế độ siêu tối" "Đã xoá lối tắt của chế độ siêu tối. Để giảm độ sáng, hãy dùng thanh độ sáng như thông thường." + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml index 35f8851d9049..a329965d5714 100644 --- a/packages/SystemUI/res/values-zh-rCN/strings.xml +++ b/packages/SystemUI/res/values-zh-rCN/strings.xml @@ -105,6 +105,8 @@ "添加到备注中" "包括链接" "%1$s (%2$d)⁠" + + "屏幕录制器" "正在处理屏幕录制视频" "持续显示屏幕录制会话通知" @@ -292,8 +294,7 @@ "屏保" "有线网络" "勿扰" - - + "模式" "蓝牙" "没有可用的配对设备" "点按即可连接设备或断开设备连接" @@ -434,8 +435,7 @@ "打开“设置”" "其他设备" "切换概览" - - + "模式" "完成" "设置" "已开启" @@ -1393,18 +1393,12 @@ "收起图标" "展开图标" "或" - - - - - - - - - - - - + "使用键盘导航" + "了解键盘快捷键" + "使用触控板导航" + "了解触控板手势" + "使用键盘和触控板进行导航" + "了解触控板手势、键盘快捷键等" "返回手势" "主屏幕手势" "快捷操作按键" @@ -1444,4 +1438,18 @@ "现在,您可从屏幕顶部进一步调低亮度,将屏幕调成极暗。\n\n此功能在昏暗环境中效果最佳。" "移除“极暗”快捷方式" "已移除“极暗”快捷方式。如要调低亮度,请使用常规亮度条。" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-zh-rHK/strings.xml b/packages/SystemUI/res/values-zh-rHK/strings.xml index 359b3ccb44b2..73bfbe6c2be2 100644 --- a/packages/SystemUI/res/values-zh-rHK/strings.xml +++ b/packages/SystemUI/res/values-zh-rHK/strings.xml @@ -105,6 +105,8 @@ "新增至筆記" "加入連結" "%1$s (%2$d)" + + "螢幕錄影機" "正在處理螢幕錄影內容" "持續顯示錄影畫面工作階段通知" @@ -292,8 +294,7 @@ "螢幕保護程式" "以太網" "請勿騷擾" - - + "模式" "藍牙" "找不到配對的裝置" "輕按即可連結或解除連結裝置" @@ -434,8 +435,7 @@ "開啟「設定」" "其他裝置" "切換概覽" - - + "模式" "完成" "設定" "開啟" @@ -1393,18 +1393,12 @@ "收合圖示" "展開圖示" "或" - - - - - - - - - - - - + "使用鍵盤導覽" + "瞭解鍵盤快速鍵" + "使用觸控板導覽" + "瞭解觸控板手勢" + "使用鍵盤和觸控板導覽" + "瞭解觸控板手勢、鍵盤快速鍵等等" "返去手勢" "主畫面手勢" "快捷操作鍵" @@ -1444,4 +1438,18 @@ "而家喺螢幕頂部進一步校低亮度,就可以令螢幕變得超暗\n\n呢個功能喺陰暗環境之下嘅效果最好" "移除超暗功能快速鍵" "超暗功能快速鍵已移除。如要降低亮度,請使用一般的亮度列。" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-zh-rTW/strings.xml b/packages/SystemUI/res/values-zh-rTW/strings.xml index 63b19d6be73d..46847fcf6599 100644 --- a/packages/SystemUI/res/values-zh-rTW/strings.xml +++ b/packages/SystemUI/res/values-zh-rTW/strings.xml @@ -105,6 +105,8 @@ "新增至記事本" "包含連結" "%1$s (%2$d)" + + "螢幕錄影器" "處理螢幕錄影內容" "持續顯示螢幕畫面錄製工作階段通知" @@ -292,8 +294,7 @@ "螢幕保護程式" "乙太網路" "零打擾" - - + "模式" "藍牙" "找不到配對的裝置" "輕觸即可連結/取消連結裝置" @@ -434,8 +435,7 @@ "開啟「設定」" "其他裝置" "切換總覽" - - + "模式" "完成" "設定" "開啟" @@ -1393,18 +1393,12 @@ "收合圖示" "展開圖示" "或" - - - - - - - - - - - - + "使用鍵盤操作" + "學習鍵盤快速鍵" + "使用觸控板操作" + "學習觸控板手勢" + "使用鍵盤和觸控板操作" + "學習觸控板手勢、鍵盤快速鍵等" "返回手勢" "主畫面手勢" "快捷操作鍵" @@ -1444,4 +1438,18 @@ "現在只要在螢幕頂端將亮度設定調得更低,就能讓螢幕變得更暗。\n\n這項設定最適合在昏暗環境下使用。" "移除「超暗」捷徑" "「超暗」捷徑已移除。如要調低亮度,請使用一般的亮度列。" + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/values-zu/strings.xml b/packages/SystemUI/res/values-zu/strings.xml index 048cb0190221..dbfb926b867c 100644 --- a/packages/SystemUI/res/values-zu/strings.xml +++ b/packages/SystemUI/res/values-zu/strings.xml @@ -105,6 +105,8 @@ "Engeza kunothi" "Faka ilinki" "%1$s (%2$d)" + + "Okokuqopha iskrini" "Icubungula okokuqopha iskrini" "Isaziso esiqhubekayo seseshini yokurekhoda isikrini" @@ -292,8 +294,7 @@ "Isigciniskrini" "I-Ethernet" "Ungaphazamisi" - - + "Amamodi" "I-Bluetooth" "Awekho amadivayisi abhanqiwe atholakalayo" "Thepha ukuze uxhumae noma ungaxhumi idivaysi" @@ -434,8 +435,7 @@ "Vula Amasethingi" "Enye idivayisi" "Guqula ukubuka konke" - - + "Amamodi" "Kwenziwe" "Amasethingi" "Vuliwe" @@ -1393,18 +1393,12 @@ "Goqa isithonjana" "Nweba isithonjana" "noma" - - - - - - - - - - - - + "Funa usebenzisa ikhibhodi yakho" + "Funda izinqamuleli zamakhibhodi" + "Funa usebenzisa iphedi yokuthinta" + "Funda ukunyakaza kwephedi lokuthinta" + "Funa usebenzisa ikhibhodi yakho nephedi yokuthinta" + "Funda ukunyakaza kwephedi yokuthinta, izinqamuleli zamakhibhodi, nokuningi" "Ukunyakazisa umzimba kwangemuva" "Ukunyakazisa umzimba kwasekhaya" "Inkinobho yokufinyelela" @@ -1444,4 +1438,18 @@ "Manje ungenza isikrini sifiphale ngokwengeziwe ngokwehlisa izinga lokukhanya nakakhulu kusukela phezulu kwesikrini sakho.\n\nLokhu kusebenza kahle kakhulu uma usendaweni emnyama." "Susa isinqamuleli esifiphele esengeziwe" "Isinqamuleli esifiphele ngokwengeziwe sikhishiwe. Ukuze wehlise ukukhanya kwakho, sebenzisa ibha yokukhanya evamile." + + + + + + + + + + + + + + -- GitLab From 699bc20b29d14d077b721bcd3637dd4ed45eddcc Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 10 Sep 2024 16:14:03 -0700 Subject: [PATCH 238/492] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I677e6ed3d74da5c22c740c871e44cb86ddf619e7 --- packages/SystemUI/res-keyguard/values-ja/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/res-keyguard/values-ja/strings.xml b/packages/SystemUI/res-keyguard/values-ja/strings.xml index 9752eca46a97..7c91dafb857d 100644 --- a/packages/SystemUI/res-keyguard/values-ja/strings.xml +++ b/packages/SystemUI/res-keyguard/values-ja/strings.xml @@ -34,7 +34,7 @@ "%s • 急速充電中" "%s • 低速充電中" "%s • バッテリーを保護するため、充電を一時停止しています" - "%s • 充電用アクセサリを確認してください" + "%s • 充電用アクセサリーを確認してください" "ネットワークがロックされました" "SIM がありません" "SIM が使用できません。" -- GitLab From 491c2dbf50de1a5bc53f9b67b1f6048b1352b40e Mon Sep 17 00:00:00 2001 From: Louis Chang Date: Mon, 9 Sep 2024 08:55:11 +0000 Subject: [PATCH 239/492] Prevents activity becomes invisible while keyguard going-away Or the activity could be RESUMED while being invisible. Bug: 365486631 Test: wm presubmit Flag: EXEMPT bugfix Change-Id: Ia4e8d6f4416ac5f3d6da4ea5feee9ded6ac426aa --- .../core/java/com/android/server/wm/ActivityRecord.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 99747e05e7f0..744b62a2ad30 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -6079,9 +6079,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } - // Check if the activity is on a sleeping display, canTurnScreenOn will also check - // keyguard visibility - if (mDisplayContent.isSleeping()) { + // Check if the activity is on a sleeping display and keyguard is not going away (to + // align with TaskFragment#shouldSleepActivities), canTurnScreenOn will also check keyguard + // visibility + if (mDisplayContent.isSleeping() && !mDisplayContent.isKeyguardGoingAway()) { return canTurnScreenOn(); } else { return mTaskSupervisor.getKeyguardController().checkKeyguardVisibility(this); -- GitLab From e07d73c37487f77c1b806aae852d37409aa5b1de Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Fri, 30 Aug 2024 00:29:12 +0000 Subject: [PATCH 240/492] Make java_sdk_library dependencies explicit modules should specify the submodule of java_sdk_library that the module actually depends on Test: CI Ignore-AOSP-First: resolving merge conflicts Flag: EXEMPT build dependency cleanup Bug: 358613520 Change-Id: I80af0b9efa88c668306f0ff1d51491a8180dc57f --- apct-tests/perftests/core/Android.bp | 2 +- apct-tests/perftests/healthconnect/Android.bp | 2 +- .../perftests/packagemanager/Android.bp | 2 +- apct-tests/perftests/permission/Android.bp | 2 +- .../perftests/settingsprovider/Android.bp | 2 +- cmds/uiautomator/library/Android.bp | 6 ++-- core/tests/BroadcastRadioTests/Android.bp | 2 +- core/tests/ConnectivityManagerTest/Android.bp | 4 +-- core/tests/GameManagerTests/Android.bp | 2 +- core/tests/InputMethodCoreTests/Android.bp | 6 ++-- .../tests/PackageInstallerSessions/Android.bp | 4 +-- core/tests/PlatformCompatFramework/Android.bp | 4 +-- core/tests/bandwidthtests/Android.bp | 6 ++-- .../BatteryStatsLoadTests/Android.bp | 2 +- core/tests/bugreports/Android.bp | 4 +-- core/tests/companiontests/Android.bp | 4 +-- core/tests/coretests/Android.bp | 22 +++++++------- core/tests/devicestatetests/Android.bp | 2 +- core/tests/featureflagtests/Android.bp | 4 +-- core/tests/hdmitests/Android.bp | 2 +- .../DownloadManagerTestApp/Android.bp | 4 +-- core/tests/mockingcoretests/Android.bp | 6 ++-- core/tests/packagemanagertests/Android.bp | 2 +- core/tests/packagemonitortests/Android.bp | 4 +-- core/tests/privacytests/Android.bp | 2 +- core/tests/screenshothelpertests/Android.bp | 6 ++-- core/tests/systemproperties/Android.bp | 8 ++--- core/tests/timetests/Android.bp | 2 +- core/tests/utillib/Android.bp | 2 +- core/tests/utiltests/Android.bp | 8 ++--- core/tests/vibrator/Android.bp | 6 ++-- keystore/tests/Android.bp | 2 +- .../Jetpack/tests/unittest/Android.bp | 6 ++-- .../Shell/multivalentTests/Android.bp | 4 +-- .../Shell/tests/flicker/Android.bp | 2 +- .../Shell/tests/unittest/Android.bp | 6 ++-- libs/dream/lowlight/tests/Android.bp | 6 ++-- libs/securebox/tests/Android.bp | 6 ++-- media/lib/tvremote/tests/Android.bp | 6 ++-- media/mca/tests/Android.bp | 4 +-- .../tests/unit/Android.bp | 6 ++-- media/tests/MediaFrameworkTest/Android.bp | 6 ++-- media/tests/MediaRouter/Android.bp | 4 +-- media/tests/TunerTest/Android.bp | 6 ++-- media/tests/projection/Android.bp | 6 ++-- nfc/Android.bp | 4 +-- nfc/tests/Android.bp | 2 +- .../CarrierDefaultApp/tests/unit/Android.bp | 4 +-- .../tests/robotests/Android.bp | 6 ++-- .../ExternalStorageProvider/tests/Android.bp | 6 ++-- packages/FusedLocation/Android.bp | 8 ++--- .../Spa/screenshot/robotests/Android.bp | 6 ++-- packages/SettingsLib/tests/integ/Android.bp | 6 ++-- packages/SettingsProvider/Android.bp | 4 +-- packages/Shell/tests/Android.bp | 6 ++-- packages/SystemUI/Android.bp | 18 +++++------ .../accessibilitymenu/tests/Android.bp | 4 +-- packages/SystemUI/tests/Android.bp | 4 +-- packages/VpnDialogs/tests/Android.bp | 4 +-- packages/WAPPushManager/tests/Android.bp | 4 +-- packages/WallpaperBackup/Android.bp | 4 +-- packages/overlays/tests/Android.bp | 4 +-- ravenwood/Android.bp | 3 +- ravenwood/mockito/Android.bp | 12 ++++---- sax/tests/saxtests/Android.bp | 4 +-- .../devicestateprovider/tests/Android.bp | 6 ++-- .../InputMethodSystemServerTests/Android.bp | 16 +++++----- .../host/test-apps/DeviceSide/Android.bp | 2 +- .../server/Android.bp | 6 ++-- services/tests/VpnTests/Android.bp | 6 ++-- services/tests/displayservicetests/Android.bp | 2 +- .../tests/mockingservicestests/Android.bp | 10 +++---- .../com/android/server/rollback/Android.bp | 6 ++-- services/tests/powerservicetests/Android.bp | 2 +- services/tests/powerstatstests/Android.bp | 2 +- services/tests/servicestests/Android.bp | 16 +++++----- services/tests/timetests/Android.bp | 2 +- services/tests/uiservicestests/Android.bp | 6 ++-- services/tests/vibrator/Android.bp | 6 ++-- .../tests/voiceinteractiontests/Android.bp | 6 ++-- services/tests/wmtests/Android.bp | 6 ++-- test-runner/Android.bp | 30 ++++++++++++++----- test-runner/tests/Android.bp | 4 +-- tests/AppLaunch/Android.bp | 7 +++-- tests/AttestationVerificationTest/Android.bp | 4 +-- tests/BrowserPowerTest/Android.bp | 4 +-- .../SmartCamera/SimpleCamera/tests/Android.bp | 2 +- tests/ChoreographerTests/Android.bp | 4 +-- .../client/Android.bp | 4 +-- tests/CoreTests/android/Android.bp | 2 +- .../CtsSurfaceControlTestsStaging/Android.bp | 4 +-- tests/DataIdleTest/Android.bp | 4 +-- tests/EnforcePermission/perf-app/Android.bp | 4 +-- tests/EnforcePermission/test-app/Android.bp | 4 +-- tests/FlickerTests/Android.bp | 2 +- tests/FrameworkPerf/Android.bp | 4 +-- tests/GamePerformance/Android.bp | 4 +-- tests/Input/Android.bp | 4 +-- tests/InputMethodStressTest/Android.bp | 2 +- tests/InputScreenshotTest/Android.bp | 4 +-- .../InputScreenshotTest/robotests/Android.bp | 6 ++-- tests/Internal/Android.bp | 2 +- tests/LocalizationTest/Android.bp | 6 ++-- tests/MemoryUsage/Android.bp | 4 +-- tests/MultiUser/Android.bp | 6 ++-- tests/NetworkSecurityConfigTest/Android.bp | 4 +-- tests/OneMedia/Android.bp | 2 +- tests/PackageWatchdog/Android.bp | 2 +- tests/ProtoInputStreamTests/Android.bp | 2 +- tests/RemoteDisplayProvider/Android.bp | 2 +- tests/ServiceCrashTest/Android.bp | 2 +- .../SharedLibraryClientTests/Android.bp | 2 +- tests/TelephonyCommonTests/Android.bp | 6 ++-- tests/TrustTests/Android.bp | 4 +-- tests/TtsTests/Android.bp | 4 +-- tests/UpdatableSystemFontTest/Android.bp | 2 +- tests/UsbManagerTests/lib/Android.bp | 2 +- .../ConcurrentMultiSessionImeTest/Android.bp | 2 +- tests/permission/Android.bp | 4 +-- tests/testables/Android.bp | 4 +-- tests/testables/tests/Android.bp | 6 ++-- tests/utils/testutils/Android.bp | 6 ++-- tests/utils/testutils/tests/Android.bp | 6 ++-- tests/vcn/Android.bp | 6 ++-- wifi/tests/Android.bp | 4 +-- 125 files changed, 312 insertions(+), 298 deletions(-) diff --git a/apct-tests/perftests/core/Android.bp b/apct-tests/perftests/core/Android.bp index 65bc8ccd12f8..1e299cdf8002 100644 --- a/apct-tests/perftests/core/Android.bp +++ b/apct-tests/perftests/core/Android.bp @@ -52,7 +52,7 @@ android_test { "guava", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], java_resources: [":GoogleFontDancingScript"], diff --git a/apct-tests/perftests/healthconnect/Android.bp b/apct-tests/perftests/healthconnect/Android.bp index c38a24ee05d2..072010e90fae 100644 --- a/apct-tests/perftests/healthconnect/Android.bp +++ b/apct-tests/perftests/healthconnect/Android.bp @@ -37,7 +37,7 @@ android_test { "collector-device-lib-platform", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, test_suites: ["device-tests"], data: [":perfetto_artifacts"], diff --git a/apct-tests/perftests/packagemanager/Android.bp b/apct-tests/perftests/packagemanager/Android.bp index 02fc12cde04b..b2626911ea1e 100644 --- a/apct-tests/perftests/packagemanager/Android.bp +++ b/apct-tests/perftests/packagemanager/Android.bp @@ -28,7 +28,7 @@ android_test { "services.core", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/apct-tests/perftests/permission/Android.bp b/apct-tests/perftests/permission/Android.bp index bc8e7696440a..f4c7fbbf6593 100644 --- a/apct-tests/perftests/permission/Android.bp +++ b/apct-tests/perftests/permission/Android.bp @@ -43,7 +43,7 @@ android_test { "cts-install-lib-java", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/apct-tests/perftests/settingsprovider/Android.bp b/apct-tests/perftests/settingsprovider/Android.bp index e4aa14cd8a77..382803900507 100644 --- a/apct-tests/perftests/settingsprovider/Android.bp +++ b/apct-tests/perftests/settingsprovider/Android.bp @@ -28,7 +28,7 @@ android_test { "services.core", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/cmds/uiautomator/library/Android.bp b/cmds/uiautomator/library/Android.bp index cd1fb9a0f047..966bf13adfe4 100644 --- a/cmds/uiautomator/library/Android.bp +++ b/cmds/uiautomator/library/Android.bp @@ -71,7 +71,7 @@ java_library_static { ":uiautomator-stubs", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", "junit", ], java_version: "1.8", @@ -84,8 +84,8 @@ java_library_static { "testrunner-src/**/*.java", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/tests/BroadcastRadioTests/Android.bp b/core/tests/BroadcastRadioTests/Android.bp index beffb9aac12b..7d4ae00c405a 100644 --- a/core/tests/BroadcastRadioTests/Android.bp +++ b/core/tests/BroadcastRadioTests/Android.bp @@ -45,7 +45,7 @@ android_test { "flag-junit", "mockito-target-extended", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], test_suites: [ "general-tests", "automotive-general-tests", diff --git a/core/tests/ConnectivityManagerTest/Android.bp b/core/tests/ConnectivityManagerTest/Android.bp index f17a28d22c17..6421899631ff 100644 --- a/core/tests/ConnectivityManagerTest/Android.bp +++ b/core/tests/ConnectivityManagerTest/Android.bp @@ -24,8 +24,8 @@ package { android_test { name: "ConnectivityManagerTest", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/tests/GameManagerTests/Android.bp b/core/tests/GameManagerTests/Android.bp index 0e3bc6562edb..9d8468549b13 100644 --- a/core/tests/GameManagerTests/Android.bp +++ b/core/tests/GameManagerTests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/InputMethodCoreTests/Android.bp b/core/tests/InputMethodCoreTests/Android.bp index ac6462589e16..2b524d58ced7 100644 --- a/core/tests/InputMethodCoreTests/Android.bp +++ b/core/tests/InputMethodCoreTests/Android.bp @@ -42,9 +42,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "ext", "framework-res", diff --git a/core/tests/PackageInstallerSessions/Android.bp b/core/tests/PackageInstallerSessions/Android.bp index b631df1fcf57..d10ecd07a44c 100644 --- a/core/tests/PackageInstallerSessions/Android.bp +++ b/core/tests/PackageInstallerSessions/Android.bp @@ -39,8 +39,8 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs", + "android.test.base.stubs", "framework", "framework-res", ], diff --git a/core/tests/PlatformCompatFramework/Android.bp b/core/tests/PlatformCompatFramework/Android.bp index 2621d280bd9d..a3fdf7b43bee 100644 --- a/core/tests/PlatformCompatFramework/Android.bp +++ b/core/tests/PlatformCompatFramework/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/tests/bandwidthtests/Android.bp b/core/tests/bandwidthtests/Android.bp index 8645b39da5a8..b7357122dff8 100644 --- a/core/tests/bandwidthtests/Android.bp +++ b/core/tests/bandwidthtests/Android.bp @@ -27,9 +27,9 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "org.apache.http.legacy", - "android.test.base", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", + "android.test.base.stubs", ], static_libs: [ "junit", diff --git a/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp b/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp index 1c0ea839ec02..926edfed16ef 100644 --- a/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp +++ b/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp @@ -16,7 +16,7 @@ android_test { "compatibility-device-util-axt", "junit", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/bugreports/Android.bp b/core/tests/bugreports/Android.bp index 15e07e535b39..c1022a54207d 100644 --- a/core/tests/bugreports/Android.bp +++ b/core/tests/bugreports/Android.bp @@ -26,8 +26,8 @@ android_test { srcs: ["src/**/*.java"], data: [":bugreport_artifacts"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.test", + "android.test.base.stubs.test", ], static_libs: [ "android.tracing.flags-aconfig-java", diff --git a/core/tests/companiontests/Android.bp b/core/tests/companiontests/Android.bp index d31b8f470108..cb0951e59d04 100644 --- a/core/tests/companiontests/Android.bp +++ b/core/tests/companiontests/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], platform_apis: true, diff --git a/core/tests/coretests/Android.bp b/core/tests/coretests/Android.bp index b0e48f1ccd93..7954c5a746b2 100644 --- a/core/tests/coretests/Android.bp +++ b/core/tests/coretests/Android.bp @@ -106,10 +106,10 @@ android_test { ], libs: [ - "android.test.runner", - "org.apache.http.legacy", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "ext", "framework-res", @@ -156,8 +156,8 @@ android_app { use_resource_processor: false, libs: [ "framework-res", - "android.test.runner", - "org.apache.http.legacy", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", ], uses_libs: [ "android.test.runner", @@ -223,9 +223,9 @@ android_library { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "framework", "framework-res", ], @@ -234,8 +234,8 @@ android_library { android_ravenwood_test { name: "FrameworksCoreTestsRavenwood", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "core-test-rules", // for libcore.dalvik.system.CloseGuardSupport diff --git a/core/tests/devicestatetests/Android.bp b/core/tests/devicestatetests/Android.bp index 60848b31eaec..a3303c6ca6d7 100644 --- a/core/tests/devicestatetests/Android.bp +++ b/core/tests/devicestatetests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "testng", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/featureflagtests/Android.bp b/core/tests/featureflagtests/Android.bp index d9f608ea34c4..c08066720477 100644 --- a/core/tests/featureflagtests/Android.bp +++ b/core/tests/featureflagtests/Android.bp @@ -19,8 +19,8 @@ android_test { "androidx.test.rules", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, certificate: "platform", diff --git a/core/tests/hdmitests/Android.bp b/core/tests/hdmitests/Android.bp index 5f6eaf96a846..88f24d70c722 100644 --- a/core/tests/hdmitests/Android.bp +++ b/core/tests/hdmitests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp b/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp index d439124c72cb..c9fdec0e61fd 100644 --- a/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp +++ b/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp @@ -27,8 +27,8 @@ android_test { "junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, diff --git a/core/tests/mockingcoretests/Android.bp b/core/tests/mockingcoretests/Android.bp index aca52a870655..8301a7f5c80a 100644 --- a/core/tests/mockingcoretests/Android.bp +++ b/core/tests/mockingcoretests/Android.bp @@ -44,9 +44,9 @@ android_test { ], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + "android.test.runner.stubs.system", ], // These are not normally accessible from apps so they must be explicitly included. diff --git a/core/tests/packagemanagertests/Android.bp b/core/tests/packagemanagertests/Android.bp index 5ce71c902c7c..8ff499826866 100644 --- a/core/tests/packagemanagertests/Android.bp +++ b/core/tests/packagemanagertests/Android.bp @@ -17,7 +17,7 @@ android_test { "frameworks-base-testutils", "mockito-target-minus-junit4", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/packagemonitortests/Android.bp b/core/tests/packagemonitortests/Android.bp index b08850e90d28..c3b084e4368e 100644 --- a/core/tests/packagemonitortests/Android.bp +++ b/core/tests/packagemonitortests/Android.bp @@ -34,7 +34,7 @@ android_test { "mockito-target-minus-junit4", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], @@ -52,7 +52,7 @@ android_test { "compatibility-device-util-axt", "frameworks-base-testutils", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/privacytests/Android.bp b/core/tests/privacytests/Android.bp index 4e24cd5d91cb..ac9cede84483 100644 --- a/core/tests/privacytests/Android.bp +++ b/core/tests/privacytests/Android.bp @@ -16,7 +16,7 @@ android_test { "androidx.test.rules", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/screenshothelpertests/Android.bp b/core/tests/screenshothelpertests/Android.bp index 3c71e6e4247b..49c3ee94bfd0 100644 --- a/core/tests/screenshothelpertests/Android.bp +++ b/core/tests/screenshothelpertests/Android.bp @@ -25,9 +25,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], platform_apis: true, diff --git a/core/tests/systemproperties/Android.bp b/core/tests/systemproperties/Android.bp index ed52cccfb9b9..ed99a1f5cc4a 100644 --- a/core/tests/systemproperties/Android.bp +++ b/core/tests/systemproperties/Android.bp @@ -20,8 +20,8 @@ android_test { "ravenwood-junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, certificate: "platform", @@ -37,8 +37,8 @@ android_ravenwood_test { "ravenwood-junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], srcs: [ "src/**/*.java", diff --git a/core/tests/timetests/Android.bp b/core/tests/timetests/Android.bp index 51181a8a7b13..89dade7f8fa0 100644 --- a/core/tests/timetests/Android.bp +++ b/core/tests/timetests/Android.bp @@ -19,7 +19,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], certificate: "platform", test_suites: ["device-tests"], } diff --git a/core/tests/utillib/Android.bp b/core/tests/utillib/Android.bp index 1d5c16c7a536..b6f046bd12d5 100644 --- a/core/tests/utillib/Android.bp +++ b/core/tests/utillib/Android.bp @@ -28,5 +28,5 @@ java_library { srcs: ["**/*.java"], static_libs: ["junit"], - libs: ["android.test.base"], + libs: ["android.test.base.stubs"], } diff --git a/core/tests/utiltests/Android.bp b/core/tests/utiltests/Android.bp index f5563a710563..cdc8a9e06d0b 100644 --- a/core/tests/utiltests/Android.bp +++ b/core/tests/utiltests/Android.bp @@ -39,9 +39,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], platform_apis: true, @@ -55,7 +55,7 @@ android_test { android_ravenwood_test { name: "FrameworksUtilTestsRavenwood", libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.annotation_annotation", diff --git a/core/tests/vibrator/Android.bp b/core/tests/vibrator/Android.bp index 920ab5914548..848e079a2270 100644 --- a/core/tests/vibrator/Android.bp +++ b/core/tests/vibrator/Android.bp @@ -25,9 +25,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "framework-res", ], diff --git a/keystore/tests/Android.bp b/keystore/tests/Android.bp index 7de45233494b..0dcf597644ee 100644 --- a/keystore/tests/Android.bp +++ b/keystore/tests/Android.bp @@ -31,6 +31,6 @@ android_test { "mockito-target-minus-junit4", ], platform_apis: true, - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], certificate: "platform", } diff --git a/libs/WindowManager/Jetpack/tests/unittest/Android.bp b/libs/WindowManager/Jetpack/tests/unittest/Android.bp index 139ddda5af3c..bc46b70793cd 100644 --- a/libs/WindowManager/Jetpack/tests/unittest/Android.bp +++ b/libs/WindowManager/Jetpack/tests/unittest/Android.bp @@ -47,9 +47,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], // These are not normally accessible from apps so they must be explicitly included. diff --git a/libs/WindowManager/Shell/multivalentTests/Android.bp b/libs/WindowManager/Shell/multivalentTests/Android.bp index 1ad19c9f3033..ee0d5bbed324 100644 --- a/libs/WindowManager/Shell/multivalentTests/Android.bp +++ b/libs/WindowManager/Shell/multivalentTests/Android.bp @@ -77,8 +77,8 @@ android_test { "platform-test-rules", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/libs/WindowManager/Shell/tests/flicker/Android.bp b/libs/WindowManager/Shell/tests/flicker/Android.bp index 4abaf5bd4a38..4058fa977f1d 100644 --- a/libs/WindowManager/Shell/tests/flicker/Android.bp +++ b/libs/WindowManager/Shell/tests/flicker/Android.bp @@ -59,7 +59,7 @@ java_defaults { enabled: false, }, test_suites: ["device-tests"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], static_libs: [ "wm-shell-flicker-utils", "androidx.test.ext.junit", diff --git a/libs/WindowManager/Shell/tests/unittest/Android.bp b/libs/WindowManager/Shell/tests/unittest/Android.bp index 4d761e18b990..9cbdcdb12d0a 100644 --- a/libs/WindowManager/Shell/tests/unittest/Android.bp +++ b/libs/WindowManager/Shell/tests/unittest/Android.bp @@ -66,9 +66,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ diff --git a/libs/dream/lowlight/tests/Android.bp b/libs/dream/lowlight/tests/Android.bp index 42547832133b..d3e101681ef2 100644 --- a/libs/dream/lowlight/tests/Android.bp +++ b/libs/dream/lowlight/tests/Android.bp @@ -37,9 +37,9 @@ android_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/libs/securebox/tests/Android.bp b/libs/securebox/tests/Android.bp index 80b501da1aa5..8429cf4116c5 100644 --- a/libs/securebox/tests/Android.bp +++ b/libs/securebox/tests/Android.bp @@ -35,9 +35,9 @@ android_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/media/lib/tvremote/tests/Android.bp b/media/lib/tvremote/tests/Android.bp index 280c515e9a9e..83061cf14b0f 100644 --- a/media/lib/tvremote/tests/Android.bp +++ b/media/lib/tvremote/tests/Android.bp @@ -11,9 +11,9 @@ android_test { name: "TvRemoteTests", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", - "com.android.media.tv.remoteprovider", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "com.android.media.tv.remoteprovider.impl", ], static_libs: [ "mockito-target-minus-junit4", diff --git a/media/mca/tests/Android.bp b/media/mca/tests/Android.bp index 04f083dee093..463e131f1dfd 100644 --- a/media/mca/tests/Android.bp +++ b/media/mca/tests/Android.bp @@ -10,8 +10,8 @@ package { android_test { name: "CameraEffectsTests", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/media/packages/BluetoothMidiService/tests/unit/Android.bp b/media/packages/BluetoothMidiService/tests/unit/Android.bp index 67c7e4230f30..54d6dfc658ed 100644 --- a/media/packages/BluetoothMidiService/tests/unit/Android.bp +++ b/media/packages/BluetoothMidiService/tests/unit/Android.bp @@ -39,8 +39,8 @@ android_test { test_suites: ["device-tests"], libs: [ "framework-res", - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], } diff --git a/media/tests/MediaFrameworkTest/Android.bp b/media/tests/MediaFrameworkTest/Android.bp index 028c97ec51f7..571e24f16c78 100644 --- a/media/tests/MediaFrameworkTest/Android.bp +++ b/media/tests/MediaFrameworkTest/Android.bp @@ -11,9 +11,9 @@ android_test { name: "mediaframeworktest", srcs: ["**/*.java"], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], static_libs: [ "mockito-target-inline-minus-junit4", diff --git a/media/tests/MediaRouter/Android.bp b/media/tests/MediaRouter/Android.bp index d21cb9319885..e4f88a65ed1a 100644 --- a/media/tests/MediaRouter/Android.bp +++ b/media/tests/MediaRouter/Android.bp @@ -14,8 +14,8 @@ android_test { srcs: ["**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ diff --git a/media/tests/TunerTest/Android.bp b/media/tests/TunerTest/Android.bp index 8e8816cee876..634438e72b59 100644 --- a/media/tests/TunerTest/Android.bp +++ b/media/tests/TunerTest/Android.bp @@ -13,14 +13,14 @@ android_test { srcs: ["**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.rules", "compatibility-device-util-axt", - "testng" + "testng", ], platform_apis: true, diff --git a/media/tests/projection/Android.bp b/media/tests/projection/Android.bp index fd5f19535537..94db2c02eb28 100644 --- a/media/tests/projection/Android.bp +++ b/media/tests/projection/Android.bp @@ -18,9 +18,9 @@ android_test { srcs: ["**/*.java"], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ diff --git a/nfc/Android.bp b/nfc/Android.bp index 0282e6f5c246..db3dcb0631dd 100644 --- a/nfc/Android.bp +++ b/nfc/Android.bp @@ -38,8 +38,8 @@ java_sdk_library { name: "framework-nfc", libs: [ "unsupportedappusage", // for android.compat.annotation.UnsupportedAppUsage - "framework-permission-s", - "framework-permission", + "framework-permission-s.stubs.module_lib", + "framework-permission.stubs.module_lib", ], static_libs: [ "android.nfc.flags-aconfig-java", diff --git a/nfc/tests/Android.bp b/nfc/tests/Android.bp index 6ebc03cc6ffc..bfa814d149f0 100644 --- a/nfc/tests/Android.bp +++ b/nfc/tests/Android.bp @@ -32,7 +32,7 @@ android_test { ], libs: [ "framework-nfc.impl", - "android.test.runner", + "android.test.runner.stubs.system", ], srcs: ["src/**/*.java"], platform_apis: true, diff --git a/packages/CarrierDefaultApp/tests/unit/Android.bp b/packages/CarrierDefaultApp/tests/unit/Android.bp index 0d08ec6ca2b3..bec81ad5f92e 100644 --- a/packages/CarrierDefaultApp/tests/unit/Android.bp +++ b/packages/CarrierDefaultApp/tests/unit/Android.bp @@ -25,8 +25,8 @@ android_test { name: "CarrierDefaultAppUnitTests", certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", "SlicePurchaseController", ], static_libs: [ diff --git a/packages/CredentialManager/tests/robotests/Android.bp b/packages/CredentialManager/tests/robotests/Android.bp index 75a0dcce0b9e..27afaaa49fdd 100644 --- a/packages/CredentialManager/tests/robotests/Android.bp +++ b/packages/CredentialManager/tests/robotests/Android.bp @@ -48,9 +48,9 @@ android_robolectric_test { "flag-junit-base", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "truth", ], upstream: true, diff --git a/packages/ExternalStorageProvider/tests/Android.bp b/packages/ExternalStorageProvider/tests/Android.bp index 097bb8603877..56348b77e679 100644 --- a/packages/ExternalStorageProvider/tests/Android.bp +++ b/packages/ExternalStorageProvider/tests/Android.bp @@ -21,9 +21,9 @@ android_test { ], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ diff --git a/packages/FusedLocation/Android.bp b/packages/FusedLocation/Android.bp index 61a82701d155..719aa28a4e30 100644 --- a/packages/FusedLocation/Android.bp +++ b/packages/FusedLocation/Android.bp @@ -35,7 +35,7 @@ android_app { name: "FusedLocation", defaults: ["platform_app_defaults"], srcs: ["src/**/*.java"], - libs: ["com.android.location.provider"], + libs: ["com.android.location.provider.impl"], platform_apis: true, certificate: "platform", privileged: true, @@ -50,9 +50,9 @@ android_test { "src/**/*.java", // include real sources because we're forced to test this directly ], libs: [ - "android.test.base", - "android.test.runner", - "com.android.location.provider", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", + "com.android.location.provider.impl", ], static_libs: [ "androidx.test.core", diff --git a/packages/SettingsLib/Spa/screenshot/robotests/Android.bp b/packages/SettingsLib/Spa/screenshot/robotests/Android.bp index c834c80ad536..f6477e2f052a 100644 --- a/packages/SettingsLib/Spa/screenshot/robotests/Android.bp +++ b/packages/SettingsLib/Spa/screenshot/robotests/Android.bp @@ -63,9 +63,9 @@ android_robolectric_test { "uiautomator-helpers", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "truth", ], upstream: true, diff --git a/packages/SettingsLib/tests/integ/Android.bp b/packages/SettingsLib/tests/integ/Android.bp index 33d23a3ea16a..15fe8ed6d3ba 100644 --- a/packages/SettingsLib/tests/integ/Android.bp +++ b/packages/SettingsLib/tests/integ/Android.bp @@ -37,10 +37,10 @@ android_test { ], libs: [ - "android.test.runner", + "android.test.runner.stubs", "telephony-common", - "android.test.base", - "android.test.mock", + "android.test.base.stubs", + "android.test.mock.stubs", "truth", ], diff --git a/packages/SettingsProvider/Android.bp b/packages/SettingsProvider/Android.bp index 3e62b7b2cf6e..c107ff5a34ce 100644 --- a/packages/SettingsProvider/Android.bp +++ b/packages/SettingsProvider/Android.bp @@ -76,8 +76,8 @@ android_test { "Harrier", ], libs: [ - "android.test.base", - "android.test.mock", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "unsupportedappusage", ], resource_dirs: [], diff --git a/packages/Shell/tests/Android.bp b/packages/Shell/tests/Android.bp index 0dc331478997..6399ffdfdf2f 100644 --- a/packages/Shell/tests/Android.bp +++ b/packages/Shell/tests/Android.bp @@ -11,9 +11,9 @@ android_test { name: "ShellTests", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.test.rules", diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index d26a9066e075..f0e586388927 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -804,9 +804,9 @@ android_library { "androidx.test.rules", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "keepanno-annotations", ], kotlincflags: [ @@ -896,9 +896,9 @@ android_robolectric_test { "androidx.compose.runtime_runtime", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "truth", ], @@ -971,9 +971,9 @@ android_ravenwood_test { "androidx.compose.runtime_runtime", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], auto_gen_config: true, plugins: [ diff --git a/packages/SystemUI/accessibility/accessibilitymenu/tests/Android.bp b/packages/SystemUI/accessibility/accessibilitymenu/tests/Android.bp index 9d5a2e0dba4b..a48476744eeb 100644 --- a/packages/SystemUI/accessibility/accessibilitymenu/tests/Android.bp +++ b/packages/SystemUI/accessibility/accessibilitymenu/tests/Android.bp @@ -24,8 +24,8 @@ android_test { use_resource_processor: true, certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/packages/SystemUI/tests/Android.bp b/packages/SystemUI/tests/Android.bp index 88939a2ba67d..957ed875e0e7 100644 --- a/packages/SystemUI/tests/Android.bp +++ b/packages/SystemUI/tests/Android.bp @@ -35,9 +35,9 @@ android_test { "libstaticjvmtiagent", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", "telephony-common", - "android.test.base", + "android.test.base.stubs.system", ], aaptflags: [ "--extra-packages com.android.systemui", diff --git a/packages/VpnDialogs/tests/Android.bp b/packages/VpnDialogs/tests/Android.bp index 68639bd1c4fe..409282efb714 100644 --- a/packages/VpnDialogs/tests/Android.bp +++ b/packages/VpnDialogs/tests/Android.bp @@ -22,8 +22,8 @@ android_test { // (e.g. VpnManager#prepareVpn()). certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/packages/WAPPushManager/tests/Android.bp b/packages/WAPPushManager/tests/Android.bp index 0a179383fab6..973100248a2b 100644 --- a/packages/WAPPushManager/tests/Android.bp +++ b/packages/WAPPushManager/tests/Android.bp @@ -26,9 +26,9 @@ package { android_test { name: "WAPPushManagerTests", libs: [ - "android.test.runner", + "android.test.runner.stubs.system", "telephony-common", - "android.test.base", + "android.test.base.stubs.system", ], static_libs: ["junit"], // Include all test java files. diff --git a/packages/WallpaperBackup/Android.bp b/packages/WallpaperBackup/Android.bp index 18f783146c72..b8e0d427f3d8 100644 --- a/packages/WallpaperBackup/Android.bp +++ b/packages/WallpaperBackup/Android.bp @@ -42,8 +42,8 @@ android_test { "test/src/**/*.java", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/packages/overlays/tests/Android.bp b/packages/overlays/tests/Android.bp index 0244c0fe0533..8bbe60059d45 100644 --- a/packages/overlays/tests/Android.bp +++ b/packages/overlays/tests/Android.bp @@ -26,8 +26,8 @@ android_test { certificate: "platform", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, static_libs: [ diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp index 9b0c8e554d64..d6b25fc0ea07 100644 --- a/ravenwood/Android.bp +++ b/ravenwood/Android.bp @@ -155,14 +155,13 @@ java_library { "ravenwood-runtime-common", ], libs: [ - "android.test.mock", + "android.test.mock.impl", "framework-minus-apex.ravenwood", "ravenwood-framework", "services.core.ravenwood", "junit", "framework-annotations-lib", ], - sdk_version: "core_current", visibility: ["//frameworks/base"], jarjar_rules: ":ravenwood-services-jarjar-rules", } diff --git a/ravenwood/mockito/Android.bp b/ravenwood/mockito/Android.bp index 95c7394b19f3..d91537bbc334 100644 --- a/ravenwood/mockito/Android.bp +++ b/ravenwood/mockito/Android.bp @@ -21,9 +21,9 @@ android_ravenwood_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], auto_gen_config: true, } @@ -48,9 +48,9 @@ android_test { "mockito-target-extended-minus-junit4", ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ // Required by mockito diff --git a/sax/tests/saxtests/Android.bp b/sax/tests/saxtests/Android.bp index 446ee9394179..29c742f47868 100644 --- a/sax/tests/saxtests/Android.bp +++ b/sax/tests/saxtests/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/services/foldables/devicestateprovider/tests/Android.bp b/services/foldables/devicestateprovider/tests/Android.bp index 84a6df38e0a0..4352c15879e1 100644 --- a/services/foldables/devicestateprovider/tests/Android.bp +++ b/services/foldables/devicestateprovider/tests/Android.bp @@ -6,9 +6,9 @@ android_test { name: "foldable-device-state-provider-tests", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/services/tests/InputMethodSystemServerTests/Android.bp b/services/tests/InputMethodSystemServerTests/Android.bp index 3bce9b54e320..a78972dae163 100644 --- a/services/tests/InputMethodSystemServerTests/Android.bp +++ b/services/tests/InputMethodSystemServerTests/Android.bp @@ -50,9 +50,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], data: [ @@ -79,8 +79,8 @@ android_ravenwood_test { "services", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], srcs: [ "src/com/android/server/inputmethod/**/ClientControllerTest.java", @@ -121,9 +121,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], data: [ diff --git a/services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp b/services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp index 73cec6c13d6d..71ada2e973ce 100644 --- a/services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp +++ b/services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp @@ -29,7 +29,7 @@ android_test_helper_app { sdk_version: "test_current", srcs: ["src/**/*.kt"], libs: [ - "android.test.base", + "android.test.base.stubs.test", ], static_libs: [ "androidx.annotation_annotation", diff --git a/services/tests/PackageManagerServiceTests/server/Android.bp b/services/tests/PackageManagerServiceTests/server/Android.bp index 598e27372075..b8f1e8304c2f 100644 --- a/services/tests/PackageManagerServiceTests/server/Android.bp +++ b/services/tests/PackageManagerServiceTests/server/Android.bp @@ -65,9 +65,9 @@ android_test { "android.hardware.tv.cec-V1.0-java", "android.hardware.vibrator-V3-java", "android.hidl.manager-V1.0-java", - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], platform_apis: true, diff --git a/services/tests/VpnTests/Android.bp b/services/tests/VpnTests/Android.bp index a5011a8d8b00..ee20f1a105a4 100644 --- a/services/tests/VpnTests/Android.bp +++ b/services/tests/VpnTests/Android.bp @@ -38,8 +38,8 @@ android_test { "framework-connectivity-t.impl", "framework", "framework-res", - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", ], } diff --git a/services/tests/displayservicetests/Android.bp b/services/tests/displayservicetests/Android.bp index 3bafe7296fff..f9441b284e7a 100644 --- a/services/tests/displayservicetests/Android.bp +++ b/services/tests/displayservicetests/Android.bp @@ -16,7 +16,7 @@ android_test { ], libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ diff --git a/services/tests/mockingservicestests/Android.bp b/services/tests/mockingservicestests/Android.bp index 9808d54202e5..3c714a45d9b2 100644 --- a/services/tests/mockingservicestests/Android.bp +++ b/services/tests/mockingservicestests/Android.bp @@ -80,9 +80,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", "servicestests-core-utils", ], @@ -118,14 +118,14 @@ java_library { "mockito-target-extended-minus-junit4", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", ], } android_ravenwood_test { name: "FrameworksMockingServicesTestsRavenwood", libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.annotation_annotation", diff --git a/services/tests/mockingservicestests/src/com/android/server/rollback/Android.bp b/services/tests/mockingservicestests/src/com/android/server/rollback/Android.bp index e94b8ad0a9ac..0ae304cb6b02 100644 --- a/services/tests/mockingservicestests/src/com/android/server/rollback/Android.bp +++ b/services/tests/mockingservicestests/src/com/android/server/rollback/Android.bp @@ -37,9 +37,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ diff --git a/services/tests/powerservicetests/Android.bp b/services/tests/powerservicetests/Android.bp index 729dcbd11f42..2beb15371558 100644 --- a/services/tests/powerservicetests/Android.bp +++ b/services/tests/powerservicetests/Android.bp @@ -23,7 +23,7 @@ android_test { ], libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], defaults: [ diff --git a/services/tests/powerstatstests/Android.bp b/services/tests/powerstatstests/Android.bp index b2a5b02c49e1..129d6838c52a 100644 --- a/services/tests/powerstatstests/Android.bp +++ b/services/tests/powerstatstests/Android.bp @@ -30,7 +30,7 @@ android_test { ], libs: [ - "android.test.base", + "android.test.base.stubs.system", ], resource_dirs: ["res/"], diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp index 09f81f736b36..b58870bc95fb 100644 --- a/services/tests/servicestests/Android.bp +++ b/services/tests/servicestests/Android.bp @@ -96,9 +96,9 @@ android_test { "android.hardware.tv.cec-V1.0-java", "android.hardware.vibrator-V3-java", "android.hidl.manager-V1.0-java", - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], platform_apis: true, @@ -152,7 +152,7 @@ android_test { android_ravenwood_test { name: "FrameworksServicesTestsRavenwood", libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.annotation_annotation", @@ -192,8 +192,8 @@ java_library { "src/com/android/server/devicepolicy/MockUtils.java", ], libs: [ - "android.test.mock", - "android.test.base", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", "mockito-target-minus-junit4", ], static_libs: [ @@ -218,7 +218,7 @@ java_library { "mockito-target-minus-junit4", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", ], } @@ -244,7 +244,7 @@ java_library { "mockito-target-extended-minus-junit4", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", ], } diff --git a/services/tests/timetests/Android.bp b/services/tests/timetests/Android.bp index 23ab85996fff..7a4b9749b0e2 100644 --- a/services/tests/timetests/Android.bp +++ b/services/tests/timetests/Android.bp @@ -20,7 +20,7 @@ android_test { "services.core", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/services/tests/uiservicestests/Android.bp b/services/tests/uiservicestests/Android.bp index e6cf0c38a10c..850d2f7f36a5 100644 --- a/services/tests/uiservicestests/Android.bp +++ b/services/tests/uiservicestests/Android.bp @@ -54,9 +54,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], dxflags: ["--multi-dex"], diff --git a/services/tests/vibrator/Android.bp b/services/tests/vibrator/Android.bp index 2549ff5360ec..ed18c8b04c0f 100644 --- a/services/tests/vibrator/Android.bp +++ b/services/tests/vibrator/Android.bp @@ -17,9 +17,9 @@ android_test { libs: [ "android.hardware.vibrator-V3-java", - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ diff --git a/services/tests/voiceinteractiontests/Android.bp b/services/tests/voiceinteractiontests/Android.bp index 8c70851f87df..5fbf02cfc984 100644 --- a/services/tests/voiceinteractiontests/Android.bp +++ b/services/tests/voiceinteractiontests/Android.bp @@ -49,9 +49,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], certificate: "platform", diff --git a/services/tests/wmtests/Android.bp b/services/tests/wmtests/Android.bp index 604869c7f0ca..fef5d4cc848a 100644 --- a/services/tests/wmtests/Android.bp +++ b/services/tests/wmtests/Android.bp @@ -76,9 +76,9 @@ android_test { libs: [ "android.hardware.power-V1-java", - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], defaults: [ diff --git a/test-runner/Android.bp b/test-runner/Android.bp index 6b5be3cba204..bb2c4d97c87a 100644 --- a/test-runner/Android.bp +++ b/test-runner/Android.bp @@ -32,14 +32,28 @@ java_sdk_library { javacflags: ["-Xep:DepAnn:ERROR"], }, - libs: [ - "android.test.base", - "android.test.mock", - ], - stub_only_libs: [ - "android.test.base", - "android.test.mock", + impl_only_libs: [ + "android.test.base.impl", + "android.test.mock.impl", ], + public: { + libs: [ + "android.test.base.stubs", + "android.test.mock.stubs", + ], + }, + system: { + libs: [ + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + ], + }, + test: { + libs: [ + "android.test.base.stubs.test", + "android.test.mock.stubs.test", + ], + }, api_packages: [ "android.test", "android.test.suitebuilder", @@ -64,7 +78,7 @@ java_library { sdk_version: "current", libs: [ "android.test.base_static", - "android.test.mock", + "android.test.mock.stubs", "junit", ], } diff --git a/test-runner/tests/Android.bp b/test-runner/tests/Android.bp index 0c0c0805f2d3..39f41ed7f667 100644 --- a/test-runner/tests/Android.bp +++ b/test-runner/tests/Android.bp @@ -30,8 +30,8 @@ android_test { libs: [ "android.test.runner.impl", - "android.test.base", - "android.test.mock", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], static_libs: [ "junit", diff --git a/tests/AppLaunch/Android.bp b/tests/AppLaunch/Android.bp index f838c5a80c28..90a00fe6083e 100644 --- a/tests/AppLaunch/Android.bp +++ b/tests/AppLaunch/Android.bp @@ -14,11 +14,12 @@ android_test { platform_apis: true, certificate: "platform", libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ "androidx.test.rules", - "ub-uiautomator"], + "ub-uiautomator", + ], test_suites: ["device-tests"], } diff --git a/tests/AttestationVerificationTest/Android.bp b/tests/AttestationVerificationTest/Android.bp index b98f8cb0c21d..5f0908959ed5 100644 --- a/tests/AttestationVerificationTest/Android.bp +++ b/tests/AttestationVerificationTest/Android.bp @@ -32,8 +32,8 @@ android_test { }, test_suites: ["device-tests"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "compatibility-device-util-axt", diff --git a/tests/BrowserPowerTest/Android.bp b/tests/BrowserPowerTest/Android.bp index a8a9897c0e86..100e975b4d5e 100644 --- a/tests/BrowserPowerTest/Android.bp +++ b/tests/BrowserPowerTest/Android.bp @@ -24,8 +24,8 @@ package { android_test { name: "BrowserPowerTests", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], // Include all test java files. diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp b/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp index 5edb1de9586e..4aeca5b04602 100644 --- a/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp +++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp @@ -24,7 +24,7 @@ android_test { name: "SmartCamera-tests", platform_apis: true, srcs: ["src/**/*.java"], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], static_libs: [ "guava", "junit", diff --git a/tests/ChoreographerTests/Android.bp b/tests/ChoreographerTests/Android.bp index 3f48d70d659f..69a9d180bfd3 100644 --- a/tests/ChoreographerTests/Android.bp +++ b/tests/ChoreographerTests/Android.bp @@ -26,8 +26,8 @@ android_test { name: "ChoreographerTests", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/tests/CompanionDeviceMultiDeviceTests/client/Android.bp b/tests/CompanionDeviceMultiDeviceTests/client/Android.bp index 9994826d061a..ce63fe89fe2e 100644 --- a/tests/CompanionDeviceMultiDeviceTests/client/Android.bp +++ b/tests/CompanionDeviceMultiDeviceTests/client/Android.bp @@ -40,8 +40,8 @@ android_test { "mobly-snippet-lib", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], optimize: { diff --git a/tests/CoreTests/android/Android.bp b/tests/CoreTests/android/Android.bp index 97a6e5fd4d1b..85e951e099ce 100644 --- a/tests/CoreTests/android/Android.bp +++ b/tests/CoreTests/android/Android.bp @@ -12,7 +12,7 @@ android_test { srcs: ["**/*.java"], libs: [ "android.test.runner.stubs", - "org.apache.http.legacy", + "org.apache.http.legacy.stubs", "android.test.base.stubs", ], sdk_version: "current", diff --git a/tests/CtsSurfaceControlTestsStaging/Android.bp b/tests/CtsSurfaceControlTestsStaging/Android.bp index 1038c9e93931..8d93b28b9acb 100644 --- a/tests/CtsSurfaceControlTestsStaging/Android.bp +++ b/tests/CtsSurfaceControlTestsStaging/Android.bp @@ -28,8 +28,8 @@ android_test { name: "CtsSurfaceControlTestsStaging", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/tests/DataIdleTest/Android.bp b/tests/DataIdleTest/Android.bp index f9509cc9a4bf..8839df664abf 100644 --- a/tests/DataIdleTest/Android.bp +++ b/tests/DataIdleTest/Android.bp @@ -27,8 +27,8 @@ android_test { name: "DataIdleTest", platform_apis: true, libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], srcs: ["src/**/*.java"], diff --git a/tests/EnforcePermission/perf-app/Android.bp b/tests/EnforcePermission/perf-app/Android.bp index 6d04fdc821bb..dbafd739c7bc 100644 --- a/tests/EnforcePermission/perf-app/Android.bp +++ b/tests/EnforcePermission/perf-app/Android.bp @@ -32,8 +32,8 @@ android_test { "androidx.test.rules", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], data: [ ":EnforcePermissionTestHelper", diff --git a/tests/EnforcePermission/test-app/Android.bp b/tests/EnforcePermission/test-app/Android.bp index 065ab33448e3..64f850b1e147 100644 --- a/tests/EnforcePermission/test-app/Android.bp +++ b/tests/EnforcePermission/test-app/Android.bp @@ -27,8 +27,8 @@ android_test { "androidx.test.rules", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], data: [ ":EnforcePermissionTestHelper", diff --git a/tests/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp index d658d5991a57..27e9ffa4cea5 100644 --- a/tests/FlickerTests/Android.bp +++ b/tests/FlickerTests/Android.bp @@ -31,7 +31,7 @@ java_defaults { enabled: false, }, test_suites: ["device-tests"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], static_libs: [ "androidx.test.ext.junit", "flickertestapplib", diff --git a/tests/FrameworkPerf/Android.bp b/tests/FrameworkPerf/Android.bp index 9be3ab795b86..4e39fe1c5e4a 100644 --- a/tests/FrameworkPerf/Android.bp +++ b/tests/FrameworkPerf/Android.bp @@ -12,8 +12,8 @@ android_test { srcs: ["**/*.java"], platform_apis: true, libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], aaptflags: [ diff --git a/tests/GamePerformance/Android.bp b/tests/GamePerformance/Android.bp index f250a1bbdaca..964f0b914c65 100644 --- a/tests/GamePerformance/Android.bp +++ b/tests/GamePerformance/Android.bp @@ -33,8 +33,8 @@ android_test_helper_app { srcs: ["src/**/*.java"], static_libs: ["androidx.test.rules"], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], platform_apis: true, certificate: "platform", diff --git a/tests/Input/Android.bp b/tests/Input/Android.bp index 06c2651b604d..cf42a349b3a2 100644 --- a/tests/Input/Android.bp +++ b/tests/Input/Android.bp @@ -51,8 +51,8 @@ android_test { "ui-trace-collector", ], libs: [ - "android.test.mock", - "android.test.base", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", ], test_suites: ["device-tests"], } diff --git a/tests/InputMethodStressTest/Android.bp b/tests/InputMethodStressTest/Android.bp index 5ed8d8d528c4..2697d32dd622 100644 --- a/tests/InputMethodStressTest/Android.bp +++ b/tests/InputMethodStressTest/Android.bp @@ -20,7 +20,7 @@ package { android_test { name: "InputMethodStressTest", srcs: ["src/**/*.java"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs"], static_libs: [ "androidx.test.ext.junit", "androidx.test.uiautomator_uiautomator", diff --git a/tests/InputScreenshotTest/Android.bp b/tests/InputScreenshotTest/Android.bp index 927b101012c5..12ab550c2da2 100644 --- a/tests/InputScreenshotTest/Android.bp +++ b/tests/InputScreenshotTest/Android.bp @@ -67,8 +67,8 @@ android_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", ], test_suites: ["device-tests"], compile_multilib: "both", diff --git a/tests/InputScreenshotTest/robotests/Android.bp b/tests/InputScreenshotTest/robotests/Android.bp index d63fd69ae4d9..b2414a85c095 100644 --- a/tests/InputScreenshotTest/robotests/Android.bp +++ b/tests/InputScreenshotTest/robotests/Android.bp @@ -61,9 +61,9 @@ android_robolectric_test { "uiautomator-helpers", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "truth", ], upstream: true, diff --git a/tests/Internal/Android.bp b/tests/Internal/Android.bp index ad98e47fa8f0..3e58517579b8 100644 --- a/tests/Internal/Android.bp +++ b/tests/Internal/Android.bp @@ -14,7 +14,7 @@ android_test { }, // Include some source files directly to be able to access package members srcs: ["src/**/*.java"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], static_libs: [ "junit", "androidx.test.rules", diff --git a/tests/LocalizationTest/Android.bp b/tests/LocalizationTest/Android.bp index 909ca5972552..5d9901bb4d0d 100644 --- a/tests/LocalizationTest/Android.bp +++ b/tests/LocalizationTest/Android.bp @@ -25,9 +25,9 @@ android_test { name: "LocalizationTest", srcs: ["java/**/*.kt"], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/tests/MemoryUsage/Android.bp b/tests/MemoryUsage/Android.bp index e30a0a7cd8b5..deb46636e5b2 100644 --- a/tests/MemoryUsage/Android.bp +++ b/tests/MemoryUsage/Android.bp @@ -14,8 +14,8 @@ android_test { platform_apis: true, certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], } diff --git a/tests/MultiUser/Android.bp b/tests/MultiUser/Android.bp index bde309fe3015..e4d9f02b3d02 100644 --- a/tests/MultiUser/Android.bp +++ b/tests/MultiUser/Android.bp @@ -18,9 +18,9 @@ android_test { "services.core", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], certificate: "platform", test_suites: ["device-tests"], diff --git a/tests/NetworkSecurityConfigTest/Android.bp b/tests/NetworkSecurityConfigTest/Android.bp index 473eadbcad73..4c48eaa4622e 100644 --- a/tests/NetworkSecurityConfigTest/Android.bp +++ b/tests/NetworkSecurityConfigTest/Android.bp @@ -11,8 +11,8 @@ android_test { name: "NetworkSecurityConfigTests", certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], // Include all test java files. diff --git a/tests/OneMedia/Android.bp b/tests/OneMedia/Android.bp index a43cd39f0dcb..a1817ccb662a 100644 --- a/tests/OneMedia/Android.bp +++ b/tests/OneMedia/Android.bp @@ -15,7 +15,7 @@ android_app { ], platform_apis: true, certificate: "platform", - libs: ["org.apache.http.legacy"], + libs: ["org.apache.http.legacy.stubs.system"], optional_uses_libs: ["org.apache.http.legacy"], optimize: { enabled: false, diff --git a/tests/PackageWatchdog/Android.bp b/tests/PackageWatchdog/Android.bp index 2c5fdd3228ed..096555eb3056 100644 --- a/tests/PackageWatchdog/Android.bp +++ b/tests/PackageWatchdog/Android.bp @@ -36,7 +36,7 @@ android_test { "services.net", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], jni_libs: [ // mockito-target-extended dependencies "libdexmakerjvmtiagent", diff --git a/tests/ProtoInputStreamTests/Android.bp b/tests/ProtoInputStreamTests/Android.bp index 0029080b5a89..40ab257fef37 100644 --- a/tests/ProtoInputStreamTests/Android.bp +++ b/tests/ProtoInputStreamTests/Android.bp @@ -33,7 +33,7 @@ android_test { platform_apis: true, certificate: "platform", test_suites: ["device-tests"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], static_libs: [ "androidx.test.rules", "frameworks-base-testutils", diff --git a/tests/RemoteDisplayProvider/Android.bp b/tests/RemoteDisplayProvider/Android.bp index 55732d14af46..468bdda75713 100644 --- a/tests/RemoteDisplayProvider/Android.bp +++ b/tests/RemoteDisplayProvider/Android.bp @@ -27,6 +27,6 @@ android_test { sdk_version: "system_current", srcs: ["src/**/*.java"], resource_dirs: ["res"], - libs: ["com.android.media.remotedisplay"], + libs: ["com.android.media.remotedisplay.stubs.system"], certificate: "platform", } diff --git a/tests/ServiceCrashTest/Android.bp b/tests/ServiceCrashTest/Android.bp index fb98b7631b7e..82f397ffe259 100644 --- a/tests/ServiceCrashTest/Android.bp +++ b/tests/ServiceCrashTest/Android.bp @@ -13,7 +13,7 @@ android_test { srcs: ["src/**/*.java"], platform_apis: true, certificate: "platform", - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], static_libs: [ "compatibility-device-util-axt", "androidx.test.rules", diff --git a/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp b/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp index 0d204979cb92..c0ac50c962f2 100644 --- a/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp +++ b/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp @@ -23,7 +23,7 @@ android_test_helper_app { libs: [ "SharedLibraryLoadingTests_StandardSharedLibrary", "SharedLibraryLoadingTests_SharedLibraryLoadedAfter", - "android.test.base", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.ext.junit", diff --git a/tests/TelephonyCommonTests/Android.bp b/tests/TelephonyCommonTests/Android.bp index b968e5d81148..b1af6aed27a0 100644 --- a/tests/TelephonyCommonTests/Android.bp +++ b/tests/TelephonyCommonTests/Android.bp @@ -50,9 +50,9 @@ android_test { platform_apis: true, libs: [ - "android.test.runner", - "android.test.mock", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", "unsupportedappusage", ], } diff --git a/tests/TrustTests/Android.bp b/tests/TrustTests/Android.bp index 4e75a1d02a41..361c0cd9df97 100644 --- a/tests/TrustTests/Android.bp +++ b/tests/TrustTests/Android.bp @@ -31,8 +31,8 @@ android_test { "truth", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], test_suites: [ "device-tests", diff --git a/tests/TtsTests/Android.bp b/tests/TtsTests/Android.bp index b7aa5d4a38aa..e28f69b78141 100644 --- a/tests/TtsTests/Android.bp +++ b/tests/TtsTests/Android.bp @@ -28,8 +28,8 @@ android_test { srcs: ["**/*.java"], static_libs: ["mockito-target"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, } diff --git a/tests/UpdatableSystemFontTest/Android.bp b/tests/UpdatableSystemFontTest/Android.bp index 12d43383a6e2..34eff4f4579b 100644 --- a/tests/UpdatableSystemFontTest/Android.bp +++ b/tests/UpdatableSystemFontTest/Android.bp @@ -25,7 +25,7 @@ package { android_test { name: "UpdatableSystemFontTest", srcs: ["src/**/*.java"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.test"], static_libs: [ "androidx.test.ext.junit", "androidx.test.uiautomator_uiautomator", diff --git a/tests/UsbManagerTests/lib/Android.bp b/tests/UsbManagerTests/lib/Android.bp index 4e5a70fef0ca..506de5c26e3b 100644 --- a/tests/UsbManagerTests/lib/Android.bp +++ b/tests/UsbManagerTests/lib/Android.bp @@ -38,6 +38,6 @@ android_library { "androidx.core_core", ], libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], } diff --git a/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp b/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp index a4085e5315a4..44aa4028c916 100644 --- a/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp +++ b/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp @@ -21,7 +21,7 @@ android_test { name: "ConcurrentMultiSessionImeTest", srcs: ["src/**/*.java"], resource_dirs: ["res"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs"], static_libs: [ "androidx.core_core", "androidx.test.ext.junit", diff --git a/tests/permission/Android.bp b/tests/permission/Android.bp index b02f410c733e..d80eaeb32c1e 100644 --- a/tests/permission/Android.bp +++ b/tests/permission/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", "telephony-common", ], static_libs: [ diff --git a/tests/testables/Android.bp b/tests/testables/Android.bp index c0e3d630d1ab..7596ee722d01 100644 --- a/tests/testables/Android.bp +++ b/tests/testables/Android.bp @@ -27,8 +27,8 @@ java_library { name: "testables", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.mock.stubs.system", "androidx.test.rules", "mockito-target-inline-minus-junit4", ], diff --git a/tests/testables/tests/Android.bp b/tests/testables/tests/Android.bp index d6a4754c37aa..1eb36fa5f908 100644 --- a/tests/testables/tests/Android.bp +++ b/tests/testables/tests/Android.bp @@ -45,9 +45,9 @@ android_test { "libmultiplejvmtiagentsinterferenceagent", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], certificate: "platform", test_suites: [ diff --git a/tests/utils/testutils/Android.bp b/tests/utils/testutils/Android.bp index deff42a27f47..35fd5b1e6ed0 100644 --- a/tests/utils/testutils/Android.bp +++ b/tests/utils/testutils/Android.bp @@ -35,9 +35,9 @@ java_library { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "mockito-target-extended-minus-junit4", ], } diff --git a/tests/utils/testutils/tests/Android.bp b/tests/utils/testutils/tests/Android.bp index 8104280cdd5e..3bb02e42ca3b 100644 --- a/tests/utils/testutils/tests/Android.bp +++ b/tests/utils/testutils/tests/Android.bp @@ -35,9 +35,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], certificate: "platform", diff --git a/tests/vcn/Android.bp b/tests/vcn/Android.bp index ee2e7cfcd480..b16ba15a6867 100644 --- a/tests/vcn/Android.bp +++ b/tests/vcn/Android.bp @@ -34,8 +34,8 @@ android_test { "flag-junit", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", ], } diff --git a/wifi/tests/Android.bp b/wifi/tests/Android.bp index 1d3e4bd531b4..74a6be9baa56 100644 --- a/wifi/tests/Android.bp +++ b/wifi/tests/Android.bp @@ -44,8 +44,8 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs", + "android.test.base.stubs", ], // Required by Extended Mockito -- GitLab From 1e37ed3b647a646557138cd886c0d9c867ce9bde Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Fri, 30 Aug 2024 00:29:12 +0000 Subject: [PATCH 241/492] Make java_sdk_library dependencies explicit modules should specify the submodule of java_sdk_library that the module actually depends on Test: CI Flag: EXEMPT build dependency cleanup Bug: 358613520 Merged-In: I80af0b9efa88c668306f0ff1d51491a8180dc57f Change-Id: I80af0b9efa88c668306f0ff1d51491a8180dc57f --- apct-tests/perftests/core/Android.bp | 2 +- apct-tests/perftests/healthconnect/Android.bp | 2 +- .../perftests/packagemanager/Android.bp | 2 +- apct-tests/perftests/permission/Android.bp | 2 +- .../perftests/settingsprovider/Android.bp | 2 +- cmds/uiautomator/library/Android.bp | 6 ++-- core/tests/BroadcastRadioTests/Android.bp | 2 +- core/tests/ConnectivityManagerTest/Android.bp | 4 +-- core/tests/GameManagerTests/Android.bp | 2 +- core/tests/InputMethodCoreTests/Android.bp | 6 ++-- .../tests/PackageInstallerSessions/Android.bp | 4 +-- core/tests/PlatformCompatFramework/Android.bp | 4 +-- core/tests/bandwidthtests/Android.bp | 6 ++-- .../BatteryStatsLoadTests/Android.bp | 2 +- .../BatteryUsageStatsProtoTests/Android.bp | 2 +- core/tests/bugreports/Android.bp | 4 +-- core/tests/companiontests/Android.bp | 4 +-- core/tests/coretests/Android.bp | 22 +++++++------- core/tests/devicestatetests/Android.bp | 2 +- core/tests/featureflagtests/Android.bp | 4 +-- core/tests/hdmitests/Android.bp | 2 +- .../DownloadManagerTestApp/Android.bp | 4 +-- core/tests/mockingcoretests/Android.bp | 6 ++-- core/tests/packagemanagertests/Android.bp | 2 +- core/tests/packagemonitortests/Android.bp | 4 +-- core/tests/privacytests/Android.bp | 2 +- core/tests/screenshothelpertests/Android.bp | 6 ++-- core/tests/systemproperties/Android.bp | 8 ++--- core/tests/timetests/Android.bp | 2 +- core/tests/utillib/Android.bp | 2 +- core/tests/utiltests/Android.bp | 8 ++--- core/tests/vibrator/Android.bp | 6 ++-- keystore/tests/Android.bp | 2 +- .../Jetpack/tests/unittest/Android.bp | 6 ++-- .../Shell/multivalentTests/Android.bp | 4 +-- .../Shell/tests/flicker/Android.bp | 2 +- .../Shell/tests/unittest/Android.bp | 6 ++-- libs/dream/lowlight/tests/Android.bp | 6 ++-- libs/securebox/tests/Android.bp | 6 ++-- media/lib/tvremote/tests/Android.bp | 6 ++-- media/mca/tests/Android.bp | 4 +-- .../tests/unit/Android.bp | 6 ++-- media/tests/MediaFrameworkTest/Android.bp | 6 ++-- media/tests/MediaRouter/Android.bp | 4 +-- media/tests/TunerTest/Android.bp | 6 ++-- media/tests/projection/Android.bp | 6 ++-- nfc/Android.bp | 4 +-- nfc/tests/Android.bp | 2 +- .../CarrierDefaultApp/tests/unit/Android.bp | 4 +-- .../tests/robotests/Android.bp | 6 ++-- .../ExternalStorageProvider/tests/Android.bp | 6 ++-- packages/FusedLocation/Android.bp | 8 ++--- .../Spa/screenshot/robotests/Android.bp | 6 ++-- packages/SettingsLib/tests/integ/Android.bp | 6 ++-- packages/SettingsProvider/Android.bp | 4 +-- packages/Shell/tests/Android.bp | 6 ++-- packages/SystemUI/Android.bp | 18 +++++------ .../accessibilitymenu/tests/Android.bp | 4 +-- packages/SystemUI/tests/Android.bp | 4 +-- packages/VpnDialogs/tests/Android.bp | 4 +-- packages/WAPPushManager/tests/Android.bp | 4 +-- packages/WallpaperBackup/Android.bp | 4 +-- packages/overlays/tests/Android.bp | 4 +-- ravenwood/Android.bp | 3 +- ravenwood/mockito/Android.bp | 12 ++++---- sax/tests/saxtests/Android.bp | 4 +-- .../devicestateprovider/tests/Android.bp | 6 ++-- .../InputMethodSystemServerTests/Android.bp | 16 +++++----- .../host/test-apps/DeviceSide/Android.bp | 2 +- .../server/Android.bp | 6 ++-- services/tests/VpnTests/Android.bp | 6 ++-- services/tests/displayservicetests/Android.bp | 2 +- .../tests/mockingservicestests/Android.bp | 10 +++---- .../com/android/server/rollback/Android.bp | 6 ++-- services/tests/powerservicetests/Android.bp | 2 +- services/tests/powerstatstests/Android.bp | 2 +- services/tests/servicestests/Android.bp | 16 +++++----- services/tests/timetests/Android.bp | 2 +- services/tests/uiservicestests/Android.bp | 6 ++-- services/tests/vibrator/Android.bp | 6 ++-- .../tests/voiceinteractiontests/Android.bp | 6 ++-- services/tests/wmtests/Android.bp | 6 ++-- test-runner/Android.bp | 30 ++++++++++++++----- test-runner/tests/Android.bp | 4 +-- tests/AppLaunch/Android.bp | 7 +++-- tests/AttestationVerificationTest/Android.bp | 4 +-- tests/BrowserPowerTest/Android.bp | 4 +-- .../SmartCamera/SimpleCamera/tests/Android.bp | 2 +- tests/ChoreographerTests/Android.bp | 4 +-- .../client/Android.bp | 4 +-- tests/CoreTests/android/Android.bp | 2 +- .../CtsSurfaceControlTestsStaging/Android.bp | 4 +-- tests/DataIdleTest/Android.bp | 4 +-- tests/EnforcePermission/perf-app/Android.bp | 4 +-- tests/EnforcePermission/test-app/Android.bp | 4 +-- tests/FlickerTests/Android.bp | 2 +- tests/FrameworkPerf/Android.bp | 4 +-- tests/GamePerformance/Android.bp | 4 +-- tests/Input/Android.bp | 4 +-- tests/InputMethodStressTest/Android.bp | 2 +- tests/InputScreenshotTest/Android.bp | 4 +-- .../InputScreenshotTest/robotests/Android.bp | 6 ++-- tests/Internal/Android.bp | 2 +- tests/LocalizationTest/Android.bp | 6 ++-- tests/MemoryUsage/Android.bp | 4 +-- tests/MultiUser/Android.bp | 6 ++-- tests/NetworkSecurityConfigTest/Android.bp | 4 +-- tests/OneMedia/Android.bp | 2 +- tests/PackageWatchdog/Android.bp | 2 +- tests/ProtoInputStreamTests/Android.bp | 2 +- tests/RemoteDisplayProvider/Android.bp | 2 +- tests/ServiceCrashTest/Android.bp | 2 +- .../SharedLibraryClientTests/Android.bp | 2 +- tests/TelephonyCommonTests/Android.bp | 6 ++-- tests/TrustTests/Android.bp | 4 +-- tests/TtsTests/Android.bp | 4 +-- tests/UpdatableSystemFontTest/Android.bp | 2 +- tests/UsbManagerTests/lib/Android.bp | 2 +- .../ConcurrentMultiSessionImeTest/Android.bp | 2 +- tests/permission/Android.bp | 4 +-- tests/testables/Android.bp | 4 +-- tests/testables/tests/Android.bp | 6 ++-- tests/utils/testutils/Android.bp | 6 ++-- tests/utils/testutils/tests/Android.bp | 6 ++-- tests/vcn/Android.bp | 6 ++-- wifi/tests/Android.bp | 4 +-- 126 files changed, 313 insertions(+), 299 deletions(-) diff --git a/apct-tests/perftests/core/Android.bp b/apct-tests/perftests/core/Android.bp index 65bc8ccd12f8..1e299cdf8002 100644 --- a/apct-tests/perftests/core/Android.bp +++ b/apct-tests/perftests/core/Android.bp @@ -52,7 +52,7 @@ android_test { "guava", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], java_resources: [":GoogleFontDancingScript"], diff --git a/apct-tests/perftests/healthconnect/Android.bp b/apct-tests/perftests/healthconnect/Android.bp index c38a24ee05d2..072010e90fae 100644 --- a/apct-tests/perftests/healthconnect/Android.bp +++ b/apct-tests/perftests/healthconnect/Android.bp @@ -37,7 +37,7 @@ android_test { "collector-device-lib-platform", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, test_suites: ["device-tests"], data: [":perfetto_artifacts"], diff --git a/apct-tests/perftests/packagemanager/Android.bp b/apct-tests/perftests/packagemanager/Android.bp index 02fc12cde04b..b2626911ea1e 100644 --- a/apct-tests/perftests/packagemanager/Android.bp +++ b/apct-tests/perftests/packagemanager/Android.bp @@ -28,7 +28,7 @@ android_test { "services.core", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/apct-tests/perftests/permission/Android.bp b/apct-tests/perftests/permission/Android.bp index bc8e7696440a..f4c7fbbf6593 100644 --- a/apct-tests/perftests/permission/Android.bp +++ b/apct-tests/perftests/permission/Android.bp @@ -43,7 +43,7 @@ android_test { "cts-install-lib-java", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/apct-tests/perftests/settingsprovider/Android.bp b/apct-tests/perftests/settingsprovider/Android.bp index e4aa14cd8a77..382803900507 100644 --- a/apct-tests/perftests/settingsprovider/Android.bp +++ b/apct-tests/perftests/settingsprovider/Android.bp @@ -28,7 +28,7 @@ android_test { "services.core", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/cmds/uiautomator/library/Android.bp b/cmds/uiautomator/library/Android.bp index cd1fb9a0f047..966bf13adfe4 100644 --- a/cmds/uiautomator/library/Android.bp +++ b/cmds/uiautomator/library/Android.bp @@ -71,7 +71,7 @@ java_library_static { ":uiautomator-stubs", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", "junit", ], java_version: "1.8", @@ -84,8 +84,8 @@ java_library_static { "testrunner-src/**/*.java", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/tests/BroadcastRadioTests/Android.bp b/core/tests/BroadcastRadioTests/Android.bp index beffb9aac12b..7d4ae00c405a 100644 --- a/core/tests/BroadcastRadioTests/Android.bp +++ b/core/tests/BroadcastRadioTests/Android.bp @@ -45,7 +45,7 @@ android_test { "flag-junit", "mockito-target-extended", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], test_suites: [ "general-tests", "automotive-general-tests", diff --git a/core/tests/ConnectivityManagerTest/Android.bp b/core/tests/ConnectivityManagerTest/Android.bp index f17a28d22c17..6421899631ff 100644 --- a/core/tests/ConnectivityManagerTest/Android.bp +++ b/core/tests/ConnectivityManagerTest/Android.bp @@ -24,8 +24,8 @@ package { android_test { name: "ConnectivityManagerTest", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/tests/GameManagerTests/Android.bp b/core/tests/GameManagerTests/Android.bp index a252f8b53fab..1abceb820fc1 100644 --- a/core/tests/GameManagerTests/Android.bp +++ b/core/tests/GameManagerTests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/InputMethodCoreTests/Android.bp b/core/tests/InputMethodCoreTests/Android.bp index ac6462589e16..2b524d58ced7 100644 --- a/core/tests/InputMethodCoreTests/Android.bp +++ b/core/tests/InputMethodCoreTests/Android.bp @@ -42,9 +42,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "ext", "framework-res", diff --git a/core/tests/PackageInstallerSessions/Android.bp b/core/tests/PackageInstallerSessions/Android.bp index b631df1fcf57..d10ecd07a44c 100644 --- a/core/tests/PackageInstallerSessions/Android.bp +++ b/core/tests/PackageInstallerSessions/Android.bp @@ -39,8 +39,8 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs", + "android.test.base.stubs", "framework", "framework-res", ], diff --git a/core/tests/PlatformCompatFramework/Android.bp b/core/tests/PlatformCompatFramework/Android.bp index 2621d280bd9d..a3fdf7b43bee 100644 --- a/core/tests/PlatformCompatFramework/Android.bp +++ b/core/tests/PlatformCompatFramework/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/tests/bandwidthtests/Android.bp b/core/tests/bandwidthtests/Android.bp index 8645b39da5a8..b7357122dff8 100644 --- a/core/tests/bandwidthtests/Android.bp +++ b/core/tests/bandwidthtests/Android.bp @@ -27,9 +27,9 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "org.apache.http.legacy", - "android.test.base", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", + "android.test.base.stubs", ], static_libs: [ "junit", diff --git a/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp b/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp index 1c0ea839ec02..926edfed16ef 100644 --- a/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp +++ b/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp @@ -16,7 +16,7 @@ android_test { "compatibility-device-util-axt", "junit", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/batterystatstests/BatteryUsageStatsProtoTests/Android.bp b/core/tests/batterystatstests/BatteryUsageStatsProtoTests/Android.bp index 1fb5f2c0789b..6a554f747182 100644 --- a/core/tests/batterystatstests/BatteryUsageStatsProtoTests/Android.bp +++ b/core/tests/batterystatstests/BatteryUsageStatsProtoTests/Android.bp @@ -21,7 +21,7 @@ android_test { "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", diff --git a/core/tests/bugreports/Android.bp b/core/tests/bugreports/Android.bp index 7c1ac487bfdb..efeb33fdd3e6 100644 --- a/core/tests/bugreports/Android.bp +++ b/core/tests/bugreports/Android.bp @@ -26,8 +26,8 @@ android_test { srcs: ["src/**/*.java"], data: [":bugreport_artifacts"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.test", + "android.test.base.stubs.test", ], static_libs: [ "androidx.test.rules", diff --git a/core/tests/companiontests/Android.bp b/core/tests/companiontests/Android.bp index d31b8f470108..cb0951e59d04 100644 --- a/core/tests/companiontests/Android.bp +++ b/core/tests/companiontests/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], platform_apis: true, diff --git a/core/tests/coretests/Android.bp b/core/tests/coretests/Android.bp index e7eb9dedab0e..678febb0d0c9 100644 --- a/core/tests/coretests/Android.bp +++ b/core/tests/coretests/Android.bp @@ -107,10 +107,10 @@ android_test { ], libs: [ - "android.test.runner", - "org.apache.http.legacy", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "ext", "framework-res", @@ -156,8 +156,8 @@ android_app { use_resource_processor: false, libs: [ "framework-res", - "android.test.runner", - "org.apache.http.legacy", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", ], uses_libs: [ "android.test.runner", @@ -222,9 +222,9 @@ android_library { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "framework", "framework-res", ], @@ -233,8 +233,8 @@ android_library { android_ravenwood_test { name: "FrameworksCoreTestsRavenwood", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "core-test-rules", // for libcore.dalvik.system.CloseGuardSupport diff --git a/core/tests/devicestatetests/Android.bp b/core/tests/devicestatetests/Android.bp index 60848b31eaec..a3303c6ca6d7 100644 --- a/core/tests/devicestatetests/Android.bp +++ b/core/tests/devicestatetests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "testng", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/featureflagtests/Android.bp b/core/tests/featureflagtests/Android.bp index d9f608ea34c4..c08066720477 100644 --- a/core/tests/featureflagtests/Android.bp +++ b/core/tests/featureflagtests/Android.bp @@ -19,8 +19,8 @@ android_test { "androidx.test.rules", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, certificate: "platform", diff --git a/core/tests/hdmitests/Android.bp b/core/tests/hdmitests/Android.bp index e11bc552cf15..7a5757cc7a85 100644 --- a/core/tests/hdmitests/Android.bp +++ b/core/tests/hdmitests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp b/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp index d439124c72cb..c9fdec0e61fd 100644 --- a/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp +++ b/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp @@ -27,8 +27,8 @@ android_test { "junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, diff --git a/core/tests/mockingcoretests/Android.bp b/core/tests/mockingcoretests/Android.bp index 7fd813a7421a..8657b8ca52e1 100644 --- a/core/tests/mockingcoretests/Android.bp +++ b/core/tests/mockingcoretests/Android.bp @@ -44,9 +44,9 @@ android_test { ], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + "android.test.runner.stubs.system", ], // These are not normally accessible from apps so they must be explicitly included. diff --git a/core/tests/packagemanagertests/Android.bp b/core/tests/packagemanagertests/Android.bp index 5ce71c902c7c..8ff499826866 100644 --- a/core/tests/packagemanagertests/Android.bp +++ b/core/tests/packagemanagertests/Android.bp @@ -17,7 +17,7 @@ android_test { "frameworks-base-testutils", "mockito-target-minus-junit4", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/packagemonitortests/Android.bp b/core/tests/packagemonitortests/Android.bp index b08850e90d28..c3b084e4368e 100644 --- a/core/tests/packagemonitortests/Android.bp +++ b/core/tests/packagemonitortests/Android.bp @@ -34,7 +34,7 @@ android_test { "mockito-target-minus-junit4", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], @@ -52,7 +52,7 @@ android_test { "compatibility-device-util-axt", "frameworks-base-testutils", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/privacytests/Android.bp b/core/tests/privacytests/Android.bp index 4e24cd5d91cb..ac9cede84483 100644 --- a/core/tests/privacytests/Android.bp +++ b/core/tests/privacytests/Android.bp @@ -16,7 +16,7 @@ android_test { "androidx.test.rules", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/screenshothelpertests/Android.bp b/core/tests/screenshothelpertests/Android.bp index 3c71e6e4247b..49c3ee94bfd0 100644 --- a/core/tests/screenshothelpertests/Android.bp +++ b/core/tests/screenshothelpertests/Android.bp @@ -25,9 +25,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], platform_apis: true, diff --git a/core/tests/systemproperties/Android.bp b/core/tests/systemproperties/Android.bp index ed52cccfb9b9..ed99a1f5cc4a 100644 --- a/core/tests/systemproperties/Android.bp +++ b/core/tests/systemproperties/Android.bp @@ -20,8 +20,8 @@ android_test { "ravenwood-junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, certificate: "platform", @@ -37,8 +37,8 @@ android_ravenwood_test { "ravenwood-junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], srcs: [ "src/**/*.java", diff --git a/core/tests/timetests/Android.bp b/core/tests/timetests/Android.bp index c33d5ee5008b..04bbe692e488 100644 --- a/core/tests/timetests/Android.bp +++ b/core/tests/timetests/Android.bp @@ -19,7 +19,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], certificate: "platform", test_suites: ["device-tests"], } diff --git a/core/tests/utillib/Android.bp b/core/tests/utillib/Android.bp index 1d5c16c7a536..b6f046bd12d5 100644 --- a/core/tests/utillib/Android.bp +++ b/core/tests/utillib/Android.bp @@ -28,5 +28,5 @@ java_library { srcs: ["**/*.java"], static_libs: ["junit"], - libs: ["android.test.base"], + libs: ["android.test.base.stubs"], } diff --git a/core/tests/utiltests/Android.bp b/core/tests/utiltests/Android.bp index f5563a710563..cdc8a9e06d0b 100644 --- a/core/tests/utiltests/Android.bp +++ b/core/tests/utiltests/Android.bp @@ -39,9 +39,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], platform_apis: true, @@ -55,7 +55,7 @@ android_test { android_ravenwood_test { name: "FrameworksUtilTestsRavenwood", libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.annotation_annotation", diff --git a/core/tests/vibrator/Android.bp b/core/tests/vibrator/Android.bp index 3ebe150acd24..a9d30da6b364 100644 --- a/core/tests/vibrator/Android.bp +++ b/core/tests/vibrator/Android.bp @@ -24,9 +24,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "framework-res", ], diff --git a/keystore/tests/Android.bp b/keystore/tests/Android.bp index 7de45233494b..0dcf597644ee 100644 --- a/keystore/tests/Android.bp +++ b/keystore/tests/Android.bp @@ -31,6 +31,6 @@ android_test { "mockito-target-minus-junit4", ], platform_apis: true, - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], certificate: "platform", } diff --git a/libs/WindowManager/Jetpack/tests/unittest/Android.bp b/libs/WindowManager/Jetpack/tests/unittest/Android.bp index 61ea51a35f58..9a38301d551c 100644 --- a/libs/WindowManager/Jetpack/tests/unittest/Android.bp +++ b/libs/WindowManager/Jetpack/tests/unittest/Android.bp @@ -46,9 +46,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], // These are not normally accessible from apps so they must be explicitly included. diff --git a/libs/WindowManager/Shell/multivalentTests/Android.bp b/libs/WindowManager/Shell/multivalentTests/Android.bp index 1ad19c9f3033..ee0d5bbed324 100644 --- a/libs/WindowManager/Shell/multivalentTests/Android.bp +++ b/libs/WindowManager/Shell/multivalentTests/Android.bp @@ -77,8 +77,8 @@ android_test { "platform-test-rules", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/libs/WindowManager/Shell/tests/flicker/Android.bp b/libs/WindowManager/Shell/tests/flicker/Android.bp index 4abaf5bd4a38..4058fa977f1d 100644 --- a/libs/WindowManager/Shell/tests/flicker/Android.bp +++ b/libs/WindowManager/Shell/tests/flicker/Android.bp @@ -59,7 +59,7 @@ java_defaults { enabled: false, }, test_suites: ["device-tests"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], static_libs: [ "wm-shell-flicker-utils", "androidx.test.ext.junit", diff --git a/libs/WindowManager/Shell/tests/unittest/Android.bp b/libs/WindowManager/Shell/tests/unittest/Android.bp index 0b5387379090..787c9f332b2d 100644 --- a/libs/WindowManager/Shell/tests/unittest/Android.bp +++ b/libs/WindowManager/Shell/tests/unittest/Android.bp @@ -61,9 +61,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ diff --git a/libs/dream/lowlight/tests/Android.bp b/libs/dream/lowlight/tests/Android.bp index 42547832133b..d3e101681ef2 100644 --- a/libs/dream/lowlight/tests/Android.bp +++ b/libs/dream/lowlight/tests/Android.bp @@ -37,9 +37,9 @@ android_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/libs/securebox/tests/Android.bp b/libs/securebox/tests/Android.bp index 80b501da1aa5..8429cf4116c5 100644 --- a/libs/securebox/tests/Android.bp +++ b/libs/securebox/tests/Android.bp @@ -35,9 +35,9 @@ android_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/media/lib/tvremote/tests/Android.bp b/media/lib/tvremote/tests/Android.bp index 280c515e9a9e..83061cf14b0f 100644 --- a/media/lib/tvremote/tests/Android.bp +++ b/media/lib/tvremote/tests/Android.bp @@ -11,9 +11,9 @@ android_test { name: "TvRemoteTests", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", - "com.android.media.tv.remoteprovider", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "com.android.media.tv.remoteprovider.impl", ], static_libs: [ "mockito-target-minus-junit4", diff --git a/media/mca/tests/Android.bp b/media/mca/tests/Android.bp index 04f083dee093..463e131f1dfd 100644 --- a/media/mca/tests/Android.bp +++ b/media/mca/tests/Android.bp @@ -10,8 +10,8 @@ package { android_test { name: "CameraEffectsTests", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/media/packages/BluetoothMidiService/tests/unit/Android.bp b/media/packages/BluetoothMidiService/tests/unit/Android.bp index 67c7e4230f30..54d6dfc658ed 100644 --- a/media/packages/BluetoothMidiService/tests/unit/Android.bp +++ b/media/packages/BluetoothMidiService/tests/unit/Android.bp @@ -39,8 +39,8 @@ android_test { test_suites: ["device-tests"], libs: [ "framework-res", - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], } diff --git a/media/tests/MediaFrameworkTest/Android.bp b/media/tests/MediaFrameworkTest/Android.bp index 1325fc161b77..7ee8777266df 100644 --- a/media/tests/MediaFrameworkTest/Android.bp +++ b/media/tests/MediaFrameworkTest/Android.bp @@ -11,9 +11,9 @@ android_test { name: "mediaframeworktest", srcs: ["**/*.java"], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], static_libs: [ "mockito-target-inline-minus-junit4", diff --git a/media/tests/MediaRouter/Android.bp b/media/tests/MediaRouter/Android.bp index d21cb9319885..e4f88a65ed1a 100644 --- a/media/tests/MediaRouter/Android.bp +++ b/media/tests/MediaRouter/Android.bp @@ -14,8 +14,8 @@ android_test { srcs: ["**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ diff --git a/media/tests/TunerTest/Android.bp b/media/tests/TunerTest/Android.bp index 8e8816cee876..634438e72b59 100644 --- a/media/tests/TunerTest/Android.bp +++ b/media/tests/TunerTest/Android.bp @@ -13,14 +13,14 @@ android_test { srcs: ["**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.rules", "compatibility-device-util-axt", - "testng" + "testng", ], platform_apis: true, diff --git a/media/tests/projection/Android.bp b/media/tests/projection/Android.bp index fd5f19535537..94db2c02eb28 100644 --- a/media/tests/projection/Android.bp +++ b/media/tests/projection/Android.bp @@ -18,9 +18,9 @@ android_test { srcs: ["**/*.java"], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ diff --git a/nfc/Android.bp b/nfc/Android.bp index 0282e6f5c246..db3dcb0631dd 100644 --- a/nfc/Android.bp +++ b/nfc/Android.bp @@ -38,8 +38,8 @@ java_sdk_library { name: "framework-nfc", libs: [ "unsupportedappusage", // for android.compat.annotation.UnsupportedAppUsage - "framework-permission-s", - "framework-permission", + "framework-permission-s.stubs.module_lib", + "framework-permission.stubs.module_lib", ], static_libs: [ "android.nfc.flags-aconfig-java", diff --git a/nfc/tests/Android.bp b/nfc/tests/Android.bp index 6ebc03cc6ffc..bfa814d149f0 100644 --- a/nfc/tests/Android.bp +++ b/nfc/tests/Android.bp @@ -32,7 +32,7 @@ android_test { ], libs: [ "framework-nfc.impl", - "android.test.runner", + "android.test.runner.stubs.system", ], srcs: ["src/**/*.java"], platform_apis: true, diff --git a/packages/CarrierDefaultApp/tests/unit/Android.bp b/packages/CarrierDefaultApp/tests/unit/Android.bp index 0d08ec6ca2b3..bec81ad5f92e 100644 --- a/packages/CarrierDefaultApp/tests/unit/Android.bp +++ b/packages/CarrierDefaultApp/tests/unit/Android.bp @@ -25,8 +25,8 @@ android_test { name: "CarrierDefaultAppUnitTests", certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", "SlicePurchaseController", ], static_libs: [ diff --git a/packages/CredentialManager/tests/robotests/Android.bp b/packages/CredentialManager/tests/robotests/Android.bp index 75a0dcce0b9e..27afaaa49fdd 100644 --- a/packages/CredentialManager/tests/robotests/Android.bp +++ b/packages/CredentialManager/tests/robotests/Android.bp @@ -48,9 +48,9 @@ android_robolectric_test { "flag-junit-base", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "truth", ], upstream: true, diff --git a/packages/ExternalStorageProvider/tests/Android.bp b/packages/ExternalStorageProvider/tests/Android.bp index 86c62ef299e4..b5b1186c0db1 100644 --- a/packages/ExternalStorageProvider/tests/Android.bp +++ b/packages/ExternalStorageProvider/tests/Android.bp @@ -17,9 +17,9 @@ android_test { ], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ diff --git a/packages/FusedLocation/Android.bp b/packages/FusedLocation/Android.bp index 61a82701d155..719aa28a4e30 100644 --- a/packages/FusedLocation/Android.bp +++ b/packages/FusedLocation/Android.bp @@ -35,7 +35,7 @@ android_app { name: "FusedLocation", defaults: ["platform_app_defaults"], srcs: ["src/**/*.java"], - libs: ["com.android.location.provider"], + libs: ["com.android.location.provider.impl"], platform_apis: true, certificate: "platform", privileged: true, @@ -50,9 +50,9 @@ android_test { "src/**/*.java", // include real sources because we're forced to test this directly ], libs: [ - "android.test.base", - "android.test.runner", - "com.android.location.provider", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", + "com.android.location.provider.impl", ], static_libs: [ "androidx.test.core", diff --git a/packages/SettingsLib/Spa/screenshot/robotests/Android.bp b/packages/SettingsLib/Spa/screenshot/robotests/Android.bp index c834c80ad536..f6477e2f052a 100644 --- a/packages/SettingsLib/Spa/screenshot/robotests/Android.bp +++ b/packages/SettingsLib/Spa/screenshot/robotests/Android.bp @@ -63,9 +63,9 @@ android_robolectric_test { "uiautomator-helpers", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "truth", ], upstream: true, diff --git a/packages/SettingsLib/tests/integ/Android.bp b/packages/SettingsLib/tests/integ/Android.bp index 48a1af6cb0e8..03dd7122660d 100644 --- a/packages/SettingsLib/tests/integ/Android.bp +++ b/packages/SettingsLib/tests/integ/Android.bp @@ -37,10 +37,10 @@ android_test { ], libs: [ - "android.test.runner", + "android.test.runner.stubs", "telephony-common", - "android.test.base", - "android.test.mock", + "android.test.base.stubs", + "android.test.mock.stubs", "truth", ], diff --git a/packages/SettingsProvider/Android.bp b/packages/SettingsProvider/Android.bp index 75f8384321b0..58d6d07b735c 100644 --- a/packages/SettingsProvider/Android.bp +++ b/packages/SettingsProvider/Android.bp @@ -75,8 +75,8 @@ android_test { "Harrier", ], libs: [ - "android.test.base", - "android.test.mock", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "unsupportedappusage", ], resource_dirs: [], diff --git a/packages/Shell/tests/Android.bp b/packages/Shell/tests/Android.bp index 0dc331478997..6399ffdfdf2f 100644 --- a/packages/Shell/tests/Android.bp +++ b/packages/Shell/tests/Android.bp @@ -11,9 +11,9 @@ android_test { name: "ShellTests", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.test.rules", diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index fde7c2caca06..1eae218ffed9 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -725,9 +725,9 @@ android_library { "androidx.test.rules", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "keepanno-annotations", ], kotlincflags: ["-Xjvm-default=all"], @@ -820,9 +820,9 @@ android_robolectric_test { "RoboTestLibraries", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "truth", ], @@ -892,9 +892,9 @@ android_ravenwood_test { "mockito-kotlin-nodeps", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], auto_gen_config: true, plugins: [ diff --git a/packages/SystemUI/accessibility/accessibilitymenu/tests/Android.bp b/packages/SystemUI/accessibility/accessibilitymenu/tests/Android.bp index 395354ef8f20..2ef6bbb34987 100644 --- a/packages/SystemUI/accessibility/accessibilitymenu/tests/Android.bp +++ b/packages/SystemUI/accessibility/accessibilitymenu/tests/Android.bp @@ -24,8 +24,8 @@ android_test { use_resource_processor: true, certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/packages/SystemUI/tests/Android.bp b/packages/SystemUI/tests/Android.bp index f601387d0910..3e7596ccabf0 100644 --- a/packages/SystemUI/tests/Android.bp +++ b/packages/SystemUI/tests/Android.bp @@ -35,9 +35,9 @@ android_test { "libstaticjvmtiagent", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", "telephony-common", - "android.test.base", + "android.test.base.stubs.system", ], aaptflags: [ "--extra-packages com.android.systemui", diff --git a/packages/VpnDialogs/tests/Android.bp b/packages/VpnDialogs/tests/Android.bp index 68639bd1c4fe..409282efb714 100644 --- a/packages/VpnDialogs/tests/Android.bp +++ b/packages/VpnDialogs/tests/Android.bp @@ -22,8 +22,8 @@ android_test { // (e.g. VpnManager#prepareVpn()). certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/packages/WAPPushManager/tests/Android.bp b/packages/WAPPushManager/tests/Android.bp index 0a179383fab6..973100248a2b 100644 --- a/packages/WAPPushManager/tests/Android.bp +++ b/packages/WAPPushManager/tests/Android.bp @@ -26,9 +26,9 @@ package { android_test { name: "WAPPushManagerTests", libs: [ - "android.test.runner", + "android.test.runner.stubs.system", "telephony-common", - "android.test.base", + "android.test.base.stubs.system", ], static_libs: ["junit"], // Include all test java files. diff --git a/packages/WallpaperBackup/Android.bp b/packages/WallpaperBackup/Android.bp index 18f783146c72..b8e0d427f3d8 100644 --- a/packages/WallpaperBackup/Android.bp +++ b/packages/WallpaperBackup/Android.bp @@ -42,8 +42,8 @@ android_test { "test/src/**/*.java", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/packages/overlays/tests/Android.bp b/packages/overlays/tests/Android.bp index 0244c0fe0533..8bbe60059d45 100644 --- a/packages/overlays/tests/Android.bp +++ b/packages/overlays/tests/Android.bp @@ -26,8 +26,8 @@ android_test { certificate: "platform", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, static_libs: [ diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp index 4faf03c395f3..ea588b56f3ab 100644 --- a/ravenwood/Android.bp +++ b/ravenwood/Android.bp @@ -155,13 +155,12 @@ java_library { "ravenwood-runtime-common", ], libs: [ - "android.test.mock", + "android.test.mock.impl", "framework-minus-apex.ravenwood", "ravenwood-framework", "services.core.ravenwood", "junit", ], - sdk_version: "core_current", visibility: ["//frameworks/base"], jarjar_rules: ":ravenwood-services-jarjar-rules", } diff --git a/ravenwood/mockito/Android.bp b/ravenwood/mockito/Android.bp index 95c7394b19f3..d91537bbc334 100644 --- a/ravenwood/mockito/Android.bp +++ b/ravenwood/mockito/Android.bp @@ -21,9 +21,9 @@ android_ravenwood_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], auto_gen_config: true, } @@ -48,9 +48,9 @@ android_test { "mockito-target-extended-minus-junit4", ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ // Required by mockito diff --git a/sax/tests/saxtests/Android.bp b/sax/tests/saxtests/Android.bp index 446ee9394179..29c742f47868 100644 --- a/sax/tests/saxtests/Android.bp +++ b/sax/tests/saxtests/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/services/foldables/devicestateprovider/tests/Android.bp b/services/foldables/devicestateprovider/tests/Android.bp index 84a6df38e0a0..4352c15879e1 100644 --- a/services/foldables/devicestateprovider/tests/Android.bp +++ b/services/foldables/devicestateprovider/tests/Android.bp @@ -6,9 +6,9 @@ android_test { name: "foldable-device-state-provider-tests", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/services/tests/InputMethodSystemServerTests/Android.bp b/services/tests/InputMethodSystemServerTests/Android.bp index 73ebeba0c436..142e4664c0ee 100644 --- a/services/tests/InputMethodSystemServerTests/Android.bp +++ b/services/tests/InputMethodSystemServerTests/Android.bp @@ -50,9 +50,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], data: [ @@ -79,8 +79,8 @@ android_ravenwood_test { "services", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], srcs: [ "src/com/android/server/inputmethod/**/ClientControllerTest.java", @@ -122,9 +122,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], data: [ diff --git a/services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp b/services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp index 73cec6c13d6d..71ada2e973ce 100644 --- a/services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp +++ b/services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp @@ -29,7 +29,7 @@ android_test_helper_app { sdk_version: "test_current", srcs: ["src/**/*.kt"], libs: [ - "android.test.base", + "android.test.base.stubs.test", ], static_libs: [ "androidx.annotation_annotation", diff --git a/services/tests/PackageManagerServiceTests/server/Android.bp b/services/tests/PackageManagerServiceTests/server/Android.bp index 907d3cdad63f..1da7e1100a43 100644 --- a/services/tests/PackageManagerServiceTests/server/Android.bp +++ b/services/tests/PackageManagerServiceTests/server/Android.bp @@ -65,9 +65,9 @@ android_test { "android.hardware.tv.cec-V1.0-java", "android.hardware.vibrator-V2-java", "android.hidl.manager-V1.0-java", - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], platform_apis: true, diff --git a/services/tests/VpnTests/Android.bp b/services/tests/VpnTests/Android.bp index a5011a8d8b00..ee20f1a105a4 100644 --- a/services/tests/VpnTests/Android.bp +++ b/services/tests/VpnTests/Android.bp @@ -38,8 +38,8 @@ android_test { "framework-connectivity-t.impl", "framework", "framework-res", - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", ], } diff --git a/services/tests/displayservicetests/Android.bp b/services/tests/displayservicetests/Android.bp index 61350bf24868..fe73025e9736 100644 --- a/services/tests/displayservicetests/Android.bp +++ b/services/tests/displayservicetests/Android.bp @@ -16,7 +16,7 @@ android_test { ], libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ diff --git a/services/tests/mockingservicestests/Android.bp b/services/tests/mockingservicestests/Android.bp index 5a7693194d88..d9f925ad5482 100644 --- a/services/tests/mockingservicestests/Android.bp +++ b/services/tests/mockingservicestests/Android.bp @@ -80,9 +80,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", "servicestests-core-utils", ], @@ -118,14 +118,14 @@ java_library { "mockito-target-extended-minus-junit4", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", ], } android_ravenwood_test { name: "FrameworksMockingServicesTestsRavenwood", libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.annotation_annotation", diff --git a/services/tests/mockingservicestests/src/com/android/server/rollback/Android.bp b/services/tests/mockingservicestests/src/com/android/server/rollback/Android.bp index 6a16d1e14795..677ecf47355d 100644 --- a/services/tests/mockingservicestests/src/com/android/server/rollback/Android.bp +++ b/services/tests/mockingservicestests/src/com/android/server/rollback/Android.bp @@ -37,9 +37,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ diff --git a/services/tests/powerservicetests/Android.bp b/services/tests/powerservicetests/Android.bp index f8cc6d0fedb6..f03043ea0ae0 100644 --- a/services/tests/powerservicetests/Android.bp +++ b/services/tests/powerservicetests/Android.bp @@ -23,7 +23,7 @@ android_test { ], libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], defaults: [ diff --git a/services/tests/powerstatstests/Android.bp b/services/tests/powerstatstests/Android.bp index beaafdd84ca3..cedf9dbe734f 100644 --- a/services/tests/powerstatstests/Android.bp +++ b/services/tests/powerstatstests/Android.bp @@ -30,7 +30,7 @@ android_test { ], libs: [ - "android.test.base", + "android.test.base.stubs.system", ], resource_dirs: ["res/"], diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp index dce6c359e6fd..1cbc131cebc5 100644 --- a/services/tests/servicestests/Android.bp +++ b/services/tests/servicestests/Android.bp @@ -95,9 +95,9 @@ android_test { "android.hardware.tv.cec-V1.0-java", "android.hardware.vibrator-V2-java", "android.hidl.manager-V1.0-java", - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], platform_apis: true, @@ -151,7 +151,7 @@ android_test { android_ravenwood_test { name: "FrameworksServicesTestsRavenwood", libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.annotation_annotation", @@ -191,8 +191,8 @@ java_library { "src/com/android/server/devicepolicy/MockUtils.java", ], libs: [ - "android.test.mock", - "android.test.base", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", "mockito-target-minus-junit4", ], static_libs: [ @@ -217,7 +217,7 @@ java_library { "mockito-target-minus-junit4", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", ], } @@ -243,7 +243,7 @@ java_library { "mockito-target-extended-minus-junit4", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", ], } diff --git a/services/tests/timetests/Android.bp b/services/tests/timetests/Android.bp index 05a1433c128e..aae6acc7c53a 100644 --- a/services/tests/timetests/Android.bp +++ b/services/tests/timetests/Android.bp @@ -20,7 +20,7 @@ android_test { "services.core", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/services/tests/uiservicestests/Android.bp b/services/tests/uiservicestests/Android.bp index e6cf0c38a10c..850d2f7f36a5 100644 --- a/services/tests/uiservicestests/Android.bp +++ b/services/tests/uiservicestests/Android.bp @@ -54,9 +54,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], dxflags: ["--multi-dex"], diff --git a/services/tests/vibrator/Android.bp b/services/tests/vibrator/Android.bp index da21cd3cf919..9a727eb7603e 100644 --- a/services/tests/vibrator/Android.bp +++ b/services/tests/vibrator/Android.bp @@ -17,9 +17,9 @@ android_test { libs: [ "android.hardware.vibrator-V2-java", - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ diff --git a/services/tests/voiceinteractiontests/Android.bp b/services/tests/voiceinteractiontests/Android.bp index 8c70851f87df..5fbf02cfc984 100644 --- a/services/tests/voiceinteractiontests/Android.bp +++ b/services/tests/voiceinteractiontests/Android.bp @@ -49,9 +49,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], certificate: "platform", diff --git a/services/tests/wmtests/Android.bp b/services/tests/wmtests/Android.bp index 4bdd375bd590..76ff23188632 100644 --- a/services/tests/wmtests/Android.bp +++ b/services/tests/wmtests/Android.bp @@ -75,9 +75,9 @@ android_test { libs: [ "android.hardware.power-V1-java", - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], defaults: [ diff --git a/test-runner/Android.bp b/test-runner/Android.bp index 6b5be3cba204..bb2c4d97c87a 100644 --- a/test-runner/Android.bp +++ b/test-runner/Android.bp @@ -32,14 +32,28 @@ java_sdk_library { javacflags: ["-Xep:DepAnn:ERROR"], }, - libs: [ - "android.test.base", - "android.test.mock", - ], - stub_only_libs: [ - "android.test.base", - "android.test.mock", + impl_only_libs: [ + "android.test.base.impl", + "android.test.mock.impl", ], + public: { + libs: [ + "android.test.base.stubs", + "android.test.mock.stubs", + ], + }, + system: { + libs: [ + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + ], + }, + test: { + libs: [ + "android.test.base.stubs.test", + "android.test.mock.stubs.test", + ], + }, api_packages: [ "android.test", "android.test.suitebuilder", @@ -64,7 +78,7 @@ java_library { sdk_version: "current", libs: [ "android.test.base_static", - "android.test.mock", + "android.test.mock.stubs", "junit", ], } diff --git a/test-runner/tests/Android.bp b/test-runner/tests/Android.bp index 0c0c0805f2d3..39f41ed7f667 100644 --- a/test-runner/tests/Android.bp +++ b/test-runner/tests/Android.bp @@ -30,8 +30,8 @@ android_test { libs: [ "android.test.runner.impl", - "android.test.base", - "android.test.mock", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], static_libs: [ "junit", diff --git a/tests/AppLaunch/Android.bp b/tests/AppLaunch/Android.bp index f838c5a80c28..90a00fe6083e 100644 --- a/tests/AppLaunch/Android.bp +++ b/tests/AppLaunch/Android.bp @@ -14,11 +14,12 @@ android_test { platform_apis: true, certificate: "platform", libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], static_libs: [ "androidx.test.rules", - "ub-uiautomator"], + "ub-uiautomator", + ], test_suites: ["device-tests"], } diff --git a/tests/AttestationVerificationTest/Android.bp b/tests/AttestationVerificationTest/Android.bp index b98f8cb0c21d..5f0908959ed5 100644 --- a/tests/AttestationVerificationTest/Android.bp +++ b/tests/AttestationVerificationTest/Android.bp @@ -32,8 +32,8 @@ android_test { }, test_suites: ["device-tests"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "compatibility-device-util-axt", diff --git a/tests/BrowserPowerTest/Android.bp b/tests/BrowserPowerTest/Android.bp index a8a9897c0e86..100e975b4d5e 100644 --- a/tests/BrowserPowerTest/Android.bp +++ b/tests/BrowserPowerTest/Android.bp @@ -24,8 +24,8 @@ package { android_test { name: "BrowserPowerTests", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], // Include all test java files. diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp b/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp index 5edb1de9586e..4aeca5b04602 100644 --- a/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp +++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp @@ -24,7 +24,7 @@ android_test { name: "SmartCamera-tests", platform_apis: true, srcs: ["src/**/*.java"], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], static_libs: [ "guava", "junit", diff --git a/tests/ChoreographerTests/Android.bp b/tests/ChoreographerTests/Android.bp index 3f48d70d659f..69a9d180bfd3 100644 --- a/tests/ChoreographerTests/Android.bp +++ b/tests/ChoreographerTests/Android.bp @@ -26,8 +26,8 @@ android_test { name: "ChoreographerTests", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/tests/CompanionDeviceMultiDeviceTests/client/Android.bp b/tests/CompanionDeviceMultiDeviceTests/client/Android.bp index 9994826d061a..ce63fe89fe2e 100644 --- a/tests/CompanionDeviceMultiDeviceTests/client/Android.bp +++ b/tests/CompanionDeviceMultiDeviceTests/client/Android.bp @@ -40,8 +40,8 @@ android_test { "mobly-snippet-lib", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], optimize: { diff --git a/tests/CoreTests/android/Android.bp b/tests/CoreTests/android/Android.bp index 97a6e5fd4d1b..85e951e099ce 100644 --- a/tests/CoreTests/android/Android.bp +++ b/tests/CoreTests/android/Android.bp @@ -12,7 +12,7 @@ android_test { srcs: ["**/*.java"], libs: [ "android.test.runner.stubs", - "org.apache.http.legacy", + "org.apache.http.legacy.stubs", "android.test.base.stubs", ], sdk_version: "current", diff --git a/tests/CtsSurfaceControlTestsStaging/Android.bp b/tests/CtsSurfaceControlTestsStaging/Android.bp index 1038c9e93931..8d93b28b9acb 100644 --- a/tests/CtsSurfaceControlTestsStaging/Android.bp +++ b/tests/CtsSurfaceControlTestsStaging/Android.bp @@ -28,8 +28,8 @@ android_test { name: "CtsSurfaceControlTestsStaging", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/tests/DataIdleTest/Android.bp b/tests/DataIdleTest/Android.bp index f9509cc9a4bf..8839df664abf 100644 --- a/tests/DataIdleTest/Android.bp +++ b/tests/DataIdleTest/Android.bp @@ -27,8 +27,8 @@ android_test { name: "DataIdleTest", platform_apis: true, libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], srcs: ["src/**/*.java"], diff --git a/tests/EnforcePermission/perf-app/Android.bp b/tests/EnforcePermission/perf-app/Android.bp index 6d04fdc821bb..dbafd739c7bc 100644 --- a/tests/EnforcePermission/perf-app/Android.bp +++ b/tests/EnforcePermission/perf-app/Android.bp @@ -32,8 +32,8 @@ android_test { "androidx.test.rules", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], data: [ ":EnforcePermissionTestHelper", diff --git a/tests/EnforcePermission/test-app/Android.bp b/tests/EnforcePermission/test-app/Android.bp index 065ab33448e3..64f850b1e147 100644 --- a/tests/EnforcePermission/test-app/Android.bp +++ b/tests/EnforcePermission/test-app/Android.bp @@ -27,8 +27,8 @@ android_test { "androidx.test.rules", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], data: [ ":EnforcePermissionTestHelper", diff --git a/tests/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp index d658d5991a57..27e9ffa4cea5 100644 --- a/tests/FlickerTests/Android.bp +++ b/tests/FlickerTests/Android.bp @@ -31,7 +31,7 @@ java_defaults { enabled: false, }, test_suites: ["device-tests"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], static_libs: [ "androidx.test.ext.junit", "flickertestapplib", diff --git a/tests/FrameworkPerf/Android.bp b/tests/FrameworkPerf/Android.bp index 9be3ab795b86..4e39fe1c5e4a 100644 --- a/tests/FrameworkPerf/Android.bp +++ b/tests/FrameworkPerf/Android.bp @@ -12,8 +12,8 @@ android_test { srcs: ["**/*.java"], platform_apis: true, libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], aaptflags: [ diff --git a/tests/GamePerformance/Android.bp b/tests/GamePerformance/Android.bp index f250a1bbdaca..964f0b914c65 100644 --- a/tests/GamePerformance/Android.bp +++ b/tests/GamePerformance/Android.bp @@ -33,8 +33,8 @@ android_test_helper_app { srcs: ["src/**/*.java"], static_libs: ["androidx.test.rules"], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], platform_apis: true, certificate: "platform", diff --git a/tests/Input/Android.bp b/tests/Input/Android.bp index f367c38b06e9..084f9bd6d682 100644 --- a/tests/Input/Android.bp +++ b/tests/Input/Android.bp @@ -50,8 +50,8 @@ android_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", ], test_suites: ["device-tests"], } diff --git a/tests/InputMethodStressTest/Android.bp b/tests/InputMethodStressTest/Android.bp index 5ed8d8d528c4..2697d32dd622 100644 --- a/tests/InputMethodStressTest/Android.bp +++ b/tests/InputMethodStressTest/Android.bp @@ -20,7 +20,7 @@ package { android_test { name: "InputMethodStressTest", srcs: ["src/**/*.java"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs"], static_libs: [ "androidx.test.ext.junit", "androidx.test.uiautomator_uiautomator", diff --git a/tests/InputScreenshotTest/Android.bp b/tests/InputScreenshotTest/Android.bp index 927b101012c5..12ab550c2da2 100644 --- a/tests/InputScreenshotTest/Android.bp +++ b/tests/InputScreenshotTest/Android.bp @@ -67,8 +67,8 @@ android_test { "truth", ], libs: [ - "android.test.mock", - "android.test.base", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", ], test_suites: ["device-tests"], compile_multilib: "both", diff --git a/tests/InputScreenshotTest/robotests/Android.bp b/tests/InputScreenshotTest/robotests/Android.bp index d63fd69ae4d9..b2414a85c095 100644 --- a/tests/InputScreenshotTest/robotests/Android.bp +++ b/tests/InputScreenshotTest/robotests/Android.bp @@ -61,9 +61,9 @@ android_robolectric_test { "uiautomator-helpers", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "truth", ], upstream: true, diff --git a/tests/Internal/Android.bp b/tests/Internal/Android.bp index 827ff4fbd989..bb4e1ec9b6f2 100644 --- a/tests/Internal/Android.bp +++ b/tests/Internal/Android.bp @@ -14,7 +14,7 @@ android_test { }, // Include some source files directly to be able to access package members srcs: ["src/**/*.java"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], static_libs: [ "junit", "androidx.test.rules", diff --git a/tests/LocalizationTest/Android.bp b/tests/LocalizationTest/Android.bp index 909ca5972552..5d9901bb4d0d 100644 --- a/tests/LocalizationTest/Android.bp +++ b/tests/LocalizationTest/Android.bp @@ -25,9 +25,9 @@ android_test { name: "LocalizationTest", srcs: ["java/**/*.kt"], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.test.core", diff --git a/tests/MemoryUsage/Android.bp b/tests/MemoryUsage/Android.bp index e30a0a7cd8b5..deb46636e5b2 100644 --- a/tests/MemoryUsage/Android.bp +++ b/tests/MemoryUsage/Android.bp @@ -14,8 +14,8 @@ android_test { platform_apis: true, certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], } diff --git a/tests/MultiUser/Android.bp b/tests/MultiUser/Android.bp index bde309fe3015..e4d9f02b3d02 100644 --- a/tests/MultiUser/Android.bp +++ b/tests/MultiUser/Android.bp @@ -18,9 +18,9 @@ android_test { "services.core", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], certificate: "platform", test_suites: ["device-tests"], diff --git a/tests/NetworkSecurityConfigTest/Android.bp b/tests/NetworkSecurityConfigTest/Android.bp index 473eadbcad73..4c48eaa4622e 100644 --- a/tests/NetworkSecurityConfigTest/Android.bp +++ b/tests/NetworkSecurityConfigTest/Android.bp @@ -11,8 +11,8 @@ android_test { name: "NetworkSecurityConfigTests", certificate: "platform", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], // Include all test java files. diff --git a/tests/OneMedia/Android.bp b/tests/OneMedia/Android.bp index a43cd39f0dcb..a1817ccb662a 100644 --- a/tests/OneMedia/Android.bp +++ b/tests/OneMedia/Android.bp @@ -15,7 +15,7 @@ android_app { ], platform_apis: true, certificate: "platform", - libs: ["org.apache.http.legacy"], + libs: ["org.apache.http.legacy.stubs.system"], optional_uses_libs: ["org.apache.http.legacy"], optimize: { enabled: false, diff --git a/tests/PackageWatchdog/Android.bp b/tests/PackageWatchdog/Android.bp index 2c5fdd3228ed..096555eb3056 100644 --- a/tests/PackageWatchdog/Android.bp +++ b/tests/PackageWatchdog/Android.bp @@ -36,7 +36,7 @@ android_test { "services.net", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], jni_libs: [ // mockito-target-extended dependencies "libdexmakerjvmtiagent", diff --git a/tests/ProtoInputStreamTests/Android.bp b/tests/ProtoInputStreamTests/Android.bp index 0029080b5a89..40ab257fef37 100644 --- a/tests/ProtoInputStreamTests/Android.bp +++ b/tests/ProtoInputStreamTests/Android.bp @@ -33,7 +33,7 @@ android_test { platform_apis: true, certificate: "platform", test_suites: ["device-tests"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], static_libs: [ "androidx.test.rules", "frameworks-base-testutils", diff --git a/tests/RemoteDisplayProvider/Android.bp b/tests/RemoteDisplayProvider/Android.bp index 55732d14af46..468bdda75713 100644 --- a/tests/RemoteDisplayProvider/Android.bp +++ b/tests/RemoteDisplayProvider/Android.bp @@ -27,6 +27,6 @@ android_test { sdk_version: "system_current", srcs: ["src/**/*.java"], resource_dirs: ["res"], - libs: ["com.android.media.remotedisplay"], + libs: ["com.android.media.remotedisplay.stubs.system"], certificate: "platform", } diff --git a/tests/ServiceCrashTest/Android.bp b/tests/ServiceCrashTest/Android.bp index fb98b7631b7e..82f397ffe259 100644 --- a/tests/ServiceCrashTest/Android.bp +++ b/tests/ServiceCrashTest/Android.bp @@ -13,7 +13,7 @@ android_test { srcs: ["src/**/*.java"], platform_apis: true, certificate: "platform", - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], static_libs: [ "compatibility-device-util-axt", "androidx.test.rules", diff --git a/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp b/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp index 0d204979cb92..c0ac50c962f2 100644 --- a/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp +++ b/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp @@ -23,7 +23,7 @@ android_test_helper_app { libs: [ "SharedLibraryLoadingTests_StandardSharedLibrary", "SharedLibraryLoadingTests_SharedLibraryLoadedAfter", - "android.test.base", + "android.test.base.stubs.system", ], static_libs: [ "androidx.test.ext.junit", diff --git a/tests/TelephonyCommonTests/Android.bp b/tests/TelephonyCommonTests/Android.bp index b968e5d81148..b1af6aed27a0 100644 --- a/tests/TelephonyCommonTests/Android.bp +++ b/tests/TelephonyCommonTests/Android.bp @@ -50,9 +50,9 @@ android_test { platform_apis: true, libs: [ - "android.test.runner", - "android.test.mock", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", "unsupportedappusage", ], } diff --git a/tests/TrustTests/Android.bp b/tests/TrustTests/Android.bp index 8888b32d2c69..f22feb3f88fa 100644 --- a/tests/TrustTests/Android.bp +++ b/tests/TrustTests/Android.bp @@ -31,8 +31,8 @@ android_test { "truth", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], test_suites: [ "device-tests", diff --git a/tests/TtsTests/Android.bp b/tests/TtsTests/Android.bp index b7aa5d4a38aa..e28f69b78141 100644 --- a/tests/TtsTests/Android.bp +++ b/tests/TtsTests/Android.bp @@ -28,8 +28,8 @@ android_test { srcs: ["**/*.java"], static_libs: ["mockito-target"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, } diff --git a/tests/UpdatableSystemFontTest/Android.bp b/tests/UpdatableSystemFontTest/Android.bp index 12d43383a6e2..34eff4f4579b 100644 --- a/tests/UpdatableSystemFontTest/Android.bp +++ b/tests/UpdatableSystemFontTest/Android.bp @@ -25,7 +25,7 @@ package { android_test { name: "UpdatableSystemFontTest", srcs: ["src/**/*.java"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.test"], static_libs: [ "androidx.test.ext.junit", "androidx.test.uiautomator_uiautomator", diff --git a/tests/UsbManagerTests/lib/Android.bp b/tests/UsbManagerTests/lib/Android.bp index 4e5a70fef0ca..506de5c26e3b 100644 --- a/tests/UsbManagerTests/lib/Android.bp +++ b/tests/UsbManagerTests/lib/Android.bp @@ -38,6 +38,6 @@ android_library { "androidx.core_core", ], libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], } diff --git a/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp b/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp index 4c531b8f9ee0..b68937f268e2 100644 --- a/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp +++ b/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp @@ -21,7 +21,7 @@ android_test { name: "ConcurrentMultiSessionImeTest", srcs: ["src/**/*.java"], resource_dirs: ["res"], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs"], static_libs: [ "androidx.test.ext.junit", "androidx.test.rules", diff --git a/tests/permission/Android.bp b/tests/permission/Android.bp index b02f410c733e..d80eaeb32c1e 100644 --- a/tests/permission/Android.bp +++ b/tests/permission/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", "telephony-common", ], static_libs: [ diff --git a/tests/testables/Android.bp b/tests/testables/Android.bp index c0e3d630d1ab..7596ee722d01 100644 --- a/tests/testables/Android.bp +++ b/tests/testables/Android.bp @@ -27,8 +27,8 @@ java_library { name: "testables", srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.mock.stubs.system", "androidx.test.rules", "mockito-target-inline-minus-junit4", ], diff --git a/tests/testables/tests/Android.bp b/tests/testables/tests/Android.bp index 06449e0ce574..2a3e4ae0c039 100644 --- a/tests/testables/tests/Android.bp +++ b/tests/testables/tests/Android.bp @@ -41,9 +41,9 @@ android_test { "libmultiplejvmtiagentsinterferenceagent", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], certificate: "platform", test_suites: [ diff --git a/tests/utils/testutils/Android.bp b/tests/utils/testutils/Android.bp index deff42a27f47..35fd5b1e6ed0 100644 --- a/tests/utils/testutils/Android.bp +++ b/tests/utils/testutils/Android.bp @@ -35,9 +35,9 @@ java_library { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "mockito-target-extended-minus-junit4", ], } diff --git a/tests/utils/testutils/tests/Android.bp b/tests/utils/testutils/tests/Android.bp index 8104280cdd5e..3bb02e42ca3b 100644 --- a/tests/utils/testutils/tests/Android.bp +++ b/tests/utils/testutils/tests/Android.bp @@ -35,9 +35,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], certificate: "platform", diff --git a/tests/vcn/Android.bp b/tests/vcn/Android.bp index ee2e7cfcd480..b16ba15a6867 100644 --- a/tests/vcn/Android.bp +++ b/tests/vcn/Android.bp @@ -34,8 +34,8 @@ android_test { "flag-junit", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", ], } diff --git a/wifi/tests/Android.bp b/wifi/tests/Android.bp index 1d3e4bd531b4..74a6be9baa56 100644 --- a/wifi/tests/Android.bp +++ b/wifi/tests/Android.bp @@ -44,8 +44,8 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs", + "android.test.base.stubs", ], // Required by Extended Mockito -- GitLab From ed1f2e149361148e469f19664f91c4786446b335 Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Tue, 10 Sep 2024 17:41:19 -0700 Subject: [PATCH 242/492] Remove log spam Bug: 333941740 Test: atest PowerStatsTests; atest PowerStatsTestsRavenwood Flag: EXEMPT_cleanup Change-Id: I550098f6a21d5604bd5125c51672753de51b8cdc --- .../com/android/server/power/stats/PowerStatsCollector.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/services/core/java/com/android/server/power/stats/PowerStatsCollector.java b/services/core/java/com/android/server/power/stats/PowerStatsCollector.java index 291f0e38908e..e5b990eeda4b 100644 --- a/services/core/java/com/android/server/power/stats/PowerStatsCollector.java +++ b/services/core/java/com/android/server/power/stats/PowerStatsCollector.java @@ -432,9 +432,6 @@ public abstract class PowerStatsCollector { EnergyConsumerResult[] energy = mConsumedEnergyRetriever.getConsumedEnergy(mEnergyConsumerIds); - System.out.println("mEnergyConsumerIds = " + Arrays.toString(mEnergyConsumerIds) + " " - + "energy = " - + Arrays.toString(energy)); if (energy == null) { return false; } -- GitLab From a89cce5d8f00ba7ae5fdb19fecd7df1fc0ea7179 Mon Sep 17 00:00:00 2001 From: sangyun Date: Fri, 31 May 2024 11:01:56 +0900 Subject: [PATCH 243/492] Add et-rEE resource to get exact language country matching. Bug: 342052387 Test: Factory reset with Telia_EE sim to set an et language Flag: EXEMPT resource only update Change-Id: I8e73e0513c78effdbd43c64ec351cba8a75f2a56 --- core/res/res/values-et-rEE/config.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 core/res/res/values-et-rEE/config.xml diff --git a/core/res/res/values-et-rEE/config.xml b/core/res/res/values-et-rEE/config.xml new file mode 100644 index 000000000000..cf4d07f2ead0 --- /dev/null +++ b/core/res/res/values-et-rEE/config.xml @@ -0,0 +1,21 @@ + + + + false + -- GitLab From 08d95482a44c646960c8ccc17c6f436089a51fb3 Mon Sep 17 00:00:00 2001 From: Harshit Mahajan Date: Fri, 6 Sep 2024 11:21:59 +0000 Subject: [PATCH 244/492] Remove dependency on SystemProperties.set WatchdogRollbackLogger will be moved to module. We would not be able to use SystemProperties.set since it is hidden api. Instead we would use crashrecovery events to store the logs when the test property is enabled. Bug: 289203818 Test: atest NetworkStagedRollbackTest;atest StagedRollbackTest Flag: EXEMPT refactor Change-Id: Ic358b24e431588aaba1147db028eee63d276b6f6 --- .../rollback/WatchdogRollbackLogger.java | 47 +++---------- .../rollback/host/WatchdogEventLogger.java | 67 +++++++++++-------- 2 files changed, 49 insertions(+), 65 deletions(-) diff --git a/services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java b/services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java index d763199ee019..79560ce27919 100644 --- a/services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java +++ b/services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java @@ -16,6 +16,7 @@ package com.android.server.rollback; +import static com.android.server.crashrecovery.CrashRecoveryUtils.logCrashRecoveryEvent; import static com.android.server.crashrecovery.proto.CrashRecoveryStatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_REASON__REASON_APP_CRASH; import static com.android.server.crashrecovery.proto.CrashRecoveryStatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_REASON__REASON_APP_NOT_RESPONDING; import static com.android.server.crashrecovery.proto.CrashRecoveryStatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_REASON__REASON_BOOT_LOOPING; @@ -39,7 +40,7 @@ import android.content.rollback.PackageRollbackInfo; import android.content.rollback.RollbackInfo; import android.os.SystemProperties; import android.text.TextUtils; -import android.util.ArraySet; +import android.util.Log; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; @@ -47,7 +48,6 @@ import com.android.server.PackageWatchdog; import com.android.server.crashrecovery.proto.CrashRecoveryStatsLog; import java.util.List; -import java.util.Set; /** * This class handles the logic for logging Watchdog-triggered rollback events. @@ -101,22 +101,6 @@ public final class WatchdogRollbackLogger { return loggingParent; } - - /** - * Gets the set of parent packages for a given set of failed package names. In the case that - * multiple sessions have failed, we want to log failure for each of the parent packages. - * Even if multiple failed packages have the same parent, we only log the parent package once. - */ - private static Set getLogPackages(Context context, - @NonNull List failedPackageNames) { - Set parentPackages = new ArraySet<>(); - for (String failedPackageName: failedPackageNames) { - parentPackages.add(getLogPackage(context, new VersionedPackage(failedPackageName, 0))); - } - return parentPackages; - } - - static void logRollbackStatusOnBoot(Context context, int rollbackId, String logPackageName, List recentlyCommittedRollbacks) { PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller(); @@ -174,10 +158,11 @@ public final class WatchdogRollbackLogger { */ public static void logEvent(@Nullable VersionedPackage logPackage, int type, int rollbackReason, @NonNull String failingPackageName) { - Slog.i(TAG, "Watchdog event occurred with type: " + rollbackTypeToString(type) + String logMsg = "Watchdog event occurred with type: " + rollbackTypeToString(type) + " logPackage: " + logPackage + " rollbackReason: " + rollbackReasonToString(rollbackReason) - + " failedPackageName: " + failingPackageName); + + " failedPackageName: " + failingPackageName; + Slog.i(TAG, logMsg); if (logPackage != null) { CrashRecoveryStatsLog.write( CrashRecoveryStatsLog.WATCHDOG_ROLLBACK_OCCURRED, @@ -200,33 +185,19 @@ public final class WatchdogRollbackLogger { new byte[]{}); } - logTestProperties(logPackage, type, rollbackReason, failingPackageName); + logTestProperties(logMsg); } /** * Writes properties which will be used by rollback tests to check if particular rollback * events have occurred. - * - * persist.sys.rollbacktest.enabled: true if rollback tests are running - * persist.sys.rollbacktest.EVENT_TYPE: true if a particular rollback event has occurred - * ex: persist.sys.rollbacktest.ROLLBACK_INITIATE is true if ROLLBACK_INITIATE has happened - * persist.sys.rollbacktest.EVENT_TYPE.logPackage: the package to associate the rollback with - * persist.sys.rollbacktest.EVENT_TYPE.rollbackReason: the reason Watchdog triggered a rollback - * persist.sys.rollbacktest.EVENT_TYPE.failedPackageName: the failing package or process which - * triggered the rollback */ - private static void logTestProperties(@Nullable VersionedPackage logPackage, int type, - int rollbackReason, @NonNull String failingPackageName) { + private static void logTestProperties(String logMsg) { // This property should be on only during the tests - final String prefix = "persist.sys.rollbacktest."; - if (!SystemProperties.getBoolean(prefix + "enabled", false)) { + if (!SystemProperties.getBoolean("persist.sys.rollbacktest.enabled", false)) { return; } - String key = prefix + rollbackTypeToString(type); - SystemProperties.set(key, String.valueOf(true)); - SystemProperties.set(key + ".logPackage", logPackage != null ? logPackage.toString() : ""); - SystemProperties.set(key + ".rollbackReason", rollbackReasonToString(rollbackReason)); - SystemProperties.set(key + ".failedPackageName", failingPackageName); + logCrashRecoveryEvent(Log.DEBUG, logMsg); } @VisibleForTesting diff --git a/tests/RollbackTest/lib/src/com/android/tests/rollback/host/WatchdogEventLogger.java b/tests/RollbackTest/lib/src/com/android/tests/rollback/host/WatchdogEventLogger.java index 8c16079dca85..01f8bc148fce 100644 --- a/tests/RollbackTest/lib/src/com/android/tests/rollback/host/WatchdogEventLogger.java +++ b/tests/RollbackTest/lib/src/com/android/tests/rollback/host/WatchdogEventLogger.java @@ -16,33 +16,26 @@ package com.android.tests.rollback.host; +import static com.google.common.truth.Truth.assertThat; + import com.android.tradefed.device.ITestDevice; +import com.android.tradefed.log.LogUtil.CLog; + import com.google.common.truth.FailureMetadata; import com.google.common.truth.Truth; -import static com.google.common.truth.Truth.assertThat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class WatchdogEventLogger { - private static final String[] ROLLBACK_EVENT_TYPES = { - "ROLLBACK_INITIATE", "ROLLBACK_BOOT_TRIGGERED", "ROLLBACK_SUCCESS"}; - private static final String[] ROLLBACK_EVENT_ATTRS = { - "logPackage", "rollbackReason", "failedPackageName"}; - private static final String PROP_PREFIX = "persist.sys.rollbacktest."; private ITestDevice mDevice; - private void resetProperties(boolean enabled) throws Exception { + private void updateTestSysProp(boolean enabled) throws Exception { try { mDevice.enableAdbRoot(); assertThat(mDevice.setProperty( - PROP_PREFIX + "enabled", String.valueOf(enabled))).isTrue(); - for (String type : ROLLBACK_EVENT_TYPES) { - String key = PROP_PREFIX + type; - assertThat(mDevice.setProperty(key, "")).isTrue(); - for (String attr : ROLLBACK_EVENT_ATTRS) { - assertThat(mDevice.setProperty(key + "." + attr, "")).isTrue(); - } - } + "persist.sys.rollbacktest.enabled", String.valueOf(enabled))).isTrue(); } finally { mDevice.disableAdbRoot(); } @@ -50,19 +43,17 @@ public class WatchdogEventLogger { public void start(ITestDevice device) throws Exception { mDevice = device; - resetProperties(true); + updateTestSysProp(true); } public void stop() throws Exception { if (mDevice != null) { - resetProperties(false); + updateTestSysProp(false); } } - private boolean matchProperty(String type, String attr, String expectedVal) throws Exception { - String key = PROP_PREFIX + type + "." + attr; - String val = mDevice.getProperty(key); - return expectedVal == null || expectedVal.equals(val); + private boolean verifyEventContainsVal(String watchdogEvent, String expectedVal) { + return expectedVal == null || watchdogEvent.contains(expectedVal); } /** @@ -72,11 +63,33 @@ public class WatchdogEventLogger { * occurred, and return {@code true} if an event exists which matches all criteria. */ public boolean watchdogEventOccurred(String type, String logPackage, - String rollbackReason, String failedPackageName) throws Exception { - return mDevice.getBooleanProperty(PROP_PREFIX + type, false) - && matchProperty(type, "logPackage", logPackage) - && matchProperty(type, "rollbackReason", rollbackReason) - && matchProperty(type, "failedPackageName", failedPackageName); + String rollbackReason, String failedPackageName) { + String watchdogEvent = getEventForRollbackType(type); + return (watchdogEvent != null) + && verifyEventContainsVal(watchdogEvent, logPackage) + && verifyEventContainsVal(watchdogEvent, rollbackReason) + && verifyEventContainsVal(watchdogEvent, failedPackageName); + } + + /** Returns last matched event for rollbackType **/ + private String getEventForRollbackType(String rollbackType) { + String lastMatchedEvent = null; + try { + String rollbackDump = mDevice.executeShellCommand("dumpsys rollback"); + String eventRegex = ".*%s%s(.*)\\n"; + String eventPrefix = "Watchdog event occurred with type: "; + + final Pattern pattern = Pattern.compile( + String.format(eventRegex, eventPrefix, rollbackType)); + final Matcher matcher = pattern.matcher(rollbackDump); + while (matcher.find()) { + lastMatchedEvent = matcher.group(1); + } + CLog.d("Found watchdogEvent: " + lastMatchedEvent + " for type: " + rollbackType); + } catch (Exception e) { + CLog.e("Unable to find event for type: " + rollbackType, e); + } + return lastMatchedEvent; } static class Subject extends com.google.common.truth.Subject { @@ -97,7 +110,7 @@ public class WatchdogEventLogger { } void eventOccurred(String type, String logPackage, String rollbackReason, - String failedPackageName) throws Exception { + String failedPackageName) { check("watchdogEventOccurred(type=%s, logPackage=%s, rollbackReason=%s, " + "failedPackageName=%s)", type, logPackage, rollbackReason, failedPackageName) .that(mActual.watchdogEventOccurred(type, logPackage, rollbackReason, -- GitLab From b4143655975c745ea952a082b9af60ee24c4e638 Mon Sep 17 00:00:00 2001 From: Merissa Mitchell Date: Thu, 22 Aug 2024 15:51:17 -0700 Subject: [PATCH 245/492] Move PiP window back to its previous location after IME is dismissed. Recall: http://recall/clips/16488e9a-666c-4d2f-8d6f-b330f8a7ac45 Test: atest WMShellFlickerTestsPip2 Test: Show IME and dismiss IME. Verify that PiP returns to the location before IME is shown. Test: Manually move/resize PiP window while IME is expanded and verify that when IME is collapsed, the PiP window doesn't move/resize. Bug: 348693761 Flag: EXEMPT bug fix Change-Id: I125f8231aa80a0f869ee3120f7821eaef9ac6951 --- .../pip/PhonePipKeepClearAlgorithm.java | 6 +++ .../wm/shell/common/pip/PipBoundsState.java | 23 ++++++++++ .../phone/PhonePipKeepClearAlgorithmTest.java | 46 +++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java index 133242d15822..a27caf879e8a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java @@ -57,6 +57,12 @@ public class PhonePipKeepClearAlgorithm implements PipKeepClearAlgorithmInterfac Rect startingBounds = pipBoundsState.getBounds().isEmpty() ? pipBoundsAlgorithm.getEntryDestinationBoundsIgnoringKeepClearAreas() : pipBoundsState.getBounds(); + // If IME is not showing and restore bounds (pre-IME bounds) is not empty, we should set PiP + // bounds to the restore bounds. + if (!pipBoundsState.isImeShowing() && !pipBoundsState.getRestoreBounds().isEmpty()) { + startingBounds.set(pipBoundsState.getRestoreBounds()); + pipBoundsState.clearRestoreBounds(); + } Rect insets = new Rect(); pipBoundsAlgorithm.getInsetBounds(insets); if (pipBoundsState.isImeShowing()) { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java index 140d7765e5c1..c487f7543dcf 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java @@ -86,6 +86,7 @@ public class PipBoundsState { @NonNull private final Rect mExpandedBounds = new Rect(); @NonNull private final Rect mNormalMovementBounds = new Rect(); @NonNull private final Rect mExpandedMovementBounds = new Rect(); + @NonNull private final Rect mRestoreBounds = new Rect(); @NonNull private final PipDisplayLayoutState mPipDisplayLayoutState; private final Point mMaxSize = new Point(); private final Point mMinSize = new Point(); @@ -404,6 +405,10 @@ public class PipBoundsState { public void setImeVisibility(boolean imeShowing, int imeHeight) { mIsImeShowing = imeShowing; mImeHeight = imeHeight; + // If IME is showing, save the current PiP bounds in case we need to restore it later. + if (mIsImeShowing) { + mRestoreBounds.set(getBounds()); + } } /** Returns whether the IME is currently showing. */ @@ -411,6 +416,16 @@ public class PipBoundsState { return mIsImeShowing; } + /** Returns the bounds to restore PiP to (bounds before IME was expanded). */ + public Rect getRestoreBounds() { + return mRestoreBounds; + } + + /** Sets mRestoreBounds to (0,0,0,0). */ + public void clearRestoreBounds() { + mRestoreBounds.setEmpty(); + } + /** Returns the IME height. */ public int getImeHeight() { return mImeHeight; @@ -521,6 +536,10 @@ public class PipBoundsState { /** Set whether the user has resized the PIP. */ public void setHasUserResizedPip(boolean hasUserResizedPip) { mHasUserResizedPip = hasUserResizedPip; + // If user resized PiP while IME is showing, clear the pre-IME restore bounds. + if (hasUserResizedPip && isImeShowing()) { + clearRestoreBounds(); + } } /** Returns whether the user has moved the PIP. */ @@ -531,6 +550,10 @@ public class PipBoundsState { /** Set whether the user has moved the PIP. */ public void setHasUserMovedPip(boolean hasUserMovedPip) { mHasUserMovedPip = hasUserMovedPip; + // If user moved PiP while IME is showing, clear the pre-IME restore bounds. + if (hasUserMovedPip && isImeShowing()) { + clearRestoreBounds(); + } } /** diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java index 8c7b47ea7d84..e3798e92c092 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java @@ -109,6 +109,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { final Rect pipBounds = new Rect(0, 0, 100, 100); final Rect keepClearRect = new Rect(50, 50, 150, 150); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); when(mMockPipBoundsState.getRestrictedKeepClearAreas()).thenReturn(Set.of(keepClearRect)); doAnswer(invocation -> { Rect arg0 = invocation.getArgument(0); @@ -127,6 +128,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { final Rect pipBounds = new Rect(0, 0, 100, 100); final Rect keepClearRect = new Rect(100, 100, 150, 150); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); when(mMockPipBoundsState.getRestrictedKeepClearAreas()).thenReturn(Set.of(keepClearRect)); doAnswer(invocation -> { Rect arg0 = invocation.getArgument(0); @@ -145,6 +147,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { final Rect pipBounds = new Rect(0, 0, 100, 100); final Rect keepClearRect = new Rect(50, 50, 150, 150); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); when(mMockPipBoundsState.isStashed()).thenReturn(true); when(mMockPipBoundsState.getRestrictedKeepClearAreas()).thenReturn(Set.of(keepClearRect)); doAnswer(invocation -> { @@ -164,6 +167,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { final Rect pipBounds = new Rect(0, 0, 100, 100); final Rect keepClearRect = new Rect(100, 100, 150, 150); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); when(mMockPipBoundsState.isStashed()).thenReturn(true); when(mMockPipBoundsState.getRestrictedKeepClearAreas()).thenReturn(Set.of(keepClearRect)); doAnswer(invocation -> { @@ -185,6 +189,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { final Rect expected = new Rect( 0, DISPLAY_BOUNDS.bottom - 100, 100, DISPLAY_BOUNDS.bottom); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); doAnswer(invocation -> { Rect arg0 = invocation.getArgument(0); arg0.set(DISPLAY_BOUNDS); @@ -205,6 +210,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { final Rect expected = new Rect( 0, DISPLAY_BOUNDS.bottom - 100, 100, DISPLAY_BOUNDS.bottom); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); doAnswer(invocation -> { Rect arg0 = invocation.getArgument(0); arg0.set(DISPLAY_BOUNDS); @@ -227,6 +233,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { DISPLAY_BOUNDS.right - 100, DISPLAY_BOUNDS.bottom - 100, DISPLAY_BOUNDS.right, DISPLAY_BOUNDS.bottom); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); doAnswer(invocation -> { Rect arg0 = invocation.getArgument(0); arg0.set(DISPLAY_BOUNDS); @@ -249,6 +256,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { DISPLAY_BOUNDS.right - 100, DISPLAY_BOUNDS.bottom - 100, DISPLAY_BOUNDS.right, DISPLAY_BOUNDS.bottom); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); doAnswer(invocation -> { Rect arg0 = invocation.getArgument(0); arg0.set(DISPLAY_BOUNDS); @@ -269,6 +277,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { final Rect expected = new Rect( 0, DISPLAY_BOUNDS.bottom - 100, 100, DISPLAY_BOUNDS.bottom); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); when(mMockPipBoundsState.isStashed()).thenReturn(true); doAnswer(invocation -> { Rect arg0 = invocation.getArgument(0); @@ -289,6 +298,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { final Rect expected = new Rect( 0, DISPLAY_BOUNDS.bottom - 100, 100, DISPLAY_BOUNDS.bottom); when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0)); when(mMockPipBoundsState.isStashed()).thenReturn(true); doAnswer(invocation -> { Rect arg0 = invocation.getArgument(0); @@ -301,4 +311,40 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase { assertEquals(expected, outBounds); } + + @Test + public void adjust_restoreBoundsPresent_appliesRestoreBounds() { + final Rect pipBounds = new Rect(0, 0, 100, 100); + final Rect restoreBounds = new Rect(50, 50, 150, 150); + when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(restoreBounds); + when(mMockPipBoundsState.hasUserMovedPip()).thenReturn(true); + doAnswer(invocation -> { + Rect arg0 = invocation.getArgument(0); + arg0.set(DISPLAY_BOUNDS); + return null; + }).when(mMockPipBoundsAlgorithm).getInsetBounds(any(Rect.class)); + + final Rect outBounds = mPipKeepClearAlgorithm.adjust( + mMockPipBoundsState, mMockPipBoundsAlgorithm); + assertEquals(restoreBounds, outBounds); + } + + @Test + public void adjust_restoreBoundsCleared_boundsUnchanged() { + final Rect pipBounds = new Rect(0, 0, 100, 100); + final Rect restoreBounds = new Rect(0, 0, 0, 0); + when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds); + when(mMockPipBoundsState.getRestoreBounds()).thenReturn(restoreBounds); + when(mMockPipBoundsState.hasUserMovedPip()).thenReturn(true); + doAnswer(invocation -> { + Rect arg0 = invocation.getArgument(0); + arg0.set(DISPLAY_BOUNDS); + return null; + }).when(mMockPipBoundsAlgorithm).getInsetBounds(any(Rect.class)); + + final Rect outBounds = mPipKeepClearAlgorithm.adjust( + mMockPipBoundsState, mMockPipBoundsAlgorithm); + assertEquals(pipBounds, outBounds); + } } -- GitLab From 26e9b1044d4b10c91317a77d56943737bbe26b02 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Tue, 10 Sep 2024 09:08:15 +0000 Subject: [PATCH 246/492] Scroll down to avoid tapping on nav bar The test failed on phone target with ROTATION_90 and MODE_GESTURAL because the button click can accidentally trigger a recent transition. Adding a bottom padding, and scrolling to the bottom before clicking the button to prevent this from happening. Bug: 341209752 Test: atest FlickerTestsActivityEmbedding:OpenTrampolineActivityTest Flag: EXEMPT test fix Change-Id: Ifd240902d88532cee714ed624d8e08aaafb58324 --- .../open/OpenTrampolineActivityTest.kt | 2 +- .../helpers/ActivityEmbeddingAppHelper.kt | 19 +++++++++++++++++++ .../layout/activity_embedding_main_layout.xml | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt index 67825d2df361..095c8195532c 100644 --- a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt @@ -41,7 +41,7 @@ import org.junit.runners.Parameterized * Transitions: From A launch a trampoline Activity T, T launches secondary Activity B and finishes * itself, end up in split A|B. * - * To run this test: `atest FlickerTestsOther:OpenTrampolineActivityTest` + * To run this test: `atest FlickerTestsActivityEmbedding:OpenTrampolineActivityTest` */ @FlakyTest(bugId = 341209752) @RequiresDevice diff --git a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt index 4a675be65549..0bcd2f334c32 100644 --- a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt @@ -17,6 +17,7 @@ package com.android.server.wm.flicker.helpers import android.app.Instrumentation +import android.os.SystemClock import android.tools.PlatformConsts import android.tools.device.apphelpers.StandardAppHelper import android.tools.helpers.FIND_TIMEOUT @@ -25,6 +26,7 @@ import android.tools.traces.parsers.WindowManagerStateHelper import android.tools.traces.parsers.toFlickerComponent import android.util.Log import androidx.test.uiautomator.By +import androidx.test.uiautomator.Direction import androidx.test.uiautomator.Until import androidx.window.extensions.WindowExtensions import androidx.window.extensions.WindowExtensionsProvider @@ -83,6 +85,7 @@ constructor( * activity and finish itself. */ fun launchTrampolineActivity(wmHelper: WindowManagerStateHelper) { + scrollToBottom() val launchButton = uiDevice.wait( Until.findObject(By.res(packageName, "launch_trampoline_button")), @@ -210,6 +213,7 @@ constructor( * placeholder secondary activity based on the placeholder rule. */ fun launchPlaceholderSplitRTL(wmHelper: WindowManagerStateHelper) { + scrollToBottom() val launchButton = uiDevice.wait( Until.findObject(By.res(packageName, "launch_placeholder_split_rtl_button")), @@ -224,6 +228,21 @@ constructor( .waitForAndVerify() } + /** + * Scrolls to the bottom of the launch options. This is needed if the launch button is at the + * bottom. Otherwise the click may trigger touch on navBar. + */ + private fun scrollToBottom() { + val launchOptionsList = uiDevice.wait( + Until.findObject(By.res(packageName, "launch_options_list")), + FIND_TIMEOUT + ) + requireNotNull(launchOptionsList) { "Unable to find the list of launch options" } + launchOptionsList.scrollUntil(Direction.DOWN, Until.scrollFinished(Direction.DOWN)) + // Wait a bit after scrolling, otherwise the immediate click may not be treated as "click". + SystemClock.sleep(1000L) + } + companion object { private const val TAG = "ActivityEmbeddingAppHelper" diff --git a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml index 917aec1e809d..939ba81a47ea 100644 --- a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml +++ b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml @@ -21,8 +21,10 @@ android:background="@android:color/holo_orange_light">